Control Flow Nodes Overview
Control flow nodes direct the execution path of a behavior tree. They manage how child nodes are scheduled, evaluated, and short-circuited based on child tick results (Success, Failure, or Running).
Forester supports three fundamental control flow nodes:
1. Sequence Nodes (sequence)
- Behavior: Evaluates children sequentially from left to right.
- Short-circuiting:
- Returns
Failureimmediately if any child returnsFailure. - Returns
Runningif a child returnsRunning(halting further evaluation during that tick). - Returns
Successonly when all children returnSuccess.
- Returns
- Use Case: Step-by-step procedures (e.g.
[Check Precondition -> Execute Step 1 -> Execute Step 2]).
Detailed documentation: Sequence Nodes.
2. Fallback / Selector Nodes (fallback)
- Behavior: Evaluates children sequentially from left to right to find a successful path.
- Short-circuiting:
- Returns
Successimmediately if any child returnsSuccess. - Returns
Runningif a child returnsRunning. - Returns
Failureonly when all children returnFailure.
- Returns
- Use Case: Error handling, recovery strategies, and fallback routines (e.g.
[Primary Action -> Secondary Fallback Action -> Alert Operator]).
Detailed documentation: Fallback Nodes.
3. Parallel Nodes (parallel)
- Behavior: Ticks children concurrently during each engine tick.
- Completion Policy: Evaluates overall status based on child results and configured threshold policies (e.g., success threshold or fail-fast rules).
- Use Case: Concurrent tasks (e.g.
[Maintain Balance while Navigating to Goal]).
Detailed documentation: Parallel Nodes.
Summary of Return States
| Node Type | Succeeds When | Fails When | Short-Circuits On |
|---|---|---|---|
sequence | All children return Success | Any child returns Failure | First Failure or Running |
fallback | Any child returns Success | All children return Failure | First Success or Running |
parallel | Reaches success threshold | Reaches failure threshold | Policy dependant |