Game Development Community

How does default.bind.cs find .dsq animations?

by James Anderson · in Technical Issues · 11/11/2008 (1:25 pm) · 5 replies

Hi All,
Warning - Noob question
that said;

I am finding a gap between the default.bind.cs which creates function:

function moveforward(%val)
{
$mvForwardAction = %val * $movementSpeed;
}

// then binds it to a key:

moveMap.bind( keyboard, w, moveforward );

and the player.cs file (from shapes -> player-> player.cs)
which creates the sequence list of animations under the TSShapeconstructor datablock.

datablock TSShapeConstructor(PlayerDts)
{
baseShape = "./player.dts";
sequence0 = "./player_root.dsq root";
sequence1 = "./player_forward.dsq run"; ...etc.

My question is:
how does the moveforward function from the default bind find the playerforward.dsq animation file?
I see the default bind setting up a variable "moveforward"
and I see the TSShapeconstructor setting up a variable "sequence1"

thanks for any help (and patience!)
J.

#1
11/11/2008 (1:39 pm)
Survey says......the source code. ;)

Dig around in the movement code of the engine and you'll see where the dots connect. Places to focus would be updateMove and the Player and PlayerData classes. Other keywords to help you on your search in those areas would include Animation and ActionAnimation.
#2
11/11/2008 (3:07 pm)
Code (movemanager) checks the state/value of variables such as mvForwardAction, mvTriggerCount0, etc. These are then turned into true player moves, ie the move pointer. UpdateMove() checks this pointer, and acts accordingly. It cares not about your dsq's, it simply says they want to move forward, let's see if thats possible. If so, it will then check the animation listing (top of player.cpp and player.h) to see what dsq is used for forward. You can change these in your player.cs file without ever touching the code if you wish, simply by forcing a rename.
sequence1 = "./player_bounceAround.dsq run";
That would force the player to bounce everytime you try to move forward, irregardless of what the sequence was actually named during export.
A note to remember:
sequence1 = "./player_forward.dsq"; // Will use the sequence helpers name
sequence1 = "./player_forward.dsq run"; // Will disregard the sequences name, and re-assign this name instead (which may or may not be what it really is named).
#3
11/12/2008 (7:08 am)
Ouch - thats exactly what I did not want to hear.........(!)
see its like this:
Im an art guy and I'm using all my synapses to just get my head around the Torque Script part.
You guys say "source code" and the Left side of my brain just up and exits through my ear.

now Eric, you have given me something I can definatly work with - thank you!

but I guess Source code will have to be in my future (Im dusting off the C++ books now).

thanks again
J.
#4
11/12/2008 (10:11 am)
Hey James,
if you mention what you're trying to get done there might be an easier way than "get out your can-opener and the source code".
#5
11/12/2008 (11:13 am)
As Orion indicates, there are actually two types of animations:

--procedurally blended, which use the system described above. These animations are integrated to the physics of the player character, and are blended based on a combination of velocity and ground contact checks via the source code.

--"one shot" animations (such as the "wave" or "salute" animations). These are designed to be triggered via user command, and will be over-ridden by the procedurally blended animations when physics dictate (if a player starts moving in the middle of a wave animation, it will cancel the wave and begin blending in the movement based animations)

As an artist, there is no real need to dig in to the source code for basic changes to animations that are used in the actionAnimation table, unless you are planning to do drastic changes to the underlying system itself. Normally, you can change the animations themselves (for example, to animate a new character with a different bone structure) without any change to the underlying code.

If you want to provide additional "one shot" animations (sometimes called "socials"), you can take a look at the "celWave" animation and code for an example of how they are used within TorqueScript (these do not require source code changes at all).