552 11. Animation Systems
All other animations are usually loaded on an as-needed basis. Some game
engines load animation clips individually, but many package them together
into logical groups that can be loaded and unloaded as a unit.
11.9 Animation System Architecture
Now that we understand the theory that underlies a game’s animation system,
let’s turn our att ention to how such a system is structured from a soft ware ar-
chitecture standpoint. We’ll also investigate what kinds of interfaces exist be-
tween the animation system and the other systems in a typical game engine.
Most animation systems are comprised of up to three distinct layers:
- Animation pipeline. For each animating character and object in the game,
the animation pipeline takes one or more animation clips and corre-
sponding blend factors as input, blends them together, and generates a
single local skeletal pose as output. It also calculates a global pose for
the skeleton, and a palett e of skinning matrices for use by the rendering
engine. Post-processing hooks are usually provided, which permit the
local pose to be modifi ed prior to fi nal global pose and matrix palett e
generation. This is where inverse kinematics (IK), rag doll physics, and
other forms of procedural animation are applied to the skeleton. - Action state machine (ASM). The actions of a game character (standing,
walking, running, jumping, etc.) are usually best modeled via a fi nite
state machine , commonly known as the action state machine (ASM). The
ASM subsystem sits atop the animation pipeline and provides a state-
driven animation interface for use by virtually all higher-level game
code. It ensures that characters can transition smoothly from state to
state. In addition, most animation engines permit diff erent parts of the
character’s body to be doing diff erent, independent actions simultane-
ously, such as aiming and fi ring a weapon while running. This can be ac-
complished by allowing multiple independent state machines to control
a single character via state layers. - Animation controllers. In many game engines, the behaviors of a player
or non-player character are ultimately controlled by a high-level sys-
tem of animation controllers. Each controller is custom-tailored to man-
age the character’s behavior when in a particular mode. There might
be one controller handling the character’s actions when he is fi ghting
and moving around out in the open (“run-and-gun” mode), one for
when he is in cover, one for driving a vehicle, one for climbing a lad-
der, and so on. These high-level animation controllers allow most if not