Game Development Reference
In-Depth Information
Figure 10.4
A subset of the behavior tree used in Halo 2.
One of the drawbacks of an FSM is that the number of possible transitions
between states grows with the square of the number of states. An FSM with a
large-but-manageable number of states may find itself with an unmanageable
number of transitions. In Chapter 3, we brushed on hierarchical state machines
as a way to control state explosion, with the idea that two-level machines often
suffice. If we emphasize the hierarchy more than the state machines, we wind up
with something like behavior trees. Behavior trees attempt to capture the clarity
of FSMs while reducing their complexity. Behavior trees have been used effec-
tively in some very popular games. Figure 10.4 shows a subset of the behavior tree
for Halo 2 , and Figure 10.5 shows a subset of the behavior tree used in Spore .
There are a few important observations to make about the trees. The first
observation is that the number of levels in the tree is arbitrary. The second
 
Search Nedrilad ::




Custom Search