Olympe Engine 2.0
2D Game Engine with ECS Architecture
Loading...
Searching...
No Matches
Static Public Member Functions | Static Private Member Functions | List of all members
Olympe::AI::BTGraphCompiler Class Reference

Static compiler for BT graphs. More...

#include <BTGraphCompiler.h>

Static Public Member Functions

static bool Compile (const NodeGraph::GraphDocument *graph, BehaviorTreeAsset &outAsset, std::string &errorMsg)
 Compile GraphDocument to BehaviorTreeAsset.
 

Static Private Member Functions

static bool CompileNode (const NodeGraph::NodeData &graphNode, BTNode &outNode)
 Compile a single node from graph to asset.
 
static BTNodeType MapNodeType (const std::string &typeString)
 Map graph node type string to BTNodeType enum.
 

Detailed Description

Static compiler for BT graphs.

Compiles GraphDocument (editor format) to BehaviorTreeAsset (runtime format). Validates graph before compilation and provides error messages on failure.

Definition at line 29 of file BTGraphCompiler.h.

Member Function Documentation

◆ Compile()

bool Olympe::AI::BTGraphCompiler::Compile ( const NodeGraph::GraphDocument graph,
BehaviorTreeAsset outAsset,
std::string &  errorMsg 
)
static

Compile GraphDocument to BehaviorTreeAsset.

Parameters
graphSource graph document
outAssetOutput asset (cleared and populated)
errorMsgError message if compilation fails
Returns
true if successful, false otherwise

Definition at line 16 of file BTGraphCompiler.cpp.

References CompileNode(), Olympe::AI::Error, GetComponentTypeID_Static(), SYSTEM_LOG, and Olympe::AI::BTGraphValidator::ValidateGraph().

Referenced by Test6_CompilationSimpleBT(), and Test7_CompilationInvalidNodeType().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ CompileNode()

bool Olympe::AI::BTGraphCompiler::CompileNode ( const NodeGraph::NodeData graphNode,
BTNode outNode 
)
staticprivate

Compile a single node from graph to asset.

Parameters
graphNodeSource node data
outNodeOutput BT node
Returns
true if successful

Definition at line 57 of file BTGraphCompiler.cpp.

References Action, AttackIfClose, Condition, GetComponentTypeID_Static(), Idle, MapNodeType(), Repeater, SetMoveGoalToTarget, TargetInRange, and TargetVisible.

Referenced by Compile().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ MapNodeType()

BTNodeType Olympe::AI::BTGraphCompiler::MapNodeType ( const std::string &  typeString)
staticprivate

Map graph node type string to BTNodeType enum.

Parameters
typeStringType name from graph
Returns
Corresponding BTNodeType

Definition at line 133 of file BTGraphCompiler.cpp.

References Action, Condition, GetComponentTypeID_Static(), Inverter, Repeater, Selector, and Sequence.

Referenced by CompileNode().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

The documentation for this class was generated from the following files: