Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revisionBoth sides next revision
design [2018/05/17 20:33] – removed pedrodesign [2018/05/17 20:51] – created pedro
Line 1: Line 1:
 +<html>
 +<head>
 +  <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
 +  <meta http-equiv="Content-Style-Type" content="text/css" />
 +  <meta name="generator" content="pandoc" />
 +  <title>Behavior Bricks</title>
 +  <style type="text/css">code{white-space: pre;}</style>
 +  <link rel="stylesheet" href="css/padaonedoc.css" type="text/css" />
 +</head>
 +<body>
 +  <h1 class="headerTitle"><a href="http://behaviorbricks.padaonegames.com">Behavior Bricks</a></h1>
 +<h1 id="debug-mode-quick-start-guide">Debug Mode Quick Start Guide</h1>
 +<p>The debug mode in Behavior Bricks is a set of features that allows to debug the execution of the <code>Behavior Executor</code> component attached to your entities. In debug mode you can:</p>
 +<ul>
 +<li>View in real time the execution flow of a behavior tree</li>
 +<li>Display the values of the blackboard parameters during execution</li>
 +<li>Pause and resume the execution of a behavior tree for an entity or group of entities</li>
 +<li>Set breakpoints in nodes of the behavior tree</li>
 +</ul>
 +<h2 id="debug-mode-and-execution-flow-visualization">Debug mode and execution flow visualization</h2>
 +<p>The Behavior Bricks editor enters debug mode automatically when playing a scene in the Unity editor, substituting the <code>Behavior</code> tab of the Behavior Bricks editor with the <code>Debug</code> tab, as shown in the Figure:</p>
 +<div class="figure">
 +<img src="http://bb.padaonegames.com/images/DebugModeQuickStartGuide/debug.png" title="Debug tab" alt="Debug tab" />
 +<p class="caption">Debug tab</p>
 +</div>
 +<p>To watch the execution flow for a particular behavior tree of a given entity in the scene, you must open the behavior tree in the Behavior Bricks editor, and select the entity to debug in the Unity´s <code>Hierarchy</code> panel. Alternatively, the entity can be selected in the <code>Debug</code> tab, by first clicking on the <code>Refresh List</code> button and then clicking on the entity name. The <code>Debug</code> tab shows a list of the entities in the scene being played which contain a <code>Behavior Executor</code> component, grouped by the behavior assigned, as shown in the Figure:</p>
 +<div class="figure">
 +<img src="images/DebugModeQuickStartGuide/debug_entity.png" title="Entity selection" alt="Debug tab" />
 +<p class="caption">Debug tab</p>
 +</div>
 +<p>Once the behavior and the entity have been selected, the state of each node is depicted by changing the color of its bounding box:</p>
 +<ul>
 +<li>White while running (<code>MoveToGameObject</code> in the Figure)</li>
 +<li>Green when finished returning <code>Completed</code> (<code>IsTargetClose</code> in the Figure)</li>
 +<li>Red when finished returning <code>Failed</code></li>
 +<li>Grey when in suspended state (<code>Repeat</code> and <code>Priority Selector</code> in the Figure)</li>
 +</ul>
 +<div class="figure">
 +<img src="images/DebugModeQuickStartGuide/colors.png" title="Execution flow example" alt="Execution flow" />
 +<p class="caption">Execution flow</p>
 +</div>
 +<p>From the <code>Debug</code> tab is also possible to pause the execution of an entity behavior by clicking on the <code>Pause</code> button next to the entity name. Keep in mind that the pause will start after it finishes its current task. Once you have pressed the pause button you can either <code>Resume</code> the behavior or <code>Tick</code> it so the behavior receives one update call and then return to pause.</p>
 +<div class="figure">
 +<img src="images/DebugModeQuickStartGuide/pause.png" title="Pause, resume and tick" alt="Resume or Tick" />
 +<p class="caption">Resume or Tick</p>
 +</div>
 +<p>Also you can pause and resume all the entities which uses a behavior by pressing the corresponding <code>Resume all</code> and <code>Pause all</code> buttons.</p>
 +<h2 id="blackboard-parameters-value">Blackboard parameters value</h2>
 +<p>In order to see the current values of the blackboard parameters for a concrete behavior of an entity you must:</p>
 +<ul>
 +<li>Be in Play Mode</li>
 +<li>Open the Behavior Bricks Editor</li>
 +<li>Open the behavior that you want to debug (You can watch the assigned behavior and all the subbehaviors that it uses)</li>
 +<li>Select the entity to debug in the Unity´s <code>Hierarchy</code> panel or in the <code>Debug</code> tab in the Behavior Bricks Editor (For more information read <code>Debug Tab</code> Section)</li>
 +</ul>
 +<p>In the tab <code>Blackboard</code> you can see the current value of all blackboard parameters of the open behavior, but if you are only interested in the value of the parameters related to a concrete node you can watch it by selecting the node while having the <code>Node</code> tab selected.</p>
 +<div class="figure">
 +<img src="images/DebugModeQuickStartGuide/BlackboardTab.PNG" title="Blackboard values" alt="Blackboard values" />
 +<p class="caption">Blackboard values</p>
 +</div>
 +<div class="figure">
 +<img src="images/DebugModeQuickStartGuide/BlackboardNode.PNG" title="Blackboard values in Node Tab" alt="Blackboard values" />
 +<p class="caption">Blackboard values</p>
 +</div>
 +<h2 id="breakpoints">Breakpoints</h2>
 +<p>With this feature you can pause the execution of the game when a node for a concrete behavior tree of a specific entity reach one of the following states:</p>
 +<ul>
 +<li>Success</li>
 +<li>Failed</li>
 +<li>Aborted</li>
 +<li>Launched</li>
 +</ul>
 +<p>To add a breakpoint you just need to right click in a node and select <code>Add Breakpoint</code>:</p>
 +<div class="figure">
 +<img src="images/DebugModeQuickStartGuide/AddBreakpoint.PNG" title="Adding a breakpoint" alt="Adding a breakpoint" />
 +<p class="caption">Adding a breakpoint</p>
 +</div>
 +<p>You can configure what events the breakpoint should be triggered in the <code>Node</code> tab by marking the desired events.</p>
 +<div class="figure">
 +<img src="images/DebugModeQuickStartGuide/BreakpointConfig.PNG" title="Breakpoint events" alt="Breakpoint events" />
 +<p class="caption">Breakpoint events</p>
 +</div>
 +<p>In case all events are unmarked the breakpoint will be displayed as disabled with a grey color:</p>
 +<div class="figure">
 +<img src="images/DebugModeQuickStartGuide/DisabledBreakpoint.PNG" title="Disabled breakpoint" alt="Disabled breakpoint" />
 +<p class="caption">Disabled breakpoint</p>
 +</div>
 +<p>Remeber that a breakpoint can only be triggered when:</p>
 +<ul>
 +<li>You are on Play Mode</li>
 +<li>Behavior Bricks Editor is open</li>
 +<li>A valid entity is selected</li>
 +<li>The behavior that contains the node with the breakpoint attached is open, but you don´t need the behavior to be the active tab.</li>
 +</ul>
 +<div class="figure">
 +<img src="images/DebugModeQuickStartGuide/TriggeredBreakpoint.PNG" title="Triggered breakpoint" alt="Triggered breakpoint" />
 +<p class="caption">Triggered breakpoint</p>
 +</div>
 +</body>
 +</html>