Game Engine Architecture

(Ben Green) #1
769

state. For example, animation pose blending may have been run, but physics
and collision resolution may not yet have been applied. This leads us to the
following rule:


The states of all game objects are consistent before and aft er the
update loop, but they may be inconsistent during it.

This is illustrated in Figure 14.16.
The inconsistency of game object states during the update loop is a major
source of confusion and bugs, even among professionals within the game in-
dustry. The problem rears its head most oft en when game objects query one


t 1

t

ObjectA SA SA

ObjectB SB

ObjectC SC

ObjectD SD

t 2

SB


SC


SD


Δt

Figure 14.15. In theory, the states of all game objects are updated instantaneously and in
parallel during each iteration of the game loop.


14.6. Updating Game Objects in Real Time


Figure 14.16. In practice, the states of the game objects are updated one by one. This means
that at some arbitrary moment during the update loop, some objects will think the current
time is t 2 while others think it is still t 1. Some objects may be only partially updated, so their
states will be internally inconsistent. In effect, the state of such an object lies at a point be-
tween t 1 and t 2.


t 1

t

ObjectA SA

ObjectB

SA


ObjectC

ObjectD

SC


t 2

SB


SD


SB


SC

Free download pdf