Game Development Community

Transmission of objects

by Till Hoffmann · in Torque Game Engine · 11/24/2005 (8:51 am) · 5 replies

Hello,

I created a SimObject on the server side and added some tagged fields:

%item = new SimObject ()
{
pos = %myvar;
extent = %myvar2;
...
};

Now I want to transfer this information to the client. How to do that?
Datablocks can be transmitted by transmitting their ID, but that doesn't work with items.
I need all tagged fields of the object, but the number and name of the tagged fields my vary.

#1
11/27/2005 (1:33 pm)
You either need to use a commandToClient (there are examples in the demo scripts) or you are going to need to write some C++ code.
#2
11/28/2005 (10:18 am)
Well, I am not an owner of the SDK, so I have to use the script.
Using
commandtoclient(%client, %myclient);
only transmits the object's ID.

Can you give me any example how to transmit all static and dynamic fields???

Thanks
#3
11/28/2005 (3:38 pm)
Something like:

function clientCmdBuildMyObject(%pos, %extent, %myvar2, %myvar3)
{
   %clientitem = new ScriptObject()
   {
       pos = %pos;
       extent = %extent;
       myvar2 = %myvar2;
       myvar3 = %myvar3;
   };
}

commantToClient(%clientId, 'BuildMyObject', %pos, %extent, %myvar2, %myvar3);
#4
11/29/2005 (8:12 am)
Well, I've already thought about something like that, but I have to transmit different items and some of them have additional information.
So the amount of data I've to transmit varies.

Any ideas?
#5
11/29/2005 (8:22 am)
I think there is a way to dump an object's fields to script. Do a dump() on a SimObject on the console and see what you get. I *think* the GUI editor and mission editor both use some sort of save features to save out their fields. You could try looking into if you could use this to save the fields to script variables and dynamically pass them over.