Support Forum

Navmesh cut + army of AI with paths

Just purchased the A* pro version - it’s awesome!

I have a recast graph with a large army of bad guys (RichAI) coming from different locations that are heading to a fixed goal. At various times throughout the game the user may drop a wall down that may or may not block some of the agents from reaching that goal.

In order to improve performance, I have disabled “can search” for each of the bad guys so that path searching is only instigated when needed. I also disabled the navmesh cutting update interval (-1). When the user drops a wall, the navmesh is cut and AstarPath.active.navmeshUpdates.ForceUpdate() is called. Because the “can search” is disabled, I must manually tell the bad guys to search for a new path after the cut. Since the wall drop likely only impacted some (or none) of the bad guys, it seems like a waste of cpu to have to tell every single bad guy to repath.

I have two related questions…

  1. Is there a way to find out which paths were affected by the navmesh cut so that I can only tell the affected bad guys to repath?

  2. Am I going about this whole thing wrong? Is updating paths on an interval (via “can search”) something that is actually really cheap and fast to do?

I was originally using Unity’s native navmesh system, and path searching on that was really expensive and killing frame rate with lots of agents present.

Thanks for any advice you might have!