Olympe Engine 2.0
2D Game Engine with ECS Architecture
Loading...
Searching...
No Matches
BTGraphCompiler.h
Go to the documentation of this file.
1/**
2 * @file BTGraphCompiler.h
3 * @brief Compiler from GraphDocument to BehaviorTreeAsset
4 * @author Olympe Engine
5 * @date 2026-02-18
6 *
7 * @details
8 * Compiles a NodeGraphCore GraphDocument into a runtime BehaviorTreeAsset.
9 * Performs validation before compilation and maps node types appropriately.
10 */
11
12#pragma once
13
14#include "../../NodeGraphCore/GraphDocument.h"
15#include "../BehaviorTree.h"
16#include <string>
17
18namespace Olympe {
19namespace AI {
20
21/**
22 * @class BTGraphCompiler
23 * @brief Static compiler for BT graphs
24 *
25 * @details
26 * Compiles GraphDocument (editor format) to BehaviorTreeAsset (runtime format).
27 * Validates graph before compilation and provides error messages on failure.
28 */
30public:
31 /**
32 * @brief Compile GraphDocument to BehaviorTreeAsset
33 * @param graph Source graph document
34 * @param outAsset Output asset (cleared and populated)
35 * @param errorMsg Error message if compilation fails
36 * @return true if successful, false otherwise
37 */
38 static bool Compile(
41 std::string& errorMsg
42 );
43
44private:
45 /**
46 * @brief Compile a single node from graph to asset
47 * @param graphNode Source node data
48 * @param outNode Output BT node
49 * @return true if successful
50 */
51 static bool CompileNode(
54 );
55
56 /**
57 * @brief Map graph node type string to BTNodeType enum
58 * @param typeString Type name from graph
59 * @return Corresponding BTNodeType
60 */
61 static BTNodeType MapNodeType(const std::string& typeString);
62};
63
64} // namespace AI
65} // namespace Olympe
BTNodeType
Behavior tree node types.
ComponentTypeID GetComponentTypeID_Static()
Definition ECS_Entity.h:56
Static compiler for BT graphs.
static bool Compile(const NodeGraph::GraphDocument *graph, BehaviorTreeAsset &outAsset, std::string &errorMsg)
Compile GraphDocument to BehaviorTreeAsset.
static BTNodeType MapNodeType(const std::string &typeString)
Map graph node type string to BTNodeType enum.
static bool CompileNode(const NodeGraph::NodeData &graphNode, BTNode &outNode)
Compile a single node from graph to asset.
Main document class for a node graph.
< Provides AssetID and INVALID_ASSET_ID
Represents a single node in a behavior tree.