Active Behavior Tree
The Active Behavior Tree (ABT) is the conceptual, run-time entity that manages multiple threads of control in the ABL runtime. It mainly interacts with the ABL Decision Cycle. Essentially ABL implements a thread scheduler; the ABT keeps track of who is available to execute and in what context.
Each node in the ABT is in one of 5 states: executing, suspended, available, success, failure.
- executing. A node is marked as executing in the decision cycle immediately before its step code is executed.
- suspended. When a step (goal or act) is executed, ABL checks to see if any conflicting steps are already executing. If there are conflicting steps executing, then the highest priority step wins; the lower priority step is suspended until the higher priority step completes. In the event of a priority tie, the already executing step wins. When an act is suspended it is aborted if it was in the middle of executing (doing something with the body) and removed from the conflict set. It is added back to the conflict set when all higher or same priority conflicting acts are removed from the ABT. When a goal is suspended, any executing acts within the subtree rooted at the goal are aborted, and all leaf steps of the subtree rooted at the goal are removed from the conflict set. These leaf steps are added back to the conflict set when all higher or same priority conflicting goals are removed from the ABT.
- available. A step is available when it is added to the ABT as a leaf node.
- success & failure. When a step completes, it has succeeded or failed.
The conflict set is the set of leaves in the ABT. Below is a diagrammatic example of an ABT and its conflict set. The conflict set is tinted light blue.