![]() |
Olympe Engine 2.0
2D Game Engine with ECS Architecture
|
Data-driven behavior tree system for AI decision making. More...
#include "../ECS_Entity.h"#include "../vector.h"#include <vector>#include <string>#include <cstdint>#include <map>
Include dependency graph for BehaviorTree.h:
This graph shows which files directly or indirectly include this file:Go to the source code of this file.
Classes | |
| struct | BTNode |
| Represents a single node in a behavior tree. More... | |
| struct | BTValidationMessage |
| Validation message for behavior tree structure checking. More... | |
| struct | BehaviorTreeAsset |
| class | BehaviorTreeManager |
Functions | |
| BTStatus | ExecuteBTNode (const BTNode &node, EntityID entity, AIBlackboard_data &blackboard, const BehaviorTreeAsset &tree) |
| BTStatus | ExecuteBTCondition (BTConditionType condType, float param, EntityID entity, const AIBlackboard_data &blackboard) |
| BTStatus | ExecuteBTAction (BTActionType actionType, float param1, float param2, EntityID entity, AIBlackboard_data &blackboard) |
Data-driven behavior tree system for AI decision making.
This file implements a behavior tree system for creating complex AI behaviors. Behavior trees are hierarchical structures that make decisions based on conditions and execute actions based on those decisions.
Key features:
Definition in file BehaviorTree.h.
|
strong |
Built-in action types for behavior trees.
Predefined actions that can be executed during tree execution.
Definition at line 106 of file BehaviorTree.h.
|
strong |
Built-in condition types for behavior trees.
Predefined conditions that can be checked during tree execution.
Definition at line 82 of file BehaviorTree.h.
|
strong |
Behavior tree node types.
Defines the different types of nodes that can exist in a behavior tree.
Definition at line 51 of file BehaviorTree.h.
Behavior tree node execution status.
Represents the current state of a behavior tree node.
| Enumerator | |
|---|---|
| Idle | Node waiting for execution (not yet started) |
| Running | Node is currently executing. |
| Success | Node completed successfully. |
| Failure | Node failed. |
| Aborted | Node execution interrupted (e.g., entity destroyed) |
Definition at line 67 of file BehaviorTree.h.
| BTStatus ExecuteBTAction | ( | BTActionType | actionType, |
| float | param1, | ||
| float | param2, | ||
| EntityID | entity, | ||
| AIBlackboard_data & | blackboard | ||
| ) |
Definition at line 584 of file BehaviorTree.cpp.
References AttackIfClose, ChooseRandomNavigablePoint, ClearTarget, Failure, GameEngine::fDt, FollowPath, NavigationMap::Get(), World::Get(), World::GetComponent(), GetComponentTypeID_Static(), NavigationMap::GetRandomNavigablePoint(), World::HasComponent(), Idle, INVALID_ENTITY_ID, Vector::Magnitude(), MoveToGoal, PatrolPickNextPoint, Position_data::position, RequestPathfinding, Running, SetMoveGoalToLastKnownTargetPos, SetMoveGoalToPatrolPoint, SetMoveGoalToTarget, Success, AttackIntent_data::targetEntity, MoveIntent_data::targetPosition, and WaitRandomTime.
Referenced by ExecuteBTNode().
Here is the call graph for this function:
Here is the caller graph for this function:| BTStatus ExecuteBTCondition | ( | BTConditionType | condType, |
| float | param, | ||
| EntityID | entity, | ||
| const AIBlackboard_data & | blackboard | ||
| ) |
Definition at line 513 of file BehaviorTree.cpp.
References MoveIntent_data::arrivalThreshold, CanAttack, Failure, World::Get(), World::GetComponent(), GetComponentTypeID_Static(), World::HasComponent(), HasMoveGoal, HasNavigableDestination, HasReachedDestination, HasValidPath, HealthBelow, HeardNoise, IsWaitTimerExpired, Vector::Magnitude(), Success, TargetInRange, and TargetVisible.
Referenced by ExecuteBTNode().
Here is the call graph for this function:
Here is the caller graph for this function:| BTStatus ExecuteBTNode | ( | const BTNode & | node, |
| EntityID | entity, | ||
| AIBlackboard_data & | blackboard, | ||
| const BehaviorTreeAsset & | tree | ||
| ) |
Definition at line 398 of file BehaviorTree.cpp.
References Action, Condition, ExecuteBTAction(), ExecuteBTCondition(), ExecuteBTNode(), Failure, GetComponentTypeID_Static(), Inverter, Repeater, Running, Selector, Sequence, and Success.
Referenced by ExecuteBTNode(), and BehaviorTreeSystem::Process().
Here is the call graph for this function:
Here is the caller graph for this function: