Unable to get ghosts to spawn on client
by Matthew Lewis · in Technical Issues · 04/01/2007 (8:37 pm) · 4 replies
I'm having trouble getting the ghost to spawn on the client.
In short, I make a connection to the server whereupon the server creates a player instance. I added a bunch of print statements at strategic spots and I've determined that the connection is being made and that the player is being instanced on the server. (The constructor has a print statement in it.) However, none of the server-side player network routines are being called (like performScopeQuery or packUpdate). Also, it doesn't look like there are any attempts on the client to create a ghost instance of the player (at least none of the traps I set were tripped on the client). The player class is a subclass of TNL::NetObject and has the TNL_DECLARE_CLASS(CPlayer) and TNL_IMPLEMENT_NETOBJECT(CPlayer) macros in place.
I'm guessing that I'm overlooking something, but as near as I can tell my code isn't much different than the TestGame example. Could someone give me a hint?
In short, I make a connection to the server whereupon the server creates a player instance. I added a bunch of print statements at strategic spots and I've determined that the connection is being made and that the player is being instanced on the server. (The constructor has a print statement in it.) However, none of the server-side player network routines are being called (like performScopeQuery or packUpdate). Also, it doesn't look like there are any attempts on the client to create a ghost instance of the player (at least none of the traps I set were tripped on the client). The player class is a subclass of TNL::NetObject and has the TNL_DECLARE_CLASS(CPlayer) and TNL_IMPLEMENT_NETOBJECT(CPlayer) macros in place.
I'm guessing that I'm overlooking something, but as near as I can tell my code isn't much different than the TestGame example. Could someone give me a hint?
About the author
#2
But now I have a new problem. It seems that packUpdate only gets called for the initial update, but never gets called after that despite having this in the code:
//-----------------------------------------------------------------------------
void CPlayer::performScopeQuery (TNL::GhostConnection *connection)
{
connection->objectInScope(this);
}
As near as I can tell, this forces the player to always be in scope, but apparently something else has to happen to get the packUpdate function to do its thing. ???
04/02/2007 (10:29 am)
Found the problem. It was a missing call to setScopeObject(plr);But now I have a new problem. It seems that packUpdate only gets called for the initial update, but never gets called after that despite having this in the code:
//-----------------------------------------------------------------------------
void CPlayer::performScopeQuery (TNL::GhostConnection *connection)
{
connection->objectInScope(this);
}
As near as I can tell, this forces the player to always be in scope, but apparently something else has to happen to get the packUpdate function to do its thing. ???
#3
04/02/2007 (12:35 pm)
Objects need data groups marked as dirty (setMaskBits in stock Torque, not sure what the implementation is in TNL).
#4
04/02/2007 (2:28 pm)
I found the problem. It was the maskbits not getting set. The routine that was supposed to set them was taking an early exit.
Associate Orion Elenzil
Real Life Plus
ie, just creating a new player object isn't enough; it needs to be added into the scenegraph.
not sure what the parallel is in TNL.