Each goal has a float value between zero and one which represents its relevancy. When the planner is searching to find a new goal, each goal is requested in turn to update its relevancy. Goals relevancy values are determined by whatever is going on in the game at that time. For example, if the agent has a target in its sights then the KillEnemy goal could have a relevancy of 0.7, if it doesn’t the relevancy would be 0. Once all the goals have updated their relevancies, the goal with the highest relevancy is requested to build a plan.
Most of the goals share the same functionality so it was decided, just like the action design, to create an abstract goal to encapsulate this. Each goal in the project extends this abstract goal and overwrites functions wherever new custom behaviour is required. For example, the functions that calculate a goal’s relevancy and determine if a goal is satisfied are overloaded by every goal in the project.
World state symbol checks are used during planning to determine if a goal has become satisfied. However during the execution of a plan (i.e. after planning has finished), there can be a mixture of checks from the blackboard or from the agent’s current world state. For example, during planning the GoalAttackDomPointOne is satisfied if the atDomPointOne world state symbol is set to true but during execution the goal is satisfied if the team overtakes Domination point one or if the navigation is complete.
Every goal has a handle to the global GOAP planner class which is used to create plans. When a goal is selected as an agent’s current goal, it is instructed to create a plan. The goal requests the planner to run an A* search and find a sequence of actions that satisfy the goal. The plan created isn’t stored alongside the goal, instead it is sent to the GOAP controller where it is stored and can be obtained every time it’s needed thereafter. A goal is also in charge of activating, deactivating and advancing plans. When a plan is first activated the first action in the plan is executed. Every time the goal is subsequently updated the current action in the plan is polled to see if it is finished or has become invalid. If it is