11#include "../../system/system_utils.h"
21 if (
graph ==
nullptr) {
53 SYSTEM_LOG <<
"[BTGraphCompiler] Compiled " <<
outAsset.nodes.size() <<
" nodes" << std::endl;
79 const std::string& value =
paramIt->second;
87 int intVal = std::stoi(value, &
pos);
88 if (
pos == value.length()) {
97 float floatVal = std::stof(value, &
pos);
98 if (
pos == value.length()) {
111 outNode.actionParam1 =
outNode.GetParameterFloat(
"duration", 1.0f);
112 }
else if (
graphNode.type ==
"BT_MoveToTarget") {
114 outNode.actionParam1 =
outNode.GetParameterFloat(
"speed", 100.0f);
115 }
else if (
graphNode.type ==
"BT_AttackTarget") {
122 }
else if (
graphNode.type ==
"BT_IsTargetInRange") {
124 outNode.conditionParam =
outNode.GetParameterFloat(
"distance", 100.0f);
157 if (
typeString ==
"BT_CheckBlackboardValue" ||
Compiler from GraphDocument to BehaviorTreeAsset.
Validation system for Behavior Tree graph structure.
Registry of all Behavior Tree node types for AIGraphPlugin_BT.
@ SetMoveGoalToTarget
Move towards current target.
@ AttackIfClose
Attack if in range.
BTNodeType
Behavior tree node types.
@ Action
Leaf node - performs an action.
@ Selector
OR node - succeeds if any child succeeds.
@ Sequence
AND node - succeeds if all children succeed.
@ Inverter
Decorator - inverts child result.
@ Condition
Leaf node - checks a condition.
@ Repeater
Decorator - repeats child N times.
@ TargetVisible
Can see target entity.
@ TargetInRange
Target within specified range.
ComponentTypeID GetComponentTypeID_Static()
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.
static std::vector< BTValidationMessage > ValidateGraph(const NodeGraph::GraphDocument *graph)
Validate a complete BT graph.
Main document class for a node graph.
@ Error
Error (blocking compilation)
< Provides AssetID and INVALID_ASSET_ID
Represents a single node in a behavior tree.