AFX - GMK merge
by Sean Rice · in Game Mechanics Kit · 02/26/2010 (5:55 pm) · 5 replies
I am trying to merge AFX and GMK and am having issues with physicalZone.cpp in
U32 PhysicalZone::packUpdate(NetConnection* con, U32 mask, BitStream* stream)
and
void PhysicalZone::unpackUpdate(NetConnection* con, BitStream* stream)
I am being asked to merge in this code into a section that has been rewritten by AFX and I have tried for hours without successfully merging these few lines into the blocks.
U32 PhysicalZone::packUpdate(NetConnection* con, U32 mask, BitStream* stream)
and
void PhysicalZone::unpackUpdate(NetConnection* con, BitStream* stream)
I am being asked to merge in this code into a section that has been rewritten by AFX and I have tried for hours without successfully merging these few lines into the blocks.
//.logicking >>
stream->writeFlag(mInvisibleWall);
//.logicking <<
} else {
stream->writeFlag(mActive);
}//.logicking >>
mInvisibleWall = stream->readFlag();
//.logicking <<
} else {
mActive = stream->readFlag();
}
}1: //--------------------------------------------------------------------------
2: U32 PhysicalZone::packUpdate(NetConnection* con, U32 mask, BitStream* stream)
3: {
4: U32 i;
5: U32 retMask = Parent::packUpdate(con, mask, stream);
6:
7: // AFX CODE BLOCK (enhanced-physical-zone)(pz-opt) <<
8: if (stream->writeFlag(mask & PolyhedronMask))
9: {
10: // Write the polyhedron
11: stream->write(mPolyhedron.pointList.size());
12: for (i = 0; i < mPolyhedron.pointList.size(); i++)
13: mathWrite(*stream, mPolyhedron.pointList[i]);
14:
15: stream->write(mPolyhedron.planeList.size());
16: for (i = 0; i < mPolyhedron.planeList.size(); i++)
17: mathWrite(*stream, mPolyhedron.planeList[i]);
18:
19: stream->write(mPolyhedron.edgeList.size());
20: for (i = 0; i < mPolyhedron.edgeList.size(); i++) {
21: const Polyhedron::Edge& rEdge = mPolyhedron.edgeList[i];
22:
23: stream->write(rEdge.face[0]);
24: stream->write(rEdge.face[1]);
25: stream->write(rEdge.vertex[0]);
26: stream->write(rEdge.vertex[1]);
27: }
28: }
29:
30: if (stream->writeFlag(mask & MoveMask))
31: {
32: stream->writeAffineTransform(mObjToWorld);
33: mathWrite(*stream, mObjScale);
34: }
35:
36: if (stream->writeFlag(mask & SettingsMask))
37: {
38: stream->write(mVelocityMod);
39: stream->write(mGravityMod);
40: mathWrite(*stream, mAppliedForce);
41: stream->writeInt(force_type, FORCE_TYPE_BITS);
42: stream->writeFlag(orient_force);
43: }
44:
45: if (stream->writeFlag(mask & FadeMask))
46: {
47: U8 fade_byte = (U8)(fade_amt*255.0f);
48: stream->write(fade_byte);
49: }
50:
51: stream->writeFlag(mActive);
52: /* ORIGINAL CODE
53: if (stream->writeFlag((mask & InitialUpdateMask) != 0)) {
54: // Note that we don't really care about efficiency here, since this is an
55: // edit-only ghost...
56: mathWrite(*stream, mObjToWorld);
57: mathWrite(*stream, mObjScale);
58:
59: // Write the polyhedron
60: stream->write(mPolyhedron.pointList.size());
61: for (i = 0; i < mPolyhedron.pointList.size(); i++)
62: mathWrite(*stream, mPolyhedron.pointList[i]);
63:
64: stream->write(mPolyhedron.planeList.size());
65: for (i = 0; i < mPolyhedron.planeList.size(); i++)
66: mathWrite(*stream, mPolyhedron.planeList[i]);
67:
68: stream->write(mPolyhedron.edgeList.size());
69: for (i = 0; i < mPolyhedron.edgeList.size(); i++) {
70: const Polyhedron::Edge& rEdge = mPolyhedron.edgeList[i];
71:
72: stream->write(rEdge.face[0]);
73: stream->write(rEdge.face[1]);
74: stream->write(rEdge.vertex[0]);
75: stream->write(rEdge.vertex[1]);
76: }
77:
78: stream->write(mVelocityMod);
79: stream->write(mGravityMod);
80: mathWrite(*stream, mAppliedForce);
81: stream->writeFlag(mActive);
82: } else {
83: stream->writeFlag(mActive);
84: }
85: */
86: // AFX CODE BLOCK (enhanced-physical-zone)(pz-opt) >>
87:
88: return retMask;
89: }
90:
91: void PhysicalZone::unpackUpdate(NetConnection* con, BitStream* stream)
92: {
93: Parent::unpackUpdate(con, stream);
94:
95: // AFX CODE BLOCK (enhanced-physical-zone)(pz-opt) <<
96: bool new_ph = false;
97: if (stream->readFlag()) // PolyhedronMask
98: {
99: U32 i, size;
100: Polyhedron tempPH;
101:
102: // Read the polyhedron
103: stream->read(&size);
104: tempPH.pointList.setSize(size);
105: for (i = 0; i < tempPH.pointList.size(); i++)
106: mathRead(*stream, &tempPH.pointList[i]);
107:
108: stream->read(&size);
109: tempPH.planeList.setSize(size);
110: for (i = 0; i < tempPH.planeList.size(); i++)
111: mathRead(*stream, &tempPH.planeList[i]);
112:
113: stream->read(&size);
114: tempPH.edgeList.setSize(size);
115: for (i = 0; i < tempPH.edgeList.size(); i++) {
116: Polyhedron::Edge& rEdge = tempPH.edgeList[i];
117:
118: stream->read(&rEdge.face[0]);
119: stream->read(&rEdge.face[1]);
120: stream->read(&rEdge.vertex[0]);
121: stream->read(&rEdge.vertex[1]);
122: }
123:
124: setPolyhedron(tempPH);
125: new_ph = true;
126: }
127:
128: if (stream->readFlag()) // MoveMask
129: {
130: MatrixF temp;
131: stream->readAffineTransform(&temp);
132:
133: Point3F tempScale;
134: mathRead(*stream, &tempScale);
135:
136: //if (!new_ph)
137: //{
138: // Polyhedron rPolyhedron = mPolyhedron;
139: // setPolyhedron(rPolyhedron);
140: //}
141: setScale(tempScale);
142: setTransform(temp);
143: }
144:
145: if (stream->readFlag()) //SettingsMask
146: {
147: stream->read(&mVelocityMod);
148: stream->read(&mGravityMod);
149: mathRead(*stream, &mAppliedForce);
150: force_type = stream->readInt(FORCE_TYPE_BITS); // AFX
151: orient_force = stream->readFlag(); // AFX
152: }
153:
154: if (stream->readFlag()) //FadeMask
155: {
156: U8 fade_byte;
157: stream->read(&fade_byte);
158: fade_amt = ((F32)fade_byte)/255.0f;
159: }
160: else
161: fade_amt = 1.0f;
162:
163: mActive = stream->readFlag();
164: /* ORIGINAL CODE
165: if (stream->readFlag()) {
166: U32 i, size;
167: MatrixF temp;
168: Point3F tempScale;
169: Polyhedron tempPH;
170:
171: // Transform
172: mathRead(*stream, &temp);
173: mathRead(*stream, &tempScale);
174:
175: // Read the polyhedron
176: stream->read(&size);
177: tempPH.pointList.setSize(size);
178: for (i = 0; i < tempPH.pointList.size(); i++)
179: mathRead(*stream, &tempPH.pointList[i]);
180:
181: stream->read(&size);
182: tempPH.planeList.setSize(size);
183: for (i = 0; i < tempPH.planeList.size(); i++)
184: mathRead(*stream, &tempPH.planeList[i]);
185:
186: stream->read(&size);
187: tempPH.edgeList.setSize(size);
188: for (i = 0; i < tempPH.edgeList.size(); i++) {
189: Polyhedron::Edge& rEdge = tempPH.edgeList[i];
190:
191: stream->read(&rEdge.face[0]);
192: stream->read(&rEdge.face[1]);
193: stream->read(&rEdge.vertex[0]);
194: stream->read(&rEdge.vertex[1]);
195: }
196:
197: stream->read(&mVelocityMod);
198: stream->read(&mGravityMod);
199: mathRead(*stream, &mAppliedForce);
200:
201: setPolyhedron(tempPH);
202: setScale(tempScale);
203: setTransform(temp);
204: mActive = stream->readFlag();
205: } else {
206: mActive = stream->readFlag();
207: }
208: */
209: // AFX CODE BLOCK (enhanced-physical-zone)(pz-opt) >>
210: }About the author
http://www.hngamers.com
#2
02/27/2010 (8:18 am)
Thanks Jaimi, that seems to have done the trick. I thought I could do that I just wasn't sure.
#3
I need intelligent bots in my game, UAIK refuses to work with the AFX SDK and now it seems that GMK is refusing. I know others are using GMK... there has to be something I am doing wrong, although I am following the directions to the letter.
Error:
Fatal: (d:torquetgeaenginesourcesimnetobject.cpp @ 60) Invalid net mask bits set.
02/27/2010 (8:30 am)
Actually, nope... it's doing the exact same thing as before. I either get an error that my netbits are wrong and/or clients are no longer able to connect to the server and it crashes/hangs up on loading datablock. I have tried the GMK merge a dozen times now and each time I have run into the same issue. GMK by itself is not a problem, touch the AFX code at all and bam instant failure. I tried with a TGEA and merged GMK and then AFX into my project and failed. I tried with the AFX SDK and cannot get GMK installed. I need intelligent bots in my game, UAIK refuses to work with the AFX SDK and now it seems that GMK is refusing. I know others are using GMK... there has to be something I am doing wrong, although I am following the directions to the letter.
Error:
Fatal: (d:torquetgeaenginesourcesimnetobject.cpp @ 60) Invalid net mask bits set.
#4
02/27/2010 (10:11 pm)
hmm - its balanced, so it should be OK. Sounds likely that there is some other issue going on - if you can send me the file, I'll look at it.
#5
03/12/2010 (9:44 am)
How did this pan out Sean? This is my next move.
Associate Jaimi McEntire
King of Flapjacks
in PackUpdate:
stream->writeFlag(mInvisibleWall);
stream->writeFlag(mActive);
in UnpackUpdate:
mInvisibleWall = stream->readFlag();
mActive = stream->readFlag();