Hi, I have a question about how enabling the Navmesh system affects memory footprint.
We currently have Navmesh disabled project-wide because we really needed to save as much memory as we could. We would like to start using Navmesh in certain environments for small areas like an enclosed sheep fence area for example.
My question is, if an environment uses Null Navmesh in World Settings, is it still affected by some overhead memory just because the Navmesh system is enabled?
Thanks
Hi,
When the `Navigation SystemConfig` is set to `Null Nav Sys Config` the Recast Navmesh ( the object responsible for loading and querying the navigable environment ) does not consume any memory. This is a valid way to tell the engine to ignore any navigation setup and processing.
This can be confirmed using the `stat navigation` command and the `Unreal Insights Memory Profiler`. Following is a screen shot where two maps are being swapped between; both having the same Nav Mesh Bounds Volume and Recast Nav settings but one has the Navigation System Config set to `Null Nav Sys Config` in it’s world settings.
When using the Nav Mesh there are a number of options to tune that can reduce the memory footprint.
Some key settings :
- The scale of the nav mesh bounds volume - a larger nav mesh testing area results in potentially more polygons on the nav mesh geometry.
- The tile size ( Tile Size UU ) of the RecastNavMesh - A larger tile size typically results in less memory usage due to the resulting lower nav mesh polygon count, however the navigation mesh can become more divergent from the actual topology of the environment and miss areas as the tile size increases.
- The cell size and height of the RecastNavMesh - these values are used to create voxels that are used to test the environment in order to determine which of the environment’s geometry to encapsulate within the navmesh. A larger voxel size will “smooth” over smaller environmental obstacles, a small voxel size will result in more complex polygon shapes to accommodate any smaller obstacles, which can result in a larger memory footprint for the nav mesh.
- Tile Pool Size - For small areas the default tile pool size may be too generous and the memory is wasted.
You can also massage the nav mesh topology further by adjusting:
- MergeRegionSize - merging small disconnected regions to reduce Nav Mesh complexity
- MaxSimplificationError - allowing more edge simplification to reduce Nav Mesh polygon count
- MinRegionArea - culling very small nav mesh islands that agents can never realistically use to reduce Nav Mesh polygon count
Also some further things to note:
- Adding addtional AI agents affects memory footprint - Each agent added in the Project settings ( Engine->Navigation System->Agents) will result in a new separate additional Nav Mesh i.e adding a single additional agent could effectively double the memory footprint when when previously using a single agent.
- The above assumes a static runtime generation; however depending on the size of your level and use case`dynamic generation` may provide better/additional memory improvements.
- Newer versions of Unreal ( e.g 5.7 ) have further improvements, methods and tools that may be of benefit.
All the best,
Tristan
Thank you for the in-depth answer.