Game Development Reference
In-Depth Information
priority over EAT_FOOD, so it can interrupt EAT_FOOD if it wants in the next
level down.
Actual implementations of behavior trees include some subtleties. A number of
good ideas from other AI methods find a home in behavior trees as well. The
current behavior gets a boost in priority when it is rechecked against alternatives.
This helps stop the AI from equivocating between two actions. In actual use, the
trees need some help to better deal with events in the world. The sound of a
gunshot is an event; it is highly unlikely that the AI will ever ''hear'' a gunshot by
examining the current world state. Instead, the event has to be handled imme-
diately or remembered until the next time the AI thinks, and the behavior tree
needs hooks to make that memory happen.
An important subtlety more particular to top-down evaluation in behavior trees
is that a high-level behavior cannot decide that it wants to activate unless it
knows that at least one of its children will also want to activate. In real life, it is
wasted effort to drive into the parking lot of a restaurant if no one in the car
wants to eat there. This requirement needs to hold true all the way down the tree
to the level of at least one usable behavior. The lowest-level items in the tree that
actually do something are the behaviors, and all the things above them are
deciders. Deciders need to be fast because they are checked often. The Spore
diagram only shows deciders. Most of the nodes in the tree we have covered so far
do selection; they pick a single child to run. Nodes can also do sequencing, where
they run each child in turn.
Bottom-Up Evaluation
If there is sufficient CPU available, we can switch from the top-down evaluation
described to a bottom-up evaluation. The top-down method requires the
highest-level deciders to accurately predict whether any of their descendants
wants to activate in the current situation. This capability is critical. Given that
assurance, the tree evaluates very quickly, and top-down evaluation gives better
performance. Bottom-up evaluation starts by having the lowest-level leaves of the
tree, the behaviors, comment on the current situation and feed their opinions up
the tree to the deciders. The deciders no longer have to predict whether one of
their descendant behaviors wants to activate; instead, they are armed with sure
knowledge that includes how much each descendant wants to activate. The
deciders are then left with the task of prioritizing the available options. The
results are fed up the tree to the highest level for final selection.
 
 
Search Nedrilad ::




Custom Search