Olympe Engine 2.0
2D Game Engine with ECS Architecture
Loading...
Searching...
No Matches
BehaviorTreeDependencyScanner.h
Go to the documentation of this file.
1/*
2Olympe Engine V2 - 2025
3Nicolas Chereau
4nchereau@gmail.com
5
6This file is part of Olympe Engine V2.
7
8BehaviorTreeDependencyScanner purpose: Scan entity prefabs to extract required
9Behavior Tree dependencies before level instantiation.
10*/
11
12#pragma once
13#include <string>
14#include <vector>
15#include <set>
16#include <cstdint>
17
18// Forward declarations
19struct PrefabBlueprint;
20namespace nlohmann { class json; }
21
23{
24public:
26 {
27 std::string treePath; // "Blueprints/AI/npc_wander.json"
28 uint32_t suggestedTreeId; // Unique ID generated from path hash
29
31 BTDependency(const std::string& path, uint32_t id)
32 : treePath(path), suggestedTreeId(id) {}
33 };
34
35 // Scan a single prefab for BT requirements
36 static std::vector<BTDependency> ScanPrefab(const PrefabBlueprint& prefab);
37
38 // Scan multiple prefabs (used during level loading)
39 static std::vector<BTDependency> ScanPrefabs(const std::vector<std::string>& prefabNames);
40
41 // Extract all prefab types used in a level TMJ/JSON
42 static std::set<std::string> ExtractPrefabsFromLevel(const nlohmann::json& levelJson);
43
44 // Generate unique tree ID from path (consistent hash)
45 static uint32_t GenerateTreeIdFromPath(const std::string& treePath);
46
47private:
48 BehaviorTreeDependencyScanner() = delete; // Static class only
49};
ComponentTypeID GetComponentTypeID_Static()
Definition ECS_Entity.h:56
static uint32_t GenerateTreeIdFromPath(const std::string &treePath)
static std::vector< BTDependency > ScanPrefab(const PrefabBlueprint &prefab)
static std::vector< BTDependency > ScanPrefabs(const std::vector< std::string > &prefabNames)
static std::set< std::string > ExtractPrefabsFromLevel(const nlohmann::json &levelJson)
nlohmann::json json
BTDependency(const std::string &path, uint32_t id)