Ability to unload NavMesh for a chunk from PathfindingService

As of right now it’s too difficult to get around unloading the Navigation Mesh for a specified region in the world space.

I would want the ability to remove the Navigation Mesh for a region via a supported API for PathfindService, or the ability to set a elapsed time threshold for a inactive chunk region before it disposes the loaded chunk .


Noted issues

The problems that have raised concern from the inability from unloading said chunk in the world space can lead to servers dying out fairly quick in a scenario with large enough maps with agents that cast pathfinding operations across the map, most notably maps with terrain due to more possible polygons on the terrain itself.

This is also problematic as the navigation mesh permanently stays in the loaded chunk without ever unloading itself due to inactivity, thus leading to it building up memory for the server.


Hacky workaround

Currently the only workaround is to use a BasePart alongside a PathfindingModifier with the pass through set to true, then lastly to compute a path in the chunk to remove the NavigationMesh in the chunk. However this method can disrupt on-going computed pathfinding operations and have agents break or bug out, and takes time to remove as each NavigationMesh is generated in chunks of 64x64.


Evidence

I’ve sampled some data to back this all up as we have a game that is facing this problem.

As you can evidently see that it’s tolling on average about 1.1gb for a server with a map size of roughly 4000x4000.

4 Likes