Game Development Community

GetDataBlockGroup doesn't work in remote client

by Shannon "ScarWars" Scarvaci · in Torque Game Engine · 04/10/2006 (12:07 am) · 5 replies

I testing around with local connection and remote connection but i found out that using Sim::getDataBlockGroup() doesn't work in remote connection (client side), but it work in server and local connection. Any idea to get around to it?

Shannon

SimDataBlockGroup * dataGroup = Sim::getDataBlockGroup();
	for(SimDataBlockGroup::iterator itr = dataGroup->begin(); itr != dataGroup->end(); itr++)
	{
		PlayerData * pDat = dynamic_cast<PlayerData *>(*itr);
		if(pDat )
		{
			pDat ->update();
		}
	}

#1
04/10/2006 (12:44 am)
Datablocks are added to the ServerConnection (GameConnection is also a SimGroup or a SimSet, I forget which) on remote clients.
#2
04/10/2006 (1:03 am)
I've look into GameConnection code and found the variable called "mDataBlockLoadList" but i had to modify the code to get that variables, is that the only way to do this? (I like to keep code clean :P )

Shannon
#3
04/10/2006 (1:48 am)
Err, no. You don't have to modify the code at all.

From script:

for(%i = 0;%i < ServerConnection.getCount();%i++)
{
   %data = ServerConnection.getObject(%i);
   // ... do something with %data ...
}

From C++ you need to get the connection to server, which IIRC you do with the static method NetConnection::getConnectionToServer() (I forget exactly what the method is, been a while since I needed it) then iterate it like you would any other SimGroup/SimSet.

T.
#4
04/11/2006 (8:20 pm)
I finially got it working and thank to Tom. If people want to know how to do this then see the code below.

Shannon

[b]SimGroup *serverConnection = dynamic_cast<SimGroup*>(Sim::findObject("ServerConnection"));[/b]

for(SimGroup::iterator itr = dataGroup->begin(); itr != dataGroup->end(); itr++)
{
	PlayerData * pDat = dynamic_cast<PlayerData *>(*itr);
	if(pDat )
	{
		pDat ->update();
	}
}
#5
06/29/2010 (10:16 am)
Shannon,

Very sorry to post this here, but I couldn't find any contact info for you and not sure if you saw my posts on your resource for integrating PhysX into TGEA. I also noticed you own T3D which will be a huge help in my question. If you could possibly take a moment to look...:
www.torquepowered.com/community/resources/view/12711/7#comment-158397

Thanks!