Querying the scene objects?
by James Steele · in Torque Game Engine · 05/15/2006 (2:51 pm) · 7 replies
I'm wanting to give the player the option to control an object in the game (be it a vehicle, a turret or whatever). via menu. I need to query the objects in the world, so should I be using the server or client copies of the scene graph for this?
About the author
#2
05/15/2006 (4:34 pm)
The server copies. Just put all the objects for a category inside a simset or group, and have your GUI query the server to get that data.
#3
and when the user selects an object to control,
just send their selection up to the server.
The server will of course need to validate their selection to prevent cheating.
@Paul - is there a reason not to do it this way ?
05/15/2006 (5:47 pm)
I would fill the GUIs from client-side data,and when the user selects an object to control,
just send their selection up to the server.
The server will of course need to validate their selection to prevent cheating.
@Paul - is there a reason not to do it this way ?
#4
05/15/2006 (5:50 pm)
If you validate it on the server I guess not... I suppose that's slightly more complex but ultimately less computationally intensive.
#5
05/15/2006 (5:56 pm)
Gotcha, thanks.
#6
One more question though;
How would I go about validate the client-side selection on the server? I do intend to have co-op play over the network so this is rather an important thing for me.
Thanks again!
05/15/2006 (9:38 pm)
Thanks for all of the help guys, I really do appreciate it.One more question though;
How would I go about validate the client-side selection on the server? I do intend to have co-op play over the network so this is rather an important thing for me.
Thanks again!
#7
05/15/2006 (10:44 pm)
As a general rune, all actions done in the game are performed on the server. The client acts only as a user interface. When the players makes their selection, you send it to the server (using a command to server). On the server you validate their selection and perform the required action. Hope that helps
Torque Owner Brian Hill
Alternatively, you could turn it around, and have the 'menu-available objects' spawn triggers around themselves in their 'onAdd' callbacks, and in the trigger code, set a 'menu option available' flag in any players that enter it, and turn off the flag when they leave the trigger. To then build the menu, you'd just look at the currently available menu option flags.