Server and Client
by Garth Wood · in Torque Game Engine · 04/28/2006 (4:08 pm) · 2 replies
Hi
This is a general question. How does the whole client and server thing work? Why is it that the game scripts such as the crossbow etc are on the server and not the client? Surely the server should just serve as a connection and the client hold all the data?
Apart from that, I'm a bit confused as where to send commands. I was trying to get throwing of an object working just buy getting the controlling object in the client default bindings and then stumbled across a tutorial that used serverCmd... and it worked.
So when do I send a command to the client and when to the server? I think what i really want to know is, what is going to update what.
Thanks
This is a general question. How does the whole client and server thing work? Why is it that the game scripts such as the crossbow etc are on the server and not the client? Surely the server should just serve as a connection and the client hold all the data?
Apart from that, I'm a bit confused as where to send commands. I was trying to get throwing of an object working just buy getting the controlling object in the client default bindings and then stumbled across a tutorial that used serverCmd... and it worked.
So when do I send a command to the client and when to the server? I think what i really want to know is, what is going to update what.
Thanks
About the author
Torque Owner Paul /*Wedge*/ DElia
Things like movement and firing already have C++ functionality using the MoveManager, but anything else that needs to interact between all the possible players in the game world needs to be sent as a CommandToServer (assuming you only want to use script). You've seen the example where it's needed to change the control client, because _all_ the other players would need to know this data to see things properly. Even with a single player game, the client/server model is so intrinsic to how TGE is setup, it's best you just learn to work with it.