Jump to content
  • Advertisement
Sign in to follow this  
InetRoadkill

Instantiation of ghosts using TNL

This topic is 3807 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I'm stumped. I'm trying to get TNL to instantiate an object on the client, but it doesn't seem to happening. If I'm understanding the TNL user guide (which is rather vague actually), all that's necessary is for the server to instantiate an object and TNL will do the same for the client automagically. For example, on the server: pObject *myobject = new pObject; ... should cause the same thing to happen on the client. This isn't working, so I'm assuming I'm doing it wrong. I wasn't able to find a tutorial for spawning objects using TNL. Could someone point me in the right direction?

Share this post


Link to post
Share on other sites
Advertisement
Just to make sure - this is a NetObject?

And you initialize it properly, the ghostable flags, it's properly scoped and the rest?

Share this post


Link to post
Share on other sites
Yes, it's a netobject, well a derived class of a netobject like so:

NetObject::CBaseObject::TestObject

CBaseObject is declared as a netobject (class CBaseObject : public NetObject).


The constructor looks like this:

CTestObject::CTestObject ( )
{
mNetFlags.set(Ghostable);
...


The object scoping is prolly where the problem lies. This is the scopequery:

//-----------------------------------------------------------------------------
void CTestObject::performScopeQuery (TNL::GhostConnection *connection)
{
for (int i=0; i<MAX_PLAYERS; i++)
{
if (gpGame->m_pPlayers)
{
connection->objectInScope(gpGame->m_pPlayers);
}
}
}

I'm not sure this is right. The intent is to scope this object to all players, all the time.

Share this post


Link to post
Share on other sites
Oops. I think I found part of the problem. I changed the scope query to this:

//-----------------------------------------------------------------------------
void CTestObject::performScopeQuery (TNL::GhostConnection *connection)
{
connection->objectInScope(this);
}

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!