Streaming Level Tiles with Nav Mesh

Hi all,

I have a problem. I have created a series of sublevels I spawn procedurally at runtime to create a large grid world.
These sublevels are modular, and are instanced many times at different positions and rotations.
While doing this I assumed I could create a Nav Mesh Volume per sublevel and precalculate the Nav Mesh of each tile - however this does not seem to be working.
I read in this thread from 2015 that the only option is to have a large Nav Mesh Volume in the persistent level and Recast Dynamically at runtime. However for my world this takes upwards of five minutes. Is there no other way?

I am thinking as a fallback I could load levels in dynamically so it doesn’t have to calculate the nav mesh of the entire world, however I think this is not even viable as I imagine there will be a huge frame drop when a new level is loaded in.

Hoping someone has answers, I would be super grateful.

TLDR
How can I load previously built, modular Nav Meshes into a level???

Regards,
Jimmy.

There is another way. You could use the Nav Invoker component on your AI.

This requires a few changes though, and not documented very well.

First you will need to change some settings inside your project settings.

  1. Project settings → Navigation Mesh → Generation → Advanced Dropdown → Change Max simultaneous tile generation jobs count to 1.

  2. Project settings → Navigation Mesh → Runtime → Runtime Generation to Dynamic.

  3. Project settings → Navigation System → Data Gathering Mode to Lazy.

  4. Project settings → Navigation System → Generate Navigation Only Around Navigation Invokers.

Then you will need to add the nav invoker component to your AI Pawn, there is some tile distance settings you can play with inside the component if you need. Defaults are good start points though.

You will also need to put a nav mesh bounds volume over your entire world (Do not worry, it will not get calculated.)

Now if you place an AI with the nav invoker component into the world you will see the nav mesh only gets calculated a certain radius around the AI Pawn. Move the AI around and you can see it update its nav mesh by calculating more tiles and removing old tiles depending on the nav invoker component settings.

Hope this helps!

Wow I had no idea about this feature!
In the end I changed the way my modular world tiles spawn so they load in dynamically based on a radius around the player, and then had a dynamic nav mesh updating as this was happening.
However, my solution combined with what you are describing sounds even better.
This will help a lot - thank you!

Hi @Steve SybrSyn, I am revisiting this after working on other parts of the project. I was just wondering, why is it necessary to change max simultaneous tile generation jobs count to 1?

You can increase the number, but there is a chance that it will cause the engine to crash. It’s just a bug that they are suppose to fix eventually, and it has been awhile now so it may be fixed, but I am not sure. Try changing it if you want, then test, if it crashes then you know you just gotta keep it set to 1 until the AI team fixes it. (Could be a long time.)