Skip to content

Nodes

GOAP has two types of nodes:

  • Tasks
  • Sub Graphs

Both of them accept a Requisites node on the left and an Effects node on the right.

Tasks

The Task node is the main node of a GOAP AI system.

GOAP Task node overview

It contains a Name that helps identify what this node does. This has no effect at runtime.

The Cost is a numeric value that determines how difficult it is to run this node. When coming up with a plan, the AI system will pick the plan with the least cost value, adding up all costs of all nodes in each plan and comparing the resulting value.

Conditions determine whether this node can be executed or not.

Conditions are not Beliefs

It is extremely important to note that Conditions are not the same as Beliefs. Conditions have no effect when coming up with a plan and will only be evaluated when executing a plan, and cancel the plan if they evaluate to False.

It's highly recommended using Beliefs instead of Conditions unless you want to abort your plans mid-way through. For example, a plan that approaches a character and attacks it, an aborting Condition could be checking if the character is already dead when reaching it.

The On Execute instructions are where the bulk of the logic happens. A node will be considered finished after all its instructions have been executed in order.

Sub Graph

The Sub Graph node works exactly the same way as a Task node does, but instead of executing instructions, it runs another AI graph system, such as a State Machine or a Behavior Tree.

GOAP Sub Graph node overview

Requisites and Effects

The Requisites and Effects nodes are exactly the same, but the first one links to a Task or Sub Graph node from their left side, and the former links to them on the right side.

GOAP Effects node overview

There can be any number of Beliefs attached to each one of these nodes, and it can check whether the Belief is True or False.

A False Belief

A Belief that is marked as False means the belief is not present, which is the default value when coming up with a plan (unless the Thoughts list states otherwise).