[Request] Behavior Trees - Simple Functions

I was wondering if someone could walk me through a simple behavior tree setup. I have found tutorials out there but for whatever reason I am just not grasping this.

As a control, I am using the 3rd person blueprint template so I am not doing and coding in C++.

I simply want to take the existing player blueprint (Hero I think?) and turn him into a bot that can follow an array of way points. If he sees the player (using a bool “bPlayerSeen”) he chases the player and if the bool is false he goes to the nearest way point and starts over. The final condition is that if touches the player it sets a bool to true (“bPlayerIsCaught”).

Is it possible that someone could walk me through this?

Thank you

Hello,
there are some tutorials ever in the forum that you can download and use which perfectly do the job. Mainly done by silentx. I tried them all this week with 4.3.1 and it was totally working. I did not try with 4.4 but you can check :

https://docs.unrealengine.com/latest/INT/Gameplay/AI/BehaviorTreeQuickStart/index.html
https://docs.unrealengine.com/latest/INT/Gameplay/AI/BehaviorTrees/HowUE4BehaviorTreesDiffer/index.html
https://docs.unrealengine.com/latest/INT/Gameplay/AI/BehaviorTrees/NodeReference/index.html

to learn how using behavior trees and having fun with AI

Thanks I will give this a try over the next few days.

Hi again,
i see that i forgot to link you silentx’ s thread about behavior trees. check the aiproject, it does what you describe : [UPDATED 5/16] A.I. Templates - Bot, Car, & +Flying AI - Community Content, Tools and Tutorials - Unreal Engine Forums

So I followed the tutorial at: https://docs.unrealengine.com/latest/INT/Gameplay/AI/BehaviorTreeQuickStart/

For the most part it seems like I made it through because I didn’t get any errors compiling or running but the AI itself is not working. I have tried to follow everything down the blueprints and the behavior tree and for the most part it looks good but I do notice something not working right in the tree during simulation so I am going to include a screenshot.

The two major differences are:

  1. I included this in an existing project so I had to use some different naming conventions.
  2. This was done in the 3rd person camera setup.

Any insights on this would be great!

&stc=1

Anyone out there have any ideas where to start to look for these issues?

For you information, I follow up those tutorial yesterday and I have similar problems (close enought don’t work), but I left on side to work in other things.

From the screenshot you posted, it looks like neither TargetToFollow or TargetLocation are set (they are both ‘None’ in your blackboard view and the red indicator on their decorators indicates that they aborted). This in turn means that when your tree runs that none of its branches do anything.

Me I had a question about behavior trees !

I want to create a command where the AI will create some sort of wall to protect a tower. Keep in mind that I am doing this with C++ and a small portion of blueprints. I just need a little help getting this started and I am pretty sure I will be on my way.

I had in my something like if(ProjectCharacter.location <= DefenceDistance)
{ AiController->MoveToLocation()}

Something along these lines however I am not entirely sure if this could work

Thanks in Advance !

What’s confusing is that I did this twice from scratch with the same results… I am not sure where I did not set things right. Any thoughts on where I missed a step?

It’s possible you may have missed the channel setting in the visibility trace of your service BP, or maybe some other part that is preventing the Blackboard keys from being set. Perhaps you could post a pic of that BP?

Here are some shots of the other BP. I changed the BP name in this version.

&stc=1

Sorry I should have been more clear, it is the ‘AgroCheck’ service BP that I was suggesting to check over, as that is the BP that sets the Blackboard entries that the behavior tree relies on.

Apologies. Have a look at these.

&stc=1

&stc=1

&stc=1

The only difference I can see is that the sphere trace you are doing is using the same point for both start and end as you are not adding (0, 0, 15) as in the example, rather that value is (0, 0, 0) in your graph.
This means you are doing a zero-length sweep, which will not hit anything (the implementation ignores very small sweep lengths).

You are right, I did zero that out to check for changes. The thing is, the tree seems to find the player when he comes within range, however he does not start to pursue the player…

I went to look at my blueprint because I did get this to work but when I went to my last project the work I had done was gone. I did have some problems when it was working. Whenever the bot would follow my player my computer would lock and completely stop working for about 5 seconds once I had the task manager up while it was running and for that short period of time Unreal was not responding. If I was not near the bot and it was not following me I did not have any problems but as soon as the bot started following me my computer would competley lock for 5 second or more. I have not had that problem with any other things I have done I have done a few other Behavior trees and they worked with not problem. I am going to redo this tut and see what is going on I suspect something is not right in ArgoCheck maybe something with the arrays.

So I have gone back and done this from scratch 2 more times using the 3rd person BP mode and both times it failed. Is there something that i am missing here that differs greatly from the top down that would cause this not to work?

Have you actually tried stepping though your blueprints and seeing what values are being used? Its a good idea to get used to debugging your own code, so this sounds like an ideal opportunity. Set a breakpoint in the event nodes (F9) and step through each node, seeing what inputs are being used (hover the mouse over the pins from the previous nodes to see their value). See what the values are and think if they look right or not. Usually I see errors like this because one of my casts is going wrong (i.e. its not the correct class to cast to etc). So make sure all those things are returning values that make sense.

One example of doing this, is that I was having an issue with my BT until I realized that the angle of the AIController is not the same as the angle of the AICharacter it is controlling. Just an example of silly things that catch you out. So my recommendation is to try using your own debug skills to find this. Be methodical and check every input against what you expect. If something is off, go back and figure out where it went wrong.

I did the same thing, following tutorial a few times. This is what is missing from the tutorial - set the desired object types that the multisphere trace uses: