OnGhostAdd()
by Phil Flesher · in Torque Game Engine · 08/27/2004 (2:07 pm) · 3 replies
Is there any reason in particular that onGhostAdd() is called after the initial object update instead of before?
I have some pre-update initialization that must be done before that first update, but I don't see a virtual member function of GhostConnection that I can override to accomplish that. I COULD theoretically get around this by doing my initialization in unpackUpdate() inside of a guard using isInitialUpdate(), but I'd rather not put that code there and I don't want to do that check every time.
Suggestions?
I have some pre-update initialization that must be done before that first update, but I don't see a virtual member function of GhostConnection that I can override to accomplish that. I COULD theoretically get around this by doing my initialization in unpackUpdate() inside of a guard using isInitialUpdate(), but I'd rather not put that code there and I don't want to do that check every time.
Suggestions?
#2
Example:
class GameObjectTypeXNET;
class GameObjectTypeX : GameObjectBaseType{
public :
GameObjectTypeX();
~GameObjectTypeX();
private :
GameObjectTypeXNET *_netObject;
};
class GameObjectTypeXNET : TNL::NetObject {
public :
GameObjectTypeXNET();
~GameObjectTypeXNET();
// other TNL overrides here to control
// pack/unpack behavior, etc.
private :
GameObjectTypeX *_gameObject;
};
So, I could theoretically instantiate that _gameObject pointer every time a ghost is created by just putting that code in the constructor of GameObjectTypeXNET, but I would prefer not to. I would like to retain the possibility of instantiating either GameObjectTypeX or its NET class without necessarily creating an instance of the other.
Thus, I need some way of doing pre-initial-update initialization WITHOUT using the constructor.
08/30/2004 (7:48 am)
We are abstracting TNL-related stuff into a separate class hierarchy that "connects" to the game objects that we have through encapsulation.Example:
class GameObjectTypeXNET;
class GameObjectTypeX : GameObjectBaseType{
public :
GameObjectTypeX();
~GameObjectTypeX();
private :
GameObjectTypeXNET *_netObject;
};
class GameObjectTypeXNET : TNL::NetObject {
public :
GameObjectTypeXNET();
~GameObjectTypeXNET();
// other TNL overrides here to control
// pack/unpack behavior, etc.
private :
GameObjectTypeX *_gameObject;
};
So, I could theoretically instantiate that _gameObject pointer every time a ghost is created by just putting that code in the constructor of GameObjectTypeXNET, but I would prefer not to. I would like to retain the possibility of instantiating either GameObjectTypeX or its NET class without necessarily creating an instance of the other.
Thus, I need some way of doing pre-initial-update initialization WITHOUT using the constructor.
#3
09/04/2004 (2:04 pm)
Sounds like you're best off just adding it to the core code.
Associate Kyle Carter