Game Engine Architecture

(Ben Green) #1
763

z Reduced reallocation of resources. Engine subsystems oft en need to allocate
and manage memory and/or other resources during their updates. If
the update of a particular subsystem is interleaved with those of other
engine subsystems, these resources must be freed and reallocated for
each game object that is processed. But if the updates are batched, the
resources can be allocated once per frame and reused for all objects in
the batch.
z Effi cient pipelining. Many engine subsystems perform a virtually identi-
cal set of calculations on each and every object in the game world. When
updates are batched, new optimizations become possible, and special-
ized hardware resources can be leveraged. For example, the PLAY-
STATION 3 provides a batt ery of high-speed microprocessors known
as SPUs, each of which has its own private high-speed memory area.
When processing a batch of animations, the pose of one character can be
calculated while we simultaneously DMA the data for the next charac-
ter into SPU memory. This kind of parallelism cannot be achieved when
processing each object in isolation.
Performance benefi ts aren’t the only reason to favor a batch updating ap-
proach. Some engine subsystems simply don’t work at all when updated on
a per-object basis. For example, if we are trying to resolve collisions within
a system of multiple dynamic rigid bodies, a satisfactory solution cannot be
found in general by considering each object in isolation. The interpenetrations
between these objects must be resolved as a group, either via an iterative ap-
proach or by solving a linear system.


14.6.3. Object and Subsystem Interdependencies


Even if we didn’t care about performance, a simplistic per-object updating ap-
proach breaks down when game objects depend on one another. For example,
a human character might be holding a cat in her arms. In order to calculate
the world-space pose of the cat’s skeleton, we fi rst need to calculate the world-
space pose of the human. This implies that the order in which objects are up-
dated is important to the proper functioning of the game.
Another related problem arises when engine subsystems depend on one
another. For example, a rag doll physics simulation must be updated in con-
cert with the animation engine. Typically, the animation system produces an
intermediate, local-space skeletal pose. These joint transforms are converted
to world space and applied to a system of connected rigid bodies that approxi-
mate the skeleton within the physics system. The rigid bodies are simulated
forward in time by the physics system, and then the fi nal resting places of the


14.6. Updating Game Objects in Real Time

Free download pdf