![]() |
Olympe Engine 2.0
2D Game Engine with ECS Architecture
|
Executes a BehaviorTree and collects trace information. More...
#include <BehaviorTreeExecutor.h>
Collaboration diagram for Olympe::BehaviorTreeExecutor:Public Member Functions | |
| BehaviorTreeExecutor () | |
| ~BehaviorTreeExecutor () | |
| BTStatus | ExecuteTree (const BehaviorTreeAsset &btAsset, GraphExecutionTracer &outTracer) |
| Execute a BehaviorTree and collect trace information. | |
Static Private Member Functions | |
| static const char * | StatusToString (BTStatus status) |
| Convert BTStatus to string for logging. | |
Private Attributes | |
| int | m_maxDepth = 0 |
| Track recursion depth to detect cycles. | |
| int | m_executedNodes = 0 |
| Count of executed nodes. | |
| SubGraphCallStack | m_callStack |
| Phase 39: Call stack for SubGraph recursion tracking. | |
Executes a BehaviorTree and collects trace information.
This executor simulates BehaviorTree execution without modifying runtime state. It records each node execution, condition evaluation, and branch decision.
Definition at line 34 of file BehaviorTreeExecutor.h.
| Olympe::BehaviorTreeExecutor::BehaviorTreeExecutor | ( | ) |
Definition at line 14 of file BehaviorTreeExecutor.cpp.
| Olympe::BehaviorTreeExecutor::~BehaviorTreeExecutor | ( | ) |
Definition at line 19 of file BehaviorTreeExecutor.cpp.
|
private |
Execute an Action leaf node.
Actions always succeed in simulation (no runtime effects).
Definition at line 234 of file BehaviorTreeExecutor.cpp.
References AttackIfClose, ChooseRandomNavigablePoint, ClearTarget, FollowPath, GetComponentTypeID_Static(), Idle, MoveToGoal, PatrolPickNextPoint, RequestPathfinding, SendMessage, SetMoveGoalToLastKnownTargetPos, SetMoveGoalToPatrolPoint, SetMoveGoalToTarget, Success, and WaitRandomTime.
Referenced by ExecuteNode().
Here is the call graph for this function:
Here is the caller graph for this function:
|
private |
Execute a Condition leaf node.
Evaluates condition and returns Success (true) or Failure (false).
Definition at line 198 of file BehaviorTreeExecutor.cpp.
References CanAttack, Failure, GetComponentTypeID_Static(), HasMoveGoal, HasNavigableDestination, HasReachedDestination, HasValidPath, HealthBelow, HeardNoise, IsWaitTimerExpired, Success, TargetInRange, and TargetVisible.
Referenced by ExecuteNode().
Here is the call graph for this function:
Here is the caller graph for this function:
|
private |
Apply a Decorator (Inverter, Repeater) to a child node result.
Definition at line 266 of file BehaviorTreeExecutor.cpp.
References ExecuteNode(), Failure, GetComponentTypeID_Static(), Inverter, Repeater, and Success.
Referenced by ExecuteNode().
Here is the call graph for this function:
Here is the caller graph for this function:
|
private |
Recursively execute a single BehaviorTree node.
| nodeId | The node to execute |
| btAsset | Reference to tree asset (for node lookups) |
| outTracer | Trace collection object |
< Phase 39
Definition at line 53 of file BehaviorTreeExecutor.cpp.
References Action, Condition, ExecuteAction(), ExecuteCondition(), ExecuteDecorator(), ExecuteNode(), ExecuteSelector(), ExecuteSequence(), ExecuteSubGraph(), Failure, GetComponentTypeID_Static(), Inverter, m_executedNodes, m_maxDepth, OnEvent, Repeater, Root, Selector, Sequence, SubGraph, Success, and SYSTEM_LOG.
Referenced by ExecuteDecorator(), ExecuteNode(), ExecuteSelector(), ExecuteSequence(), and ExecuteTree().
Here is the call graph for this function:
Here is the caller graph for this function:
|
private |
Execute a Selector (OR) composite node.
A Selector succeeds if ANY child succeeds. Stops on first success.
Definition at line 146 of file BehaviorTreeExecutor.cpp.
References ExecuteNode(), Failure, GetComponentTypeID_Static(), and Success.
Referenced by ExecuteNode().
Here is the call graph for this function:
Here is the caller graph for this function:
|
private |
Execute a Sequence (AND) composite node.
A Sequence succeeds only if ALL children succeed. Stops on first failure.
Definition at line 172 of file BehaviorTreeExecutor.cpp.
References ExecuteNode(), Failure, GetComponentTypeID_Static(), and Success.
Referenced by ExecuteNode().
Here is the call graph for this function:
Here is the caller graph for this function:
|
private |
Phase 39: Execute a SubGraph reference node.
Loads external BT or ATS file and executes it recursively.
Definition at line 294 of file BehaviorTreeExecutor.cpp.
References Olympe::SubGraphCallStack::Contains(), ExecuteTree(), Failure, BehaviorTreeManager::Get(), GetComponentTypeID_Static(), BehaviorTreeManager::GetTreeByAnyId(), BehaviorTreeManager::LoadTreeFromFile(), m_callStack, SubGraphCallStack::MAX_DEPTH, Olympe::SubGraphCallStack::Pop(), Olympe::SubGraphCallStack::Push(), StatusToString(), and SYSTEM_LOG.
Referenced by ExecuteNode().
Here is the call graph for this function:
Here is the caller graph for this function:| BTStatus Olympe::BehaviorTreeExecutor::ExecuteTree | ( | const BehaviorTreeAsset & | btAsset, |
| GraphExecutionTracer & | outTracer | ||
| ) |
Execute a BehaviorTree and collect trace information.
| btAsset | The BehaviorTree asset to execute |
| outTracer | [out] Execution trace collection |
Definition at line 23 of file BehaviorTreeExecutor.cpp.
References ExecuteNode(), Failure, GetComponentTypeID_Static(), m_executedNodes, m_maxDepth, StatusToString(), Success, and SYSTEM_LOG.
Referenced by ExecuteSubGraph(), and Olympe::BehaviorTreeRenderer::OnRunGraphClicked().
Here is the call graph for this function:
Here is the caller graph for this function:Convert BTStatus to string for logging.
Definition at line 390 of file BehaviorTreeExecutor.cpp.
References Aborted, Failure, Idle, Running, and Success.
Referenced by ExecuteSubGraph(), and ExecuteTree().
Here is the caller graph for this function:
|
private |
Phase 39: Call stack for SubGraph recursion tracking.
Definition at line 101 of file BehaviorTreeExecutor.h.
Referenced by ExecuteSubGraph().
|
private |
Count of executed nodes.
Definition at line 98 of file BehaviorTreeExecutor.h.
Referenced by ExecuteNode(), and ExecuteTree().
|
private |
Track recursion depth to detect cycles.
Definition at line 97 of file BehaviorTreeExecutor.h.
Referenced by ExecuteNode(), and ExecuteTree().