Game Development Reference
What benefit does bottom-up evaluation provide that is worth the performance
hit? Bottom-up offers the possibility of better decision making. In particular,
nuanced and subtle differences in behaviors can be more easily exhibited in a
bottom-up system. The highest-level deciders in a top-down system need to be
simple in order to run quickly and to keep complexities from the lowest levels
from creeping up throughout the tree. The high-level deciders in top-down make
broad-brush, sweeping, categorical decisions. The tree in Figure 10.5 decides
between flee, guard, fight, eat, or idle at the highest level before it decides how it
will implement the selected category of action. It decides what to do before it
works out how to do it. With a bottom-up system, we can let the question of how
we do something drive the decision whether to do it. Let us consider an example
of how this might work.
In a fantasy setting, an AI character is being driven by the decision tree shown in
Figure 10.6. Decider nodes have italic text, and behavior nodes have bold text.
Extraneous nodes have been left out for clarity. A top-down evaluation decides to
evade at the highest level. The next level down, it has to decide between running
away and hiding. It decides to hide in a nearby building, simplified as the Hide
node in Figure 10.6. The next level down, it decides between picking the lock on
the door, using a spell to unlock the door, or breaking the door down. If the
character has no picks and no spells, the only option is to break the door down.
Unfortunately, breaking the door down will be obvious to any pursuers. It would
be better to keep running away in this case, but the decision between running and
hiding has already been made at a higher level, and hiding is usually better than
running. Hiding would have been the best choice if the character had picks or a
A bottom-up evaluation takes care of this problem. Both the Pick Lock behavior
and the Cast Unlock Spell behavior return a very strong desire to activate if the
A partial decision tree used by a fantasy character.