Game Development Community

Ghost object and Sim::findObject()

by Frank Bignone · in Torque Game Engine · 08/05/2007 (3:25 am) · 5 replies

If I'm not wrong it looks like it is not possible to look for object by name for ghosted object as they do not propagate their name in the pack / unpack methods.

I have one class which always scope, and I was looking to find it on my client with Sim::findObject("xxx"). When comparing the server side and client side connection, this object is well defined on the server (with its name), but on the client the object is well defined but without name.

In order to solve this issue, I just add a write(getName()) in the pack method, and the corresponding assignName in the unpack method.

I will like to know if this behaviour is done on purpose or not? And if yes, what is the main purpose to be sure I'm not breaking something.

About the author

Real programmers don't waste time recompiling; they patch the binary files... ... Real programmers don't waste time patching binary files; they patch memory.


#1
08/05/2007 (6:40 am)
You will not be breaking anything by sending the name to the client.
This is most likely done to save bandwidth, since it's usually not needed on the client. The server and client uses datablock ID's to communicate.
#2
08/05/2007 (11:02 am)
It was done to both save space, and also provide additional security (anti-cheat). Stefan is correct-you won't break anything I can think of by adding it in, but you may have (depending on how long your object names are) very slight performance hit during mission load, and possibly give your users additional information they can use (in a bad way).

Nothing critical in either case however.
#3
08/05/2007 (9:30 pm)
Thanks for your answers.
#4
08/26/2007 (2:10 am)
In fact, there is a drawback to do so when you have server / client at same time (it means no dedicated server). Indeed, if you are doing a Sim::findObject("name"), you are not sure to have the correct object (server or client object...).
#5
08/26/2007 (7:07 am)
That's a really good catch--I hadn't considered it, but you are absolutely right!