Hello! I am working on my first A.I Behaviour tree (I always used pure BP before and decided it was finally time I learned this system).
Still getting my head around it, but it’s a great system so far.
On to the question: How can I make my A.I faster as it chases the player? Preferably with a curve.
In my mock-up I used a time-line, but evidentially that doesn’t work in the Behaviour tree (Bonus points, for explaining to me why it doesn’t, would be a big help in general)
I am happy to settle with the speed getting faster linearly, but I would prefer for it to be driven by a curve (Gain is slower to start, but accelerates)
Does your AI have a movement component? That is where you can see the movement walk speed. How you set that value is up to you, you can use curve data and a timeline, but it needs to be done on the AI character. (Or more advanced through using behavior tree tasks, decorators, and services.)
Hello Steve. Yes, it does. It’s pretty standard. And setting a straight up value for the speed is easy enough, but not really what I am looking for.
I know I have a lot of options here, (and really I could do a horrible hacky implementation) but what I am looking for is an efficient model. Hence why I moved from BPs to begin with. They work, but they aren’t as efficient, optimized, or well tailored as the behaviour tree.
What I need is for my speed to climb and increase as my A.I is in pursuit. I don’t wan’t the value to just snap to the new speed since it wont look good, or work for the purpose I intend (Which is for it to eventually catch up to the player.)
Yes, I understand, like I said you can use a float curve (You can create these right in the editor under miscellaneous) with get curve value and/or a timeline to have it smoothly increase speed. You essentially are still going to be using blueprint though, that’s because all behaviour tree tasks, services and decorators are simply that, a blueprint graph. You can create a custom blueprint service that gets your AI movement component when in pursuit and slowly increases its speed while in the pursuit section of your tree.
Okay. I am being very cautious as to not pick up bad habits by splitting up my blueprints across the tree, and also in the actor.
I have used the curves before, and think they are great. But finding a way to use them in the graph would be good. But if there physically isn’t any other way to do it, then I’ll settle for the Character BP method.
Splitting up blueprints is not a bad habit, small specific blueprints are good habit for reusability and clarity. You should be splitting up your blueprints into reusable chunks, making custom behaviour tree tasks, services, and decorators that are flexible to use over and over in different scenarios is ideal.
Also I’m not sure what your saying, I just told you that you can use curves in the graph. If you create a variable of curve float, you can drag that into a graph and drag off it to get its curve value. This works well with timelines.
Also, I said to create blueprint behavior tree tasks, services and decorators is the best way. Inside of them you can get you your characters information. You do not need to do it in the character.
Hello Steve. That is good to know. Please don’t feel that I trying to discredit your suggestions. I am simply stating I am very sceptical when learning brand new things inside engine and software, since it is very easy to start using a method that is less than optimum or unusual. Which is why I am making sure I understand your methods as best I can.
And when I said Graph, I meant tree (in regards to driving a curve without the time-line). Apologies for that. But the reason I was trying to keep it perfectly local inside of Decorators, Services, and the AI tree as opposed to the Character BP or other external components, is because it means if I want to re-use my AI controller in other Blueprints, it wouldn’t work with every new character I or one of the other designers creates, since I and others will have to manually edit the inside of the BP to make it work. (Specifically, they would have to add the acceleration).
But the problem I am running into is that I don’t seem to be able to add things like Time-lines inside of Decorators, Tasks, or Services. Which means if I want to drive my acceleration, I would have to do it inside the character. Since that Is the only place I can run a timeline, and ticks seem to work differently inside the tree, so I can’t make it climb with a simple float value.
I am very sorry If I am just not understanding something here, like I said, this is my very first time picking up this system, and I am trying my best to understand the different rules in place compared to blueprints. Since, even though the AI tree has a Blueprint interface, things like ticks work very differently, and that is what I am trying to work around.
Thank you for explaining, I understand what you are saying now. I made an example task to show what I mean. You would have to modify this for your needs to get it to work right, but it could all be done in the behavior tree without touching the character bp. You would also probably want to use an interface instead of a cast.
You do not need the timeline because you can just use the float directly. You just have to figure out how you want to move through the float curve and also you have to figure out how to call finish execute. (Probably by keeping track of the AI to see if it is at the players location or not and feed that into the task with a bool.)
No nee to apologize, I was just having trouble understanding. I apologize for not explaining better with an example like this: