Based on what was learnt from this article, a simple planning problem along with possible solutions is illustrated in figure 1 to demonstrate exactly how AI planning works as defined by Orkin. The goal chosen for this example is the KillEnemy goal which is satisfied if a single world state symbol, isTargetDead, is set to true in the agent’s current world state. There are five actions available to the agent, Reload, ChangeWeapon, FindAmmo, MeleeAttack and Fire. Each action has preconditions and effects which can be set or unset (Reload has no world state symbols set for its precondition). The planning system can produce three potential plans and either one of them solves the goal satisfaction condition. At first, it may appear that there is no difference between the three actions, Reload, ChangeWeapon and GoToAmmo from the viewpoint of the planner but the difference arises in each action’s costs, context preconditions and functionality when activated. The action’s associated cost is used to guide an A* search, the context preconditions validate certain action specific conditions before an action can be chosen by the planner and each action has differing effects on the virtual world when actually selected for activation after planning has completed.
When examining the GoToAmmo action, if the agent has any ammunition then the context preconditions of the GoToAmmo would fail and plan3 wouldn’t be created. When the planner is inspecting the Reload action, if there is no ammunition for the current weapon its context preconditions fail, thus making plan1 impossible. If the current weapon has no ammunition and there exists another weapon with ammunition, then plan2 would be built. If the inMeleeRange world state symbol was set to true in the current state of the agent then the planner would simply perform a melee attack.