There are 2 ways to debug an MBT:
Use the Slash-Key ("/") on the keyboard or the cvar "ai_DebugAgent centerview
" to see what parts of the tree are currently executing in the AI character that is closest to the camera:
The numbers next to the currently active branches are the according line numbers in the XML file.
The Slash-Key is just a shortcut for entering "ai_DebugAgent centerview
" and is only implemented as such in the GameSDK DLL.
The execution history facility allows for writing the execution stacks on a frame-by-frame basis to log files. It's controlled by the cvar:
"ai_LogModularBehaviorTreeExecutionStacks 0/1/2
":
ai_DebugAgent centerview
")The log files are plain text files that get written to the directory .\user\mbt_logs
.
Each AI agent will store his execution history in a separate file that is named according to his entity name and entity ID (e. g. "mbt_human1_3.txt
" will refer to the AI agent named "Human1" whose EntityID = 3).
The content of each log file looks like this: