568 11. Animation Systems
11.10.5.3. Optimization on the Xbox and Xbox 360
Rather than having specialized memory regions and a DMA controller to
move data from region to region, the Xbox and the Xbox 360 both employ a
unifi ed memory architecture. All processors, including the main CPU (or in
the case of the 360, the three PowerPC cores), the GPU, and all other hardware
systems, tap into a single big block of main RAM.
In theory, the Xbox architecture requires a totally diff erent set of optimi-
zations than would be required on the PlayStation architectures, and so we
might expect to see very diff erent animation APIs between these two plat-
forms. However, the Xbox serves as an example of how optimizations for one
platform can sometimes be benefi cial to other platforms as well. As it turns out,
both the Xbox and PlayStation platforms incur massive performance degra-
dation in the presence of cache misses and load-hit-store memory access pat-
terns. So, it is benefi cial on both systems to keep animation data as localized as
possible in physical RAM. An animation pipeline that processes animations in
large batches and operates on data within relatively small regions of memory
(such as the PS2’s scratch pad or PS3’s SPU memories) will also perform well
on a unifi ed memory architecture like that of the Xbox. Achieving this kind of
synergy between platforms is not always possible, and every hardware plat-
form requires its own specifi c optimizations. However, when such an oppor-
tunity does arise, it is wise to take advantage of it.
A good rule of thumb is to optimize your engine for the platform with the
most stringent performance restrictions. When your optimized code is ported
to other platforms with fewer restrictions, there’s a good chance that the opti-
mizations you made will remain benefi cial, or at worst will have few adverse
aff ects on performance. Going in the other direction—porting from the least
stringent platform to the more stringent ones—almost always results in less-
than-optimal performance on the most stringent platform.
11.11 Action State Machines
The low-level pipeline is the equivalent of OpenGL or DirectX for animation—
it is very powerful but can be rather inconvenient for direct use by game code.
Therefore, it is usually convenient to introduce a layer between the low-level
pipeline and the game characters and other clients of the animation system.
This layer is usually implemented as a state machine, known as the action state
machine or the animation state machine ( ASM).
The ASM sits on top of the animation pipeline, permitt ing the actions of
the characters in a game to be controlled in a straightforward, state-driven