Search Unity

Navigation Components performance

Discussion in 'Navigation' started by VictorKs, Oct 7, 2018.

  1. VictorKs

    VictorKs

    Joined:
    Jun 2, 2013
    Posts:
    242
    The new navigation components look really great and I'm thinking of swtching over from old navmeshes.
    But is it stable for production and also is it performant? I'm developing an rts with around 1000 agents so navigation performance is critical. I'm really looking forward to replace those painful off-mesh links.
     
  2. Yandalf

    Yandalf

    Joined:
    Feb 11, 2014
    Posts:
    491
    I've done a bit of testing on this myself, though not to the magnitude of 1000 agents, with a dynamic NavMesh (divided in cells with the ModifierVolumes, updating these depending on the amount of agents in each cell) and it seems that recalculating navmeshes in small environments is pretty darn fast. The agents also seem clever enough to not needlessly recalculate their paths, only recalculating if an area on their old path gets changed instead of whenever the navmesh changes.
    That said, with such a massive amount of agents avoidance becomes a problem. The core Unity NavMeshAgent has some local avoidance which is rudimentary at best, allowing it to work quickly but the results are prone to error when lots of agents are close together. I would definitely suggest to have units clump together in groups and have each group share 1 agent. It might also be worth the effort to look into FlowField navigation like in this article.
     
    VictorKs likes this.
  3. VictorKs

    VictorKs

    Joined:
    Jun 2, 2013
    Posts:
    242
    I have them grouped in teams of 50 so 1 agent does large scale pathfinding and other 50 do small scale like less than 1 unit. So far everything works great with old navmesh system, I just would like to have different level forests/props etc. so what Im after is baking 2-3 navmeshes in editor and load the right one during runtime.
     
  4. Yandalf

    Yandalf

    Joined:
    Feb 11, 2014
    Posts:
    491
    That should be possible with the new system, yes. You can save baked navmeshes in prefabs, though this apparently comes with some restrictions. You'll have to test this for yourself, but I'm curious to your findings.