News Forums RAIN General Discussion and Troubleshooting Tree Binding, color coding while debugging.

This topic contains 3 replies, has 2 voices, and was last updated by  lordofduct 1 year, 8 months ago.

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #27173

    lordofduct
    Participant

    When running the project you can observe the current status of your behavior tree by selecting the AI mob you want to observer and select the ‘current’ in the drop down box.

    But I’m not seeing how I can see it for any of the sub trees that are linked through the ‘Tree Binding’ node. Is there not a way to see that? It makes testing difficult.

    #27175

    CodersExpo
    Participant

    This is an item on the RT teams list to improve. It is my understanding there is no “easy” way at this time to debug bound BT assets.

    #27279

    lordofduct
    Participant

    So the reason I ask is because I’m tooling with TreeBindings and I run into this problem.

    This is my root tree:

    <behaviortree version="1.1" repeatuntil="" name="GatorBehaviour">
    	<parallel tiebreaker="fail" succeed="all" repeatuntil="" name="root" fail="any">
    		<action repeatuntil="" parametervalues="ACJEZXRlY3RTdXJyb3VuZGluZ3Mi" parameters="QnJhaW4AQ29tbWFuZA==" namespace="(global)" name="Detect Surroundings" classname="BrainAction" />
    		<selector usepriorities="False" repeatuntil="" name="Has Target?">
    			<constraint repeatuntil="" priority="" name="Has Target" constraint="varTarget != null">
    				<action repeatuntil="" parametervalues="ACJ2YXJJc0hlYWx0aHkiACJFdmFsdWF0ZUlzSGVhbHRoeSIAImJvb2wi" parameters="QnJhaW4AVmFyaWFibGUARnVuY3Rpb24AUmVzdWx0VHlwZQ==" namespace="(global)" name="Evaluate Health" classname="BrainEvaluate" />
    				<selector usepriorities="False" repeatuntil="" name="Is Healthy?">
    					<constraint repeatuntil="" priority="" name="Healthy" constraint="varIsHealthy">
    						<treebinding repeatuntil="" name="Offense" binding="Offense" />
    					</constraint>
    					<constraint repeatuntil="" priority="" name="Unhealthy" constraint="!varIsHealthy">
    						<treebinding repeatuntil="" name="Defense" binding="Defense" />
    					</constraint>
    				</selector>
    			</constraint>
    			<constraint repeatuntil="" priority="" name="No Target" constraint="varTarget == null">
    				<treebinding repeatuntil="" name="treebinding" binding="Idle" />
    			</constraint>
    		</selector>
    	</parallel>
    </behaviortree>

    It’s pretty basic, basically I am observing my surroundings. If there are any targets in the area, we will evaluate our current health and go on the offense or defense depending. If nothing is around we go into an idle state.

    All 3 of these states will be tree bindings. One main reason is this is a fairly basic AI structure… most mobs will probably end up with this very structure. Though their offense/defense/idle trees may vary… the root of it is identical.

    So because the lack of debugging the whole tree at the same time, I went and first just attached the ‘idle’ tree to my mob and developed it up to make it act exactly how I want. This is it for reference…

    <behaviortree version="1.1" repeatuntil="" name="GatorIdle">
    	<sequencer usepriorities="False" repeatuntil="" name="root">
    		<action repeatuntil="" priority="" parametervalues="ACJ2YXJJc0hlYWx0aHkiACJFdmFsdWF0ZUlzSGVhbHRoeSIAImJvb2wi" parameters="QnJhaW4AVmFyaWFibGUARnVuY3Rpb24AUmVzdWx0VHlwZQ==" namespace="(global)" name="Evaluate Health" classname="BrainEvaluate" />
    		<selector usepriorities="False" repeatuntil="" priority="" name="Is Healthy?">
    			<constraint repeatuntil="" priority="" name="Healthy" constraint="varIsHealthy">
    				<sequencer usepriorities="False" repeatuntil="" name="idle sequence">
    					<parallel tiebreaker="succeed" succeed="any" repeatuntil="" priority="" name="patrol" fail="any">
    						<parallel tiebreaker="fail" succeed="all" repeatuntil="" name="parallel" fail="any">
    							<action repeatuntil="" parametervalues="ACJQYXRyb2wi" parameters="QnJhaW4AQ29tbWFuZA==" namespace="(global)" name="Patrol" classname="BrainAction" />
    							<animate repeatuntil="" name="animate walk" animationstate="walk" />
    						</parallel>
    						<timer waitforsec="random(5,10)" returnvalue="success" name="timer" />
    					</parallel>
    					<parallel tiebreaker="succeed" succeed="any" repeatuntil="" priority="" name="idle" fail="any">
    						<timer waitforsec="random(1,5)" returnvalue="success" name="timer" />
    						<animate repeatuntil="" name="animate idle" animationstate="idle" />
    					</parallel>
    					<random repeatuntil="" priority="" name="look around AND/OR pick direction">
    						<sequencer weight="" usepriorities="False" repeatuntil="" name="look around">
    							<animate repeatuntil="" priority="" name="animate lookback" animationstate="idle_lookback" />
    							<timer waitforsec="random(0.5, 1.5)" returnvalue="success" priority="" name="timer" />
    							<action repeatuntil="" priority="" parametervalues="ACJQaWNrRGlyZWN0aW9uIg==" parameters="QnJhaW4AQ29tbWFuZA==" namespace="(global)" name="pick direction" classname="BrainAction" />
    						</sequencer>
    						<action weight="" repeatuntil="" parametervalues="ACJQaWNrRGlyZWN0aW9uIg==" parameters="QnJhaW4AQ29tbWFuZA==" namespace="(global)" name="pick direction" classname="BrainAction" />
    					</random>
    				</sequencer>
    			</constraint>
    			<constraint repeatuntil="" priority="" name="Unhealthy" constraint="!varIsHealthy">
    				<sequencer usepriorities="False" repeatuntil="" name="forage sequence">
    					<parallel tiebreaker="succeed" succeed="any" repeatuntil="" priority="" name="patrol" fail="any">
    						<parallel tiebreaker="fail" succeed="all" repeatuntil="" name="parallel" fail="any">
    							<action repeatuntil="" parametervalues="ACJQYXRyb2wi" parameters="QnJhaW4AQ29tbWFuZA==" namespace="(global)" name="Patrol" classname="BrainAction" />
    							<animate repeatuntil="" name="animate" animationstate="walk" />
    						</parallel>
    						<timer waitforsec="random(5,10)" returnvalue="success" name="timer" />
    					</parallel>
    					<random repeatuntil="" priority="" name="forage OR idle">
    						<sequencer weight="" usepriorities="False" repeatuntil="" name="forage">
    							<animate repeatuntil="" priority="" name="animate forage dig" animationstate="melee_bite" />
    							<random repeatuntil="" priority="" name="eat OR return">
    								<sequencer weight="" usepriorities="False" repeatuntil="" name="eat">
    									<animate repeatuntil="" priority="" name="animate eat" animationstate="melee_bite" />
    									<action repeatuntil="" priority="" parametervalues="ACJGb3JhZ2VIZWFsIg==" parameters="QnJhaW4AQ29tbWFuZA==" namespace="(global)" name="Heal" classname="BrainAction" />
    								</sequencer>
    								<sequencer weight="" usepriorities="False" repeatuntil="" name="return">
    									<parallel tiebreaker="succeed" succeed="any" repeatuntil="" priority="" name="idle" fail="any">
    										<animate repeatuntil="" name="animate idle" animationstate="" />
    										<timer waitforsec="random(0.5, 1.5)" returnvalue="success" name="timer" />
    									</parallel>
    								</sequencer>
    							</random>
    						</sequencer>
    						<sequencer weight="" usepriorities="False" repeatuntil="" name="idle">
    							<animate repeatuntil="" priority="" name="animate forage idle" animationstate="idle" />
    						</sequencer>
    					</random>
    				</sequencer>
    			</constraint>
    		</selector>
    	</sequencer>
    </behaviortree>

    So this BT works, it does what I expect. It goes through the entire sequence… primarily: patrol -> stand still -> sometimes lookaround -> turn around -> repeat

    Problem is, when I go and bind it to the primary tree and run it that way. It just patrols… walking in the same direction forever. Wat?

    So I go and copy the entire tree and just put it right into the spot where the tree binding is for idle, replacing the binding for just a complete tree in one.

    It again only patrols, not stopping. Worse, it doesn’t animate now either. Just walks in a straight line in T-pose.

    Now… I had an issue with sometimes animations not occurring before. This is the second time I’m coming across it. And there is nothing here pointing as to why. I honestly have no clue… Wat?

    #27285

    lordofduct
    Participant

    OK, OK, I figured out my problem.

    It’s because my detect node was not set to repeat forever. So when it returned a false, it made the entire tree fail, which started it over, causing the idle to restart, so it did the first step forever.

Viewing 4 posts - 1 through 4 (of 4 total)

You must be logged in to reply to this topic.