Node component
Root Node
It is the first active node to run the behavior tree.
You can connect with one child node.
Composite Node
It has one or more child nodes and controls which child nodes to execute.
How to control is described in CompositeBehaviour script.
You can also add Decorator scripts and Service scripts to be described later.
Built-in CompositeBehaviour
- Selector
Execute the child nodes in order from the left, terminate when the child node returns success , and return success.
If all child nodes return failure, it returns failure.
It is used when you want to find a successful node in order from the left and you do not want to run subsequent nodes. - Sequencer
Execute the child nodes in order from the left, terminate when the child node returns failure , and return a failure.
If all child nodes return success, success is returned.
It is used when you want to execute all as long as the child node returns success.
For reference on the built-in CompositeBehaviour see here.
Arbor Reference : Built-in CompositeBehaviour
Action Node
The node that performs the action.
Write the ActionBehaviour script to see what action to take.
Also, we can add Decorator script and Service script here as well.
For reference on built-in ActionBehavior see here.
Arbor Reference : Built-in ActionBehaviour
For creating ActionBehaviour script, click here.
Decorator script
It is a script that can perform condition judgment, suspend or interrupt an executing node, repeat judgment at the end timing.
This script is used in addition to composite nodes and action nodes.
For reference of the built-in Decorator, please refer to here.
Arbor Reference : Built-in Decorator
For creating Decorator script, click here.
About condition judgment
When multiple Decorators are added to one node, the node is executed only when the condition judgment result of all Decorators is true.
About AbortFlags
Abort or interrupt target is controlled by AbortFlags.
- Self
Performs condition determination while its node or its subordinate node is executing.
If the result of condition judgment is false, abort and return failure to the parent node. - LowerPriority
A node with a lower priority on the right side than its own node performs a condition determination during execution.
If the result of the condition judgment is true, the currently executing node is suspended, and its own node becomes active.
It can be set by combining the above two flags.
Also, regardless of AbortFlags, condition judgment is performed once when its own node becomes active, and if it is false, it will be returned as a failure as it is.
Service script
Service scripts can be added to composite nodes and action nodes, scripts that can do something while the node is active.
Although it is not used in the example Behaviour Tree, For example, it is suitable for describing auxiliary processing such as adding a Service that stores the distance to the player in Parameter to the Selector node.
For creating Service script, click here.