593
11.12 Animation Controllers
The animation pipeline provides high-speed animation posing and blending
facilities, but its interface is usually too cumbersome to be used directly by
gameplay code. The action state machine provides a more convenient inter-
face by allowing complex blend trees to be described, oft en in a data-driven
manner, and then encapsulated within easy-to-understand logical states. Tran-
sitions between states can also be defi ned, again oft en in a data-driven way,
so that gameplay code can be writt en in a fi re-and-forget manner, without
having to micromanage every transition. The ASM system may also provide
a layering mechanism, allowing the motion of a character to be described by
multiple state machines running in parallel. But even given the relatively con-
venient interface provided by the action state machine, some game teams fi nd
it convenient to introduce a third layer of soft ware, aimed at providing higher-
level control over how characters animate. As such, it is oft en implemented as
a collection of classes known as animation controllers.
Controllers tend to manage behaviors over relatively long periods of
time—on the order of a few seconds or more. Each animation controller is typ-
ically responsible for one type of gross character behavior, like how to behave
when in cover, how to behave when locomoting from one place to another in
the game world, or how to drive a vehicle. A controller typically orchestrates
all aspects of the character’s animation-related behavior. It adjusts blend fac-
tors to control movement directions, aiming, and so on, manages state transi-
tions, fades in and out layers, and does whatever else is needed to make the
character behave as desired.
One benefi t of a controller-based design is that all of the code relating to a
particular behavioral category is localized in one place. This design also per-
mits higher-level gameplay systems, like player mechanics or AI , to be writt en
in a much simpler way, because all of the details of micromanaging the anima-
tions can be extracted and hidden within the controllers.
The animation controller layer takes many diff erent forms and is highly
dependent upon the needs of the game and the soft ware design philosophies
of the engineering team. Some teams don’t use animation controllers at all.
On other teams, the animation controllers may be tightly integrated into the
AI and/or player mechanics systems. Still other teams implement a suite of
relatively general-purpose controllers that can be shared between the player
character and the NPCs. For bett er or for worse, there is no one standard way
to implement animation controllers in the game industry (at least not yet).
11.12. Animation Controllers