The NULL Ghost Cometh!
by Justin DuJardin · in Torque Game Engine · 05/15/2002 (12:50 am) · 6 replies
When playing since applying the last engine update from the CVS i've been getting random "Null ghost encountered" Fatal Assertions. I checked into the code that was inciting the assertion and it appears to me that, well it, pukes if you will, on a NULL ghost but in the same code block if the assertion is not thrown it deletes the ghost and sets it to NULL anyways. My question is this, will I be damaging anything serious, or just doing something stupid by changing the following assertion code...
..to..
because one would think that if it were already NULL the object would not need to be deleted.
Any incite into this matter is much appreciated
Regards,
Justin 'av0n' DuJardin
if(bstream->readFlag()) // is this ghost being deleted?
{
AssertFatal(mLocalGhosts[index] != NULL, "Error, NULL ghost encountered.");
mLocalGhosts[index]->deleteObject();
mLocalGhosts[index] = NULL;
}..to..
if(bstream->readFlag()) // is this ghost being deleted?
{
if(mLocalGhosts[index] != NULL)
{
mLocalGhosts[index]->deleteObject();
mLocalGhosts[index] = NULL;
}
}because one would think that if it were already NULL the object would not need to be deleted.
Any incite into this matter is much appreciated
Regards,
Justin 'av0n' DuJardin
#2
Are you maybe deleting a ghost object from the client side and not the server side? Have you tried running this on a dedicated server?
05/16/2002 (6:19 pm)
I'm not too sure what could be causing this. Are you maybe deleting a ghost object from the client side and not the server side? Have you tried running this on a dedicated server?
#3
In my case, I think that this happens because the ghost wasn't instantiated on client side.
On the constructor I have set the flags mNetFlags.set(Ghostable|ScopeAlways);
On the onAdd method, I have called the method addToScene().
The method packUpdate(), processTick(), etc. have run normally in server side, but nothing appears on client side.
The oddest thing is that this code was made weeks ago, worked fine and not changed since (i think). Two days ago, this has stop working because of the NULL Ghost problem.
PS: I'm sure that i only delete the object on server side!
Any suggestion?
01/07/2004 (7:10 am)
I have the same problem with the NULL Ghost. I notice that the early posts are old, so I am hopeful that you already came to a solution ;)In my case, I think that this happens because the ghost wasn't instantiated on client side.
On the constructor I have set the flags mNetFlags.set(Ghostable|ScopeAlways);
On the onAdd method, I have called the method addToScene().
The method packUpdate(), processTick(), etc. have run normally in server side, but nothing appears on client side.
The oddest thing is that this code was made weeks ago, worked fine and not changed since (i think). Two days ago, this has stop working because of the NULL Ghost problem.
PS: I'm sure that i only delete the object on server side!
Any suggestion?
#4
01/07/2004 (9:38 am)
You will need to use the appropriate wrapper methods from the NetConnection class to fetch/translate ghost IDs - it can take a little time, up to a second or two, for ghosts to propagate.
#5
Try compiling and defining DEBUG_NET, which will prefix each ghost update with a special marker - it will notify you if any of your objects do not have symmetric packUpdate/unpackUpdate routines...
Actually, that macro may not work correctly in Torque 1 - but it should be a simple fix to get it to work properly.
- Mark
01/07/2004 (9:42 am)
It's possible that you have an error in your pack/unpack routines...Try compiling and defining DEBUG_NET, which will prefix each ghost update with a special marker - it will notify you if any of your objects do not have symmetric packUpdate/unpackUpdate routines...
Actually, that macro may not work correctly in Torque 1 - but it should be a simple fix to get it to work properly.
- Mark
Torque 3D Owner Frank Bignone
Darkhand Studio
So does someone know what may cause that NULL ghost problem ?
Here is my post BTW www.garagegames.com/index.php?sec=mg&mod=forums&page=result.thread&qt=5205
I'm glad that someone else has the same problems, I was feeling alone ;)