A Behavior Tree (BT) is a hierarchical model for controlling AI decision-making in games. It organizes actions, conditions, and logic into a tree structure that is evaluated from root to leaves each tick.
Core node types:
- Composite nodes — control flow. Selector (try children until one succeeds), Sequence (run children in order, stop on failure)
- Decorator nodes — conditions that gate child execution (e.g., “is target visible?“)
- Task nodes — leaf nodes that perform actions (e.g., “move to location”, “attack”, “wait”)
- Service nodes — run periodically while their branch is active (e.g., “update target position”)
In Unreal Engine, Behavior Trees work together with Blackboards — shared memory that stores variables like the current target, last known position, or AI state. Tasks read from and write to the Blackboard.
The DonAI Navigation plugin provides BTTask_FlyTo — a ready-made task node that handles 3D pathfinding, waypoint traversal, and dynamic re-pathing for flying AI.
Compared to Finite State Machines (FSMs), Behavior Trees are more modular and easier to extend — adding new behaviors doesn’t require rewiring existing state transitions.