Search Unity

Runtime navmesh generation with navlinks in mutiplayer top-down ARPG?

Discussion in 'Navigation' started by UnkelRambo, Sep 9, 2022.

  1. UnkelRambo

    UnkelRambo

    Joined:
    Oct 26, 2012
    Posts:
    80
    Hi!

    I've been banging my head against this for a couple days now, so I thought I'd post here. I've got a top-down ARPG in a procedural world and I'm trying to get runtime navmesh generation working around each player. So far I've tried Unity's AI Navigation package which is nice, but I can't seem to get a nice solution for nav mesh merging when two players are near one another as NavMeshBuildSettings.preserveTilesOutsideBounds seems to ONLY work if there's an existing navmesh. Ideally with runtime navlinks as well (for jumping.)

    I looked at A* Pathfinding Project Pro and it has some neat bells and whistles but the performance doesn't come close to meeting my needs (something Unity's jobified pathfinding does really well.)

    So I'm curious if anybody has a suggestion on how I might go about:

    1) Generating nav mesh at runtime in a large open world
    2) Based on player locations that may or may not result in co-located navmesh bounds
    3) Performant enough for ~10 players and ~1000 agents running around.

    I'm OK going 3rd party for this if it costs $$$. My game is not voxel based, but I'm thinking I may have to switch gears and write my own voxel pathfinding which is work I may do, but honestly I'd rather switch to Unreal lol

    Any input welcome, thanks!
     
  2. UnkelRambo

    UnkelRambo

    Joined:
    Oct 26, 2012
    Posts:
    80
    Today's experiment: I'm generating a grid of 64x64 sized navmeshes and stitching them together manually using NavMeshLinks, then giving "relevance" to nav meshes in the grid as players move around. Nav mesh chunks that come into relevancy are generated asynchronously. So far so good, but this only *kind of* works in my scenario and I'm having to roll a ton of custom logic to make the stitching happen and it seems a bit flakey.

    But you know what, if I can get this to work I'll be happy. The tricky part is that I have dynamic building which can add nav which needs to be stitched together for buildings between chunks. If this means I *have* to build in a voxel grid, I can change the game to be that.

    I'd love to hear if anybody has done anything like this in Unity because man coming from Unreal this is a huge burden...