Game Development Community

Question on object manipulation

by Dylan Sarber · in Torque Game Engine · 01/18/2009 (8:38 pm) · 2 replies

Ok...I'm pretty new with Torque, and there's a few things I'm having trouble grasping with TorqueScript and how it relates down to the engine.

As an example for my question, I'll use the starter.fps example included with the SDK since it's where this question first came to mind.

The question:

With actionMaps, more specifically we'll just talk keys for movement (WASD), when the key is mapped to a defined function, how is it translating the player correctly?

To give further explanation, I'll show an example from starter.fps:
function moveforward(%val)
{
   $mvForwardAction = %val * $movementSpeed;
}

...

moveMap.bind( keyboard, w, moveforward );

Now, I understand how the function is bound to the key, but what I don't understand is how the function block actually tells the server the player is 'moving' when $mvForwardAction seems to only be defined in that function and isn't utilized anywhere else (that I can see).

Hope that was all clear enough...thanks in advance for any responses.

About the author

Recent Threads


#1
01/19/2009 (9:07 am)
It's not utilized anywhere else in script, but it is in the C++ engine code.

To my understanding, $mvForwardAction is a script variable that is mapped to an engine variable mForwardAction, as defined in engine/game/gameConnectionMoves.cc. So when the script variable is modified, this is reflected in the engine variable, and the engine handles the movement from there.

#2
01/19/2009 (11:55 am)
Thanks Rubes.

I wish there was a list of the exposed variables in the default engine build. X_X

As far as I've found all that's documented is the functions and objects exposed to TorqueScript.