Best practices for an open world game?

Hey guys,

I have been struggling with the Unity’s navigation system for awhile, so I decided to get this package, but I have a couple of questions before I start working with it on my project.

  1. As the title tells my game is open world, so I have been wondering if I should use Recast Graph or Navmesh Graph. The terrain / navmesh does not update at runtime. The documentation suggests to go with Recast, but it says it’s more complex in a way.

  2. When an AI reaches it’s destination, how accurate it’s rotation is to the destination goal? I have some animals that need to chase the player and get right in front of it, then attack. While I was using the Unity’s navigation system, the AI’s rotation was offset and it didn’t stop right in front of the player.

  3. I saw the navmesh cutting works at runtime, but does it also work when baking the navmesh surface? I would like to exclude some areas for example from the navmesh but not at runtime (to save performance).

  4. When using the built in too to separate areas with the tags - ground, lava etc, does the polygon align with the terrain?

  5. Can I still use my navmesh agents and navmesh surface for my human NPCs while using this plugin for the animals? I plan to use it for all of them, but it will probably take some time and until then I want to have working human NPCs.

  6. Can I completely exclude areas from baking with Recast / Navmesh graph for example unused terrains?

It would be very helpful if someone can answer these questions, so I can avoid some common mistakes.

1 Like

Hi

  1. For an open world game I’d either recommend a recast graph, or possibly a grid graph together with the ProceduralGridMover component (see the example scene called ‘Procedural’), this is only applicable if you only need pathfinding around a single player character however.

  2. The built-in movement scripts only move to a single point, they do not rotate to face any particular direction.
    If you need this you will need to either modify the existing scripts or write your own movement scripts, which is fortunately not terribly hard to do (there is a subsection in the get started tutorial that covers some of this).

  3. It is not possible to do navmesh cutting during bake time at the moment out of the box, however another user did get that working recently: https://arongranberg.com/astar/docs/raycastmodifier.html. Unless you have performance issues with navmesh cutting I’d recommend taking the easy way and doing it during runtime.

  4. Currently no, as you mentioned in another thread, a tool like Unity’s NavmeshModifierVolume component would be useful, but as of this moment, there is not one. You can use a RecastMeshObj component to create a split in the navmesh though. See https://arongranberg.com/astar/docs/recastmeshobj.html#area, but it’s not the best workflow.

  5. You mean use Unity’s navigation and this one at the same time? Sure, they are completely independent.

  6. You can exclude objects using the layer mask in the recast graph settings, or you can make the surfaces of them unwalkable by attaching the RecastMeshObj component and setting the ‘area type’ to ‘Unwalkable Surface’.