How do I change Traffic Lights on server?
by Shon Gale · in Torque Game Engine · 11/29/2007 (6:33 am) · 2 replies
I have the book Advanced 3D Game Programming All in One and in chapter 16 there is a Traffic Light resource. It works simply by changing the skins and having a delay using the schedule() function. It works great in single player mode. But it doesn't do it server side. I need to know how to change the Lights for every user at the same time. I am also having the same problem opening doors. I know it is probably very simple. Can anyone help???
About the author
#2
So I have been tracing the code to follow the logic and flow of the client/server system implemented in Torque.
I definitely feel a resource coming here, because this involves a lot of Resource Paks available for sale at Garage Games. Many of the Resources that are sold here and presented on the forums do not work server-side. They only work client side or Single Player mode. Thanks for the link! I printed it out and will study at length. Understanding the flow of the networking system is necessary.
I will keep posting here until I have documented a solution.
11/30/2007 (5:46 am)
@Matthew: Thanks a lot for your quick response. I appreciate all the help I can get with this engine. I own all 3 books they have published and I still have major problems implementing server side operations. A clear laid out method to doing this would be fantastic. I have been using AFX with TGE 1.5.2 and have no problems with the spell system server side. It operates flawlessly with several users on a very low end dedicated server system.So I have been tracing the code to follow the logic and flow of the client/server system implemented in Torque.
I definitely feel a resource coming here, because this involves a lot of Resource Paks available for sale at Garage Games. Many of the Resources that are sold here and presented on the forums do not work server-side. They only work client side or Single Player mode. Thanks for the link! I printed it out and will study at length. Understanding the flow of the networking system is necessary.
I will keep posting here until I have documented a solution.
Torque 3D Owner Matthew Jessick
%count = ClientGroup.getCount(); for (%i = 0; %i < %count; %i++) { %cl = ClientGroup.getObject(%i); if( !%cl.isAIControlled() ) { commandToClient(%cl, 'SetLight',%cmd); } }The commandToClient system sends a message that is guaranteed to arrive, in the order sent. (It resends until they arrive).
For more, see: (From a different book?)
www.garagegames.com/docs/tge/general/ch06s11.php
On the client you could script to receive and act on the message: (For example in Client.cs)
function clientCmdSetLight(%cmd) { }Alternately, you could create a traffic light object in the C++ code properly so that all of them that can be seen by a particular client have any status changes automatically sent to that client. This is a more advanced technique, obviously.