One of the key features of GOAP is that actions can be built upon one another i.e. layering of behaviours (Orkin, 2005). For example, a basic ActionAttack was designed which just gives basic attacking functionality but it was possible to build on-top of this by creating extra actions such as ActionAttackLongRange or ActionAttackShortRange. These extra actions make use of most of the same functions as the ActionAttack but bring about different behaviour by their activation, validation and completion criteria. This feature can simplify the addition of new behaviour as variants of the base action’s behaviour can easily be built up.
3.8.4 Actions Container
The action container is a global singleton class that creates and encapsulates all the GOAP actions within the game. All the actions are shared across every agent and are created upon the initialisation of the program and stored in the actions container. When an agent is being created, its action set is loaded up from the XML file. Each of the agent’s actions are obtained by requesting a pointer to the action from the container which is then stored in the agent’s action set.
Goals are as important as actions in a GOAP system as without them the planner has nothing to plan towards. Orkin states that, in a similar way to actions, every goal should have the same basic structure (Orkin, 2002). Every goal should know when it is satisfied, be able to calculate its relevance and doesn’t include the actual GOAP plan but just conditions that must be met.