input commands processing flow of Torque 3D V2.0
by lys · in Torque 3D Professional · 02/25/2013 (7:51 pm) · 3 replies
Hi, guys,
I am studying the source code of Torque 3D V2.0 and find difficulty to understand the input commands processing flow of Torque. I can find the code of the updates from server to client but i cannot find where the client send the input commands to server? i know the ghost technique used in Torque and read all the official document regarding the engine. but i still cannot understand the input commands processing part. anyone can explain to me more detailed? thanks very much!
Regards!
I am studying the source code of Torque 3D V2.0 and find difficulty to understand the input commands processing flow of Torque. I can find the code of the updates from server to client but i cannot find where the client send the input commands to server? i know the ghost technique used in Torque and read all the official document regarding the engine. but i still cannot understand the input commands processing part. anyone can explain to me more detailed? thanks very much!
Regards!
Associate Chris Haigler
Jester Dance
Essentially there are several global script variables exposed by MoveManager that represent various movement states (e.g. forward, backward, left, right, jumping, firing, etc.). The values of these global variables are queried every 32ms, 'packed' into a 'Move' object and sent to the server by the GameConnection class. This all occurs in the engine (C++).
On the script side, default.binds.cs defines several script functions that modify the movement globals (e.g. the moveforward() function sets $mvForwardAction to a value if the player is moving forward). These functions are then bound to a key (moveforward() is bound to 'W' by default, I believe).
So, whenever the player presses a movement key, the appropriate global var is changed, the engine reads the value of the global variable, packs it into a 'Move' object and sends it to the server every 32ms.