Invalid packet, gamebase unpackUpdate
by Spider · in Torque Game Engine · 02/16/2005 (2:41 am) · 7 replies
I'm getting an error that says 'i don't have the correct version blablabla...' then '(invalid packet GameBase::unpackUpdate())' When I debug into that part of the code, the object that's causing the problem has a null name and a null datablock pointer.
anybody got any tips on figuring out which object this is that's causing the problem?
anybody got any tips on figuring out which object this is that's causing the problem?
#2
1) pretty much copied directly from the simple conobject example. it's never updated and i'm pretty sure that's not the problem.
the other 2 are much more likely subjects:
2) I am porting from another engine, in which my game was based on a global game object. I have made it derive from a gamebase object so that it receives tick updates. It doesn't change the onadd, onnewdatablock, or pack/unpack. however, because of how my game was written, I instantiated this object in a funny way:
3) My game objects are also derived from GameBase. For them, I took the Item.cc code almost verbatim and changed only the things I needed. I did make a few changes to the unpack/pack update for these objects, but not to the unpack/pack data, onAdd or onNewDataBlock.
NOTE: I am especially interested in general methods used for debugging this type of problem. Not necessarily an answer to this specific crash...
02/16/2005 (2:06 pm)
I have 3 new object types.1) pretty much copied directly from the simple conobject example. it's never updated and i'm pretty sure that's not the problem.
the other 2 are much more likely subjects:
2) I am porting from another engine, in which my game was based on a global game object. I have made it derive from a gamebase object so that it receives tick updates. It doesn't change the onadd, onnewdatablock, or pack/unpack. however, because of how my game was written, I instantiated this object in a funny way:
CreatrixGame CG;
CreatrixGameData CGD;
void CreatrixGame::Init()
{
setDataBlock (&CGD);
registerObject("CG");
}3) My game objects are also derived from GameBase. For them, I took the Item.cc code almost verbatim and changed only the things I needed. I did make a few changes to the unpack/pack update for these objects, but not to the unpack/pack data, onAdd or onNewDataBlock.
NOTE: I am especially interested in general methods used for debugging this type of problem. Not necessarily an answer to this specific crash...
#3
Using the VS.net debugger, I put a breakpoint on the if command, then did a Step Into to see what was going on. The error only occurred when I added my object to the game world, so that's why I didn't have to worry about tracking lots of unpackUpdates for objects.
findObject() was returning true, but it turns out setDataBlock() of my object was returning false. It was because I had it only taking into account what the server did because I didn't realize the client also called that function. Once I made the right changes (the client object returned true from onNewDataBlock()), everything was alright.
For TGE debugging I typically just put breakpoints everywhere and watch how the variables change. :) After understanding the engine better, things get quicker.
02/16/2005 (2:30 pm)
Well, I just had the exact same error recently, although for a different reason. What I did was a text search using Agent Ransack, and found where the error message "invalid packet GameBase::unpackUpdate()" was. Here it is:void GameBase::unpackUpdate(NetConnection *con, BitStream *stream)
//...
if (!Sim::findObject(id,dptr) || !setDataBlock(dptr))
con->setLastError("Invalid packet GameBase::unpackUpdate()");
//...Using the VS.net debugger, I put a breakpoint on the if command, then did a Step Into to see what was going on. The error only occurred when I added my object to the game world, so that's why I didn't have to worry about tracking lots of unpackUpdates for objects.
findObject() was returning true, but it turns out setDataBlock() of my object was returning false. It was because I had it only taking into account what the server did because I didn't realize the client also called that function. Once I made the right changes (the client object returned true from onNewDataBlock()), everything was alright.
For TGE debugging I typically just put breakpoints everywhere and watch how the variables change. :) After understanding the engine better, things get quicker.
#4
Short version: compile with DEBUG_NET enabled, first off, then run it and look for pack/unpack mismatch errors.
02/16/2005 (2:57 pm)
I have been meaning to do a tutorial on debugging network stuff, maybe I'll do that today. Short version: compile with DEBUG_NET enabled, first off, then run it and look for pack/unpack mismatch errors.
#5
02/16/2005 (3:09 pm)
Ha! thanks pat, i just discovered that in the code and am working off the clues it's giving me!
#6
looking forward to the network tutorial, pat.
rock on
02/16/2005 (6:31 pm)
Thanks guys i found the bug ;) looking forward to the network tutorial, pat.
rock on
#7
02/25/2005 (11:58 am)
I get this error also when I added a castle to the game. It turns out that I had forgotten a texture and that caused the problem.
Torque 3D Owner Drew Parker