Is there a way to make bots that don't get stuck on each other/terrain?

I’ve followed a few blueprint + behavior tree tutorials to get some simple bots running around my level but they seem to get stuck quite easily.

All of the paths on my nav mesh are wide enough for two bots to pass but they always take the shortest route and hit each other at corners. A simple set up which is guaranteed to make them get stuck indefinitely is a spiral stairs with one guy going up and the other going down.

I’ve had a play around with the shooter demo and these bots seem to suffer the same problems. If you spawn a few of them then eject from the game and move them behind an obstacle in a reasonably tight cluster, more often than not they will get stuck on each other trying to get back to the player location.

My bots and the shooter bots are using the MoveTo task in their behavior trees.

Is it a case of the BTTask_MoveTo class is still be under development or is “anti collision” behavior something I should implement myself if I want a more complex bot?

Thanks

You need to add another layer of logic. I believe what you are talking about is generally called Steering Behavior. There are different ways to do it. AI is hard, getting the nitty gritty behavior’s to look good such as moving in a crowd takes a lot of time and there is no de facto solution for it.

I’ve never been completely satisfied with how I have done it.

A simplified solution could be something like this. In your Behavior Tree add Steering logic in your branch where your move is.

Add another point to your BlackBoard for the temporary steering location.

You can check if there are other Pawns in the area. Then if so, check if the are in front, then if in front if they are moving toward the Bot, if so, can make a decision to step left or right to avoid. Set the avoidance location in your Blackboard, then move to that, upon reaching it again do the moveto.

If both bots decide to step in the same direction they will again block each other. If you think about it though, that happens in real life all the time on a busy sidewalk in major cities. You’ll also need to take other collisions into account such as being near a wall all ready, so only have one side to step too.

In the case where there is not enough room, you could add a root animation to handle it. where both the Bots participate in the same animation, turning sideways to pass each other or something. Think of a melee attack animation that is synced with a reaction, but it’s for movement instead. One of the bots is going to probably need to be the instigator and trigger the correct animation to occur in the more passive bot otherwise it’s back to the same problem.

Another way is to assign a weight or priority. If you look at Starcraft 2, the larger units will move straight forward and the smaller units will get pushed out of the way.

I was afraid that might be the case.

Thanks for the help, I’ll do a bit of research into steering and other aspects of AI movement.

Thanks