finished then the plan is advanced to the next action. Once the plan has finished executing
e. no more actions left to execute) then the goal is deactivated and the plan is discarded.
The goal manager is the GOAP controllers’ main interface with the GOAP system. When an agent is being initialised, the goal manager creates and stores each goal that is listed in the agent’s goal set defined in the external XML file.
Every update of the goal manager updates the agent’s current goal. This obtains the agent’s current plan and either advances it or determines if it is invalid or finished. If the goal’s plan is finished, invalid or if there is a request on the blackboard to replan, the goal manager searches for a new goal. It requests each of the stored goals to update their relevancies and picks the most relevant goal to build a plan. If a plan is successfully built then the goal is set to be the current goal and the plan is activated. If a plan fails to be built then the goal manager requests the next highest relevant goal and attempts to build a new plan. If all the goals with relevancies greater than zero fail to build plans then the goal manager has no goal and just waits until there is a request to replan.