Game Development Community

Passing objects to clients via commandToClient?

by Richard Foge · in Torque Game Builder · 05/07/2006 (10:07 pm) · 3 replies

I seem to be having trouble doing this. Is it even possible?

Looks something like:

commandToClient($Player1, 'clientCommand01', %object)

function clientCmdclientCommand01(%object)
{
%localObj.name = %object.name;
}

%object doesn't contain any data. Is what I am trying to do supported?

And if it isn't supported is there an optimal way for moving that kind of data across from server to client?

#1
05/23/2006 (5:03 pm)
You can't pass objects with the builtin networking. Basically you are limited to strings and numbers. You don't really want to move objects around over the network (other than to perhaps do some initial setup). You can code in support for what you want, but as I understand it that will requiring modding the engine.

A way to do this entirely in script would be to use functions to send over the object's "pieces".
#2
05/24/2006 (1:32 am)
The easiest way is to give your object a function that returns the needed data as a string and a function that can update the object from a given string.

Now you pass that string over the net.

I would even suggest having different functions and a leading identifier in the string blocks (like a byte), so you can update different datas independently (like position, state and the like)
#3
05/27/2006 (2:16 pm)
That's perfect, thanks!