Version 1 (modified by Philip Taylor, 14 years ago) ( diff )

--

Animation synchronisation

Unit animations sometimes need to be synchronised with two things: gameplay events, and sound effects. There are three main categories:

Animation synced only with sound effect

Typically gather, build.

The animation plays back at 30fps, multiplied by the "speed" factor defined in the actor XML file (1000 = original speed, 2000 = twice as fast, etc).

A sound effect plays at the "event" point defined in the actor XML file (0.0 = at the start of the animation cycle, 0.5 = in the middle, etc) - this should be the point where the axe/hammer/etc hits the tree/building/etc.

The animation speed is completely unrelated to the gameplay - the unit will gather/build/etc at a constant rate regardless of the animation, so the rates can be tweaked independently.

Animation synced with nothing

Typically idle, walk, run, death.

Like the previous one, but without even the sound effect. The actor XML doesn't need to define an "event".

Animation synced with gameplay

Typically attack.

The gameplay code determines how long the animation will take (e.g. if an archer shoots every 2 seconds, its attack animation will be stretched or squashed to take exactly 2 seconds). The speed defined in the actor XML is completely ignored. The animation playback is offset so that the gameplay event (e.g. the projectile launch) occurs precisely at the "event" point during the animation. The entity definition and animation file need to be carefully coordinated so the speed and offset looks good.

A sound effect plays at "event", as before. Also, if there is an ammunition prop then it is hidden at the "event" point, and made visible again at the "load" point (also defined in the actor XML). An ammunition prop is one that's attached to a prop point called loaded-r_hand (or loaded- with any other valid prop point instead of r_hand). It doesn't matter if "load" comes before or after "event". This should be used for units that release a projectile, and then load a new one during their animation cycle.

Note: See TracWiki for help on using the wiki.