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

Main debug window for behavior tree runtime visualization. More...

#include <BehaviorTreeDebugWindow.h>

+ Collaboration diagram for Olympe::BehaviorTreeDebugWindow:

Public Member Functions

 BehaviorTreeDebugWindow ()
 
 ~BehaviorTreeDebugWindow ()
 
void Initialize ()
 Initialize the debug window.
 
void Shutdown ()
 Shutdown and cleanup.
 
void Render ()
 Render the debug window (in separate SDL3 window)
 
void ToggleVisibility ()
 Toggle window visibility (creates/destroys separate window)
 
bool IsVisible () const
 Check if window is visible.
 
void ProcessEvent (SDL_Event *event)
 Process SDL events for separate window.
 
void AddExecutionEntry (EntityID entity, uint32_t nodeId, const std::string &nodeName, BTStatus status)
 Add an execution log entry.
 

Private Types

enum class  SortMode { Name , TreeName , LastUpdate , AIMode }
 

Private Member Functions

void RenderEntityListPanel ()
 
void RenderInspectorPanel ()
 
void CreateSeparateWindow ()
 
void DestroySeparateWindow ()
 
void RenderInSeparateWindow ()
 
void RefreshEntityList ()
 
void UpdateEntityFiltering ()
 
void UpdateEntitySorting ()
 
void RenderEntityEntry (const EntityDebugInfo &info)
 
void RenderRuntimeInfo ()
 
void RenderBlackboardSection ()
 
void RenderExecutionLog ()
 
void InitNodeGraphDebugMode ()
 
void ShutdownNodeGraphDebugMode ()
 
void RenderNodeGraphDebugPanel ()
 

Private Attributes

std::vector< EntityDebugInfom_entities
 
std::vector< EntityDebugInfom_filteredEntities
 
EntityID m_selectedEntity = 0
 
std::deque< ExecutionLogEntrym_executionLog
 
const size_t MAX_LOG_ENTRIES = 100
 
bool m_isVisible = false
 
bool m_isInitialized = false
 
float m_autoRefreshInterval = 0.5f
 
char m_filterText [256] = ""
 
bool m_filterActiveOnly = false
 
bool m_filterHasTarget = false
 
SortMode m_sortMode = SortMode::Name
 
bool m_sortAscending = true
 
float m_entityListWidth = 250.0f
 
float m_inspectorWidth = 350.0f
 
bool m_imnodesInitialized = false
 
SDL_Windowm_separateWindow
 
SDL_Rendererm_separateRenderer
 
bool m_windowCreated
 
ImGuiContextm_separateImGuiContext
 
EditorAutosaveManager m_autosave
 
NodeGraphPanel m_nodeGraphPanel
 
int m_debugGraphId = -1
 
uint32_t m_lastDebugTreeId = 0
 

Detailed Description

Main debug window for behavior tree runtime visualization.

Provides comprehensive debugging capabilities for AI behavior trees, including entity selection, graph visualization, and blackboard inspection.

Renders in a separate SDL3 native window (not embedded in main engine window).

Definition at line 79 of file BehaviorTreeDebugWindow.h.

Member Enumeration Documentation

◆ SortMode

Enumerator
Name 
TreeName 
LastUpdate 
AIMode 

Definition at line 166 of file BehaviorTreeDebugWindow.h.

Constructor & Destructor Documentation

◆ BehaviorTreeDebugWindow()

Olympe::BehaviorTreeDebugWindow::BehaviorTreeDebugWindow ( )

Definition at line 26 of file BehaviorTreeDebugWindow.cpp.

◆ ~BehaviorTreeDebugWindow()

Olympe::BehaviorTreeDebugWindow::~BehaviorTreeDebugWindow ( )

Definition at line 34 of file BehaviorTreeDebugWindow.cpp.

References Shutdown().

+ Here is the call graph for this function:

Member Function Documentation

◆ AddExecutionEntry()

void Olympe::BehaviorTreeDebugWindow::AddExecutionEntry ( EntityID  entity,
uint32_t  nodeId,
const std::string &  nodeName,
BTStatus  status 
)

Add an execution log entry.

Parameters
entityEntity that executed
nodeIdNode that was executed
nodeNameNode name
statusExecution result

Definition at line 811 of file BehaviorTreeDebugWindow.cpp.

References GetComponentTypeID_Static(), and Olympe::ExecutionLogEntry::timeAgo.

Referenced by BehaviorTreeSystem::Process().

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

◆ CreateSeparateWindow()

void Olympe::BehaviorTreeDebugWindow::CreateSeparateWindow ( )
private

Definition at line 113 of file BehaviorTreeDebugWindow.cpp.

References GetComponentTypeID_Static(), m_separateImGuiContext, m_separateRenderer, m_separateWindow, and m_windowCreated.

Referenced by ToggleVisibility().

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

◆ DestroySeparateWindow()

void Olympe::BehaviorTreeDebugWindow::DestroySeparateWindow ( )
private

Definition at line 157 of file BehaviorTreeDebugWindow.cpp.

References GetComponentTypeID_Static(), m_separateImGuiContext, m_separateRenderer, m_separateWindow, and m_windowCreated.

Referenced by Shutdown(), and ToggleVisibility().

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

◆ Initialize()

void Olympe::BehaviorTreeDebugWindow::Initialize ( )

Initialize the debug window.

Definition at line 39 of file BehaviorTreeDebugWindow.cpp.

References GetComponentTypeID_Static(), Olympe::EditorAutosaveManager::Init(), InitNodeGraphDebugMode(), m_autosave, m_imnodesInitialized, and m_isInitialized.

Referenced by SDL_AppInit(), and ToggleVisibility().

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

◆ InitNodeGraphDebugMode()

void Olympe::BehaviorTreeDebugWindow::InitNodeGraphDebugMode ( )
private

Definition at line 36 of file BehaviorTreeDebugWindow_NodeGraph.cpp.

References Olympe::EditorContext::Get(), Olympe::NodeGraphPanel::Initialize(), Olympe::EditorContext::InitializeRuntime(), m_debugGraphId, m_lastDebugTreeId, m_nodeGraphPanel, and SYSTEM_LOG.

Referenced by Initialize().

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

◆ IsVisible()

bool Olympe::BehaviorTreeDebugWindow::IsVisible ( ) const
inline

Check if window is visible.

Definition at line 108 of file BehaviorTreeDebugWindow.h.

References m_isVisible.

Referenced by BehaviorTreeSystem::Process(), and SDL_AppEvent().

+ Here is the caller graph for this function:

◆ ProcessEvent()

void Olympe::BehaviorTreeDebugWindow::ProcessEvent ( SDL_Event event)

Process SDL events for separate window.

Parameters
eventSDL event to process

Definition at line 199 of file BehaviorTreeDebugWindow.cpp.

References GetComponentTypeID_Static(), m_isVisible, m_separateImGuiContext, m_separateWindow, m_windowCreated, and ToggleVisibility().

Referenced by SDL_AppEvent().

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

◆ RefreshEntityList()

void Olympe::BehaviorTreeDebugWindow::RefreshEntityList ( )
private

◆ Render()

void Olympe::BehaviorTreeDebugWindow::Render ( )

Render the debug window (in separate SDL3 window)

Definition at line 221 of file BehaviorTreeDebugWindow.cpp.

References GetComponentTypeID_Static(), m_isVisible, m_separateImGuiContext, m_separateRenderer, m_windowCreated, and RenderInSeparateWindow().

Referenced by SDL_AppIterate().

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

◆ RenderBlackboardSection()

void Olympe::BehaviorTreeDebugWindow::RenderBlackboardSection ( )
private

Definition at line 694 of file BehaviorTreeDebugWindow.cpp.

References World::Get(), and GetComponentTypeID_Static().

+ Here is the call graph for this function:

◆ RenderEntityEntry()

void Olympe::BehaviorTreeDebugWindow::RenderEntityEntry ( const EntityDebugInfo info)
private

Definition at line 536 of file BehaviorTreeDebugWindow.cpp.

References Failure, GetComponentTypeID_Static(), and Success.

+ Here is the call graph for this function:

◆ RenderEntityListPanel()

void Olympe::BehaviorTreeDebugWindow::RenderEntityListPanel ( )
private

Definition at line 483 of file BehaviorTreeDebugWindow.cpp.

References GetComponentTypeID_Static().

Referenced by RenderInSeparateWindow().

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

◆ RenderExecutionLog()

void Olympe::BehaviorTreeDebugWindow::RenderExecutionLog ( )
private

Definition at line 773 of file BehaviorTreeDebugWindow.cpp.

References Failure, GetComponentTypeID_Static(), and Success.

+ Here is the call graph for this function:

◆ RenderInSeparateWindow()

void Olympe::BehaviorTreeDebugWindow::RenderInSeparateWindow ( )
private

Definition at line 245 of file BehaviorTreeDebugWindow.cpp.

References GameEngine::fDt, GetComponentTypeID_Static(), m_autoRefreshInterval, m_entityListWidth, m_executionLog, m_inspectorWidth, RefreshEntityList(), RenderEntityListPanel(), RenderInspectorPanel(), and RenderNodeGraphDebugPanel().

Referenced by Render().

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

◆ RenderInspectorPanel()

void Olympe::BehaviorTreeDebugWindow::RenderInspectorPanel ( )
private

Definition at line 585 of file BehaviorTreeDebugWindow.cpp.

References GetComponentTypeID_Static().

Referenced by RenderInSeparateWindow().

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

◆ RenderNodeGraphDebugPanel()

void Olympe::BehaviorTreeDebugWindow::RenderNodeGraphDebugPanel ( )
private

◆ RenderRuntimeInfo()

void Olympe::BehaviorTreeDebugWindow::RenderRuntimeInfo ( )
private

◆ Shutdown()

void Olympe::BehaviorTreeDebugWindow::Shutdown ( )

Shutdown and cleanup.

Definition at line 66 of file BehaviorTreeDebugWindow.cpp.

References DestroySeparateWindow(), Olympe::EditorAutosaveManager::Flush(), m_autosave, m_imnodesInitialized, m_isInitialized, and ShutdownNodeGraphDebugMode().

Referenced by ~BehaviorTreeDebugWindow().

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

◆ ShutdownNodeGraphDebugMode()

void Olympe::BehaviorTreeDebugWindow::ShutdownNodeGraphDebugMode ( )
private

Definition at line 54 of file BehaviorTreeDebugWindow_NodeGraph.cpp.

References Olympe::NodeGraphManager::CloseGraph(), Olympe::NodeGraphManager::Get(), m_debugGraphId, m_nodeGraphPanel, Olympe::NodeGraphPanel::Shutdown(), and SYSTEM_LOG.

Referenced by Shutdown().

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

◆ ToggleVisibility()

void Olympe::BehaviorTreeDebugWindow::ToggleVisibility ( )

Toggle window visibility (creates/destroys separate window)

Definition at line 87 of file BehaviorTreeDebugWindow.cpp.

References CreateSeparateWindow(), DestroySeparateWindow(), Initialize(), m_isInitialized, m_isVisible, and m_windowCreated.

Referenced by ProcessEvent(), and SDL_AppEvent().

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

◆ UpdateEntityFiltering()

void Olympe::BehaviorTreeDebugWindow::UpdateEntityFiltering ( )
private

Definition at line 432 of file BehaviorTreeDebugWindow.cpp.

References GetComponentTypeID_Static(), m_entities, m_filterActiveOnly, m_filteredEntities, m_filterHasTarget, and m_filterText.

Referenced by RefreshEntityList().

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

◆ UpdateEntitySorting()

void Olympe::BehaviorTreeDebugWindow::UpdateEntitySorting ( )
private

Definition at line 459 of file BehaviorTreeDebugWindow.cpp.

References GetComponentTypeID_Static(), m_filteredEntities, and m_sortAscending.

Referenced by RefreshEntityList().

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

Member Data Documentation

◆ m_autoRefreshInterval

float Olympe::BehaviorTreeDebugWindow::m_autoRefreshInterval = 0.5f
private

Definition at line 158 of file BehaviorTreeDebugWindow.h.

Referenced by RenderInSeparateWindow().

◆ m_autosave

EditorAutosaveManager Olympe::BehaviorTreeDebugWindow::m_autosave
private

Definition at line 192 of file BehaviorTreeDebugWindow.h.

Referenced by Initialize(), and Shutdown().

◆ m_debugGraphId

int Olympe::BehaviorTreeDebugWindow::m_debugGraphId = -1
private

◆ m_entities

std::vector<EntityDebugInfo> Olympe::BehaviorTreeDebugWindow::m_entities
private

Definition at line 147 of file BehaviorTreeDebugWindow.h.

Referenced by RefreshEntityList(), and UpdateEntityFiltering().

◆ m_entityListWidth

float Olympe::BehaviorTreeDebugWindow::m_entityListWidth = 250.0f
private

Definition at line 177 of file BehaviorTreeDebugWindow.h.

Referenced by RenderInSeparateWindow().

◆ m_executionLog

std::deque<ExecutionLogEntry> Olympe::BehaviorTreeDebugWindow::m_executionLog
private

Definition at line 152 of file BehaviorTreeDebugWindow.h.

Referenced by RenderInSeparateWindow().

◆ m_filterActiveOnly

bool Olympe::BehaviorTreeDebugWindow::m_filterActiveOnly = false
private

Definition at line 162 of file BehaviorTreeDebugWindow.h.

Referenced by UpdateEntityFiltering().

◆ m_filteredEntities

std::vector<EntityDebugInfo> Olympe::BehaviorTreeDebugWindow::m_filteredEntities
private

Definition at line 148 of file BehaviorTreeDebugWindow.h.

Referenced by UpdateEntityFiltering(), and UpdateEntitySorting().

◆ m_filterHasTarget

bool Olympe::BehaviorTreeDebugWindow::m_filterHasTarget = false
private

Definition at line 163 of file BehaviorTreeDebugWindow.h.

Referenced by UpdateEntityFiltering().

◆ m_filterText

char Olympe::BehaviorTreeDebugWindow::m_filterText[256] = ""
private

Definition at line 161 of file BehaviorTreeDebugWindow.h.

Referenced by UpdateEntityFiltering().

◆ m_imnodesInitialized

bool Olympe::BehaviorTreeDebugWindow::m_imnodesInitialized = false
private

Definition at line 181 of file BehaviorTreeDebugWindow.h.

Referenced by Initialize(), and Shutdown().

◆ m_inspectorWidth

float Olympe::BehaviorTreeDebugWindow::m_inspectorWidth = 350.0f
private

Definition at line 178 of file BehaviorTreeDebugWindow.h.

Referenced by RenderInSeparateWindow().

◆ m_isInitialized

bool Olympe::BehaviorTreeDebugWindow::m_isInitialized = false
private

Definition at line 157 of file BehaviorTreeDebugWindow.h.

Referenced by Initialize(), Shutdown(), and ToggleVisibility().

◆ m_isVisible

bool Olympe::BehaviorTreeDebugWindow::m_isVisible = false
private

Definition at line 156 of file BehaviorTreeDebugWindow.h.

Referenced by IsVisible(), ProcessEvent(), Render(), and ToggleVisibility().

◆ m_lastDebugTreeId

uint32_t Olympe::BehaviorTreeDebugWindow::m_lastDebugTreeId = 0
private

Definition at line 201 of file BehaviorTreeDebugWindow.h.

Referenced by InitNodeGraphDebugMode(), and RenderNodeGraphDebugPanel().

◆ m_nodeGraphPanel

NodeGraphPanel Olympe::BehaviorTreeDebugWindow::m_nodeGraphPanel
private

◆ m_selectedEntity

EntityID Olympe::BehaviorTreeDebugWindow::m_selectedEntity = 0
private

Definition at line 149 of file BehaviorTreeDebugWindow.h.

Referenced by RenderNodeGraphDebugPanel().

◆ m_separateImGuiContext

ImGuiContext* Olympe::BehaviorTreeDebugWindow::m_separateImGuiContext
private

◆ m_separateRenderer

SDL_Renderer* Olympe::BehaviorTreeDebugWindow::m_separateRenderer
private

Definition at line 185 of file BehaviorTreeDebugWindow.h.

Referenced by CreateSeparateWindow(), DestroySeparateWindow(), and Render().

◆ m_separateWindow

SDL_Window* Olympe::BehaviorTreeDebugWindow::m_separateWindow
private

◆ m_sortAscending

bool Olympe::BehaviorTreeDebugWindow::m_sortAscending = true
private

Definition at line 174 of file BehaviorTreeDebugWindow.h.

Referenced by UpdateEntitySorting().

◆ m_sortMode

SortMode Olympe::BehaviorTreeDebugWindow::m_sortMode = SortMode::Name
private

Definition at line 173 of file BehaviorTreeDebugWindow.h.

◆ m_windowCreated

bool Olympe::BehaviorTreeDebugWindow::m_windowCreated
private

◆ MAX_LOG_ENTRIES

const size_t Olympe::BehaviorTreeDebugWindow::MAX_LOG_ENTRIES = 100
private

Definition at line 153 of file BehaviorTreeDebugWindow.h.


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