Is there a smart way to get your AI to run out of "danger circles"?

In my game, there will be bombs randomly flying down from the sky and they will project a “danger circle” onto the ground indicating they are about to fall down on that spot in 5 seconds. I’m trying to implement my AI to immediately run out of a danger circle if it spawns on top of them or to avoid them if the danger circles spawn in their path.

I’ve managed to implement this by making my danger circles spawn a nav mesh modifier that sets the nav mesh within the collision circle to be an “Obstacle”. This is pretty awesome because wherever my AI is running, it will avoid those danger circles.

The problem with nav mesh modifiers is that it only works while the AI is moving during a “Move To” task. I want my AI to realize that it is currently standing in a danger circle, or a danger circle has spawned on top of them, and they need to immediately get out of this spot and find a safe place to stand.

I was wondering if anyone knows a solution to this problem that comes with a feature in the engine that I don’t know about (like maybe some way to use AI perception or some way to set up nav mesh modifiers) to implement this solution. I was about to try something where when a danger circle spawns I will calculate the vector from the AI character to the center of the circle and make the character do a “Move To” away from the center of the circle until it detects that it is no longer in its collision radius. This feels a bit problematic to me because I would have to consider what happens if two danger circles are overlapping or a danger circle spawns into a corner and my AI will just run stupidly into a corner.

If anyone has a good solution to this, please let me know! Thank you!

An influence map of some kind would do the trick.

Thanks for the suggestion. I looked up what influence maps are and they do seem perfect for what I want to do. Does unreal have an inbuilt system for building an influence map or do I have to code something like this from scratch?

No, you will either have to code your own solution or grab a plugin from the marketplace.

… have the bomb spawn an overlap area.
code the AI to react to the overlap area by finding a point outside of it and moving to it…

Seems like something that could utilize a custom event - Custom Events | Unreal Engine Documentation

Have a sphere collider spawn where the circle is, find all ai actors in that sphere (typecast the actor), the shoot them the event, passing in the sphere collider as a param, and have a high priority branch on your behaviout tree telling the ai to skedaddle.

The most expensive part of this I’ll wager would be the overlapping sphere - if it’s big and there are a lot of actors within its bounds, but you could probably optimize that if/when it becomes an issue.

I have yet to see an issue when using a cast with over 150 concurrent overlaps.
overlap start that is you only check in/out.
the branch from the cast stopping execution addresses most of the load.

spawn a overlap sphere there and on overlap move the overlappers inverse to the center=location of the sphere.

you could use a SphereOverlap or OverlapBox underneath the falling bombs, only testing for your enemies Object Channel. And tell it to run away from that area.