Game Development Reference
In-Depth Information
These very flocking rules have been used in movies to create flocking
characters. They were used in Batman Returns to create realistic swarms of
bats and in The Lion King for a herd of wildebeest.
The rules can also be modified in games to develop intelligent group
enemy behavior and optimize processing speeds. For example, in the
workshop that introduced breadcrumb path finding, if there were
hundreds of enemies, having them all process the breadcrumbs could
prove computationally costly. Furthermore, if each one even had to run
the A* algorithm, it could certainly slow down performance. However, if
just one leader followed the breadcrumbs, the rest could flock and follow
5.7 Decision Trees
Decision trees are a hierarchical graph that structure complex Boolean
functions and use them to reason about situations. A decision tree is
constructed from a set of properties that describe the situation being
reasoned about. Each node in the tree represents a single Boolean
decision along a path of decision that leads to the terminal or leaf nodes
of the tree.
A decision tree is constructed from a list of previously made decisions.
These could be from experts, other players, or AI game experience. They
are used in Black & White to determine the behavior of the creature. For
example, a decision tree based on how tasty the creature finds an object
determines what it will eat. How tasty it finds an object is gathered
from past experience where the creature was made to eat an object by
the player.
To illustrate the creation of a decision tree for an NPC, we will examine
some sample data on decisions made about eating certain items in the
environment. The decision we want made is a yes or no about eating given
the characteristics or attributes about the eating situation. Table 5.2 displays
some past eating examples.
Given the attributes of a situation (hungry, food, and taste), a decision
tree can be built that reflects whether the food in question should
be eaten. As you can see from aforementioned data, it is not easy to
construct a Boolean expression to make a decision about eating. For
example, sometimes it does matter if the NPC is hungry and other times
it does not; sometimes it matters if the food is tasty and sometimes it
does not.
To construct a decision tree from some given data, each attribute must be
examined to determine which one is the most influential. To do this, we
examine which attributes split the final decision most evenly. Table 5.3
is a count of the influences of the given attributes.