Game Development Reference
A subset of a hierarchical task network.
Mountains on the various trails did not come up with a brand-new plan before
setting out (with the possible exception of the disastrous Donner party). We
might like our AI to have a deep bag of tricks to use in terms of pre-computed
plans while still being able to re-plan when things go decidedly wrong.
At the lowest level, a hierarchical task network (HTN) resembles the other
planners we have mentioned. We have actions that can be directly executed if
their preconditions are met, providing us with a change to the state of the world.
These are often referred to as primitive tasks . HTNs also include a task library.
Any task that is not a directly executable primitive task is called an abstract task .
The abstract tasks in the task library decompose into lower-level abstract tasks
and finally into primitive tasks. An example might be in order.
As shown in Figure 10.8, our farmer from the GOAP example has a ''light
source'' abstract task in his task library. That task decomposes into the ''use
lantern'' and ''use flashlight'' abstract tasks. The ''use lantern'' abstract task
decomposes into a ''light lantern'' abstract task and the highly useful ''get''
abstract task. As they must, all the remaining abstract tasks similarly reduce to
primitive tasks, although for simplicity, the diagram does not show the full