Behavior Tree logic question

mostlyhuman

Member
I am just getting back into Behavior Designer and am stuck on this simple thing. I want to use Can See Object for the initial contact between the agent and the player, and then switch to Pursue, but I want to continue to Pursue unless Within Distance fails (no longer considering Can See Object until after Within distance fails after a pursuit).

I'm having trouble on how to arrange the tree for this, can anyone point me in the right direction? Thank you for any help!

withinDistance.png
 
What you're going for looks really similar to the integration tree for the Ultimate Character Controller:


You'll want the Can See Object task to be in a branch one level higher compared to Within Distance, and then reevaluate Within Distance while Pursue is running. This setup is similar to this image:


UltimateCharacterControllerTreeCanSeeBranch-1024x755.png


The part that you want to take a look at is the top left Can See Object, and then a Selector to the right of it.
 
Still having an issue with this one, everything is working correctly except once the tree moves below the second selector if the player moves behind the agent, it appears that its causing Can See Object to turn false and restart the tree where what I want to happen is as long as Within Distance is true, it will keep running the bottom right portion of the tree (under Random Selector).

I wish you had even more examples that would show different flow scenarios and design patterns. I am surprised at how little information is on youtube by third parties, seems like more people would have released their own little tutorials over the years. Thank you, Justin, always appreciate your help!
Untitled-1.png
 
As the tree gets larger it gets harder to debug what is going on. In generally when designing the tree I get a small, independent branch working and then join it with the larger branches. This will allow you to ensure that that section is working properly and you can move on from there.

Here's an example of a large behavior tree with a section describing how each branch works:

 
I had studied that thoroughly and I am still confused. I have looked at all the downloadable examples you have, read the documentation and watched your entire youtube behavior designer playlist. Im trying to understand basic concepts like, how to keep a part of a tree going while condition1 is true or false and then like how to iterate on a part of a tree while a condition underneath condition1 is true or false and only returning control back to condition1 if condition2 changes states. These are the sorts of more simple example trees that would help people a lot. In searching through the forums for answers I saw a lot of people that were frustrated by the lack of examples. Developers know how to thing logically but I think some people are having trouble understanding how to adapt that logic to a behavior tree.
 
If you haven't seen them take a look at these "Behavior Tree Basics" videos - they get into the core concepts that you can then expand upon:

 
Thank you, Justin, I foresaw your reply and had just edited my response above to clarify that I have looked at all the downloadable examples you have, read the entire documentation and watched your entire youtube behavior designer playlist. You may recall (or not) that about a year ago I tried to learn behavior designer and got frustrated as the trees got more complex and I eventually put AI on hold, but now I have to learn it and cant put it off anymore. I had looked at all the available materials last year and have now looked at everything again this past week. I will tell you this, when I get this figured out I am going to post tutorials on youtube to fill in the gaps for other people because this has been unusually painful lol!
 
I wanted to add that I can tell you what all the main tasks do, I understand lower priority conditional aborts and I can create my own tasks. My main issue is just overall design patterns and flow as the trees get more complex.
 
Top