Game Development Reference
In-Depth Information
cheaper methods do as well. Planners' strong suit is more than just picking the
single best action.
The biggest benefit of planning comes when the AI assembles multiple actions
into a plan. This capability is a reasonable working definition for a planner and
the biggest reason to justify their costs. Planning systems search the space of
available actions for a path through them that changes the state of the world to
match the goal state. Let us look at an example, loosely based on the old chil-
dren's folk song, ''There's a Hole in the Bucket.''
The setting is a farm back in the days when ''running water'' meant someone
running out to the well to get water. Our agent, named Henry, is tasked with
fetching water. So the goal is to deliver water to the house. There are many objects
available for Henry to use, including a bucket with a hole in it. Henry searches for
a way to achieve the goal with the objects at hand. He will patch the bucket with
straw. The straw needs to be cut to length. He will cut the straw with a knife. The
knife needs to be sharpened. He will sharpen the knife on a stone. At this point,
we will depart from the song, because in the song you need water in order to
sharpen the knife on the stone, and as programmers we despise infinite loops. In
our example, the stone will be perfectly fine for sharpening the knife. Our
Henry's plan goes like this: Sharpen the knife on the stone. Cut the straw to fit.
Patch the bucket with the cut straw. Use the bucket to fetch water.
Just as behavior trees scale better than pure FSMs, planning systems scale better
than behavior trees when the need is for sequences of actions. In a behavior tree,
the sequences are assembled by the programmer as part of the tree. With a
planner, the AI dynamically performs the assembly, although not without cost.
Once again, we see an almost Zen-like condition where adding sophistication
makes the systems simpler. The execution systems are becoming more abstract
and more data driven. This pulls the actions code into smaller, more independent
chunks. What used to be code is slowly turning into something more like data.
This phenomenon is not restricted to AI; it is a common progression seen in
nearly all programming areas. The cost we mentioned was further alluded to
when we said, ''adding sophistication.''
By analogy, consider simple programs that use numbers and strings as input
data. By now, every reader of this topic has written some of them. Consider the
task of writing a compiler, such as the VB compiler we have been using. While at
the lowest level the input data to the VB compiler is still simple strings, in reality
that data is written at a much higher level. The VB compiler as a program is far
Search Nedrilad ::

Custom Search