Earlier in the year we experimented with bringing real-time dynamic navmesh regeneration to the open-source Recast demo, to test it’s capabilities. Here’s a video of the results.
The popular Recast project is a library for navmesh generation, pathfinding and dynamic avoidance. It comes with a simple but slick demo environment which allows you to load the geometry of a level, generate a navigation mesh and create some agents to move around. However, the demo doesn’t allow you to make changes to that geometry.
We added the facility to create and move objects within the application and caused the affected tiles to be regenerated in real-time. The agents also recalculate their paths, so they will smoothly reroute when blocked.
New paths can also be created – for instance, by placing a bridge – allowing the agents to navigate to previously inaccessible locations.
This approach involves regenerating tiles from scratch and is the most common route people take to dynamic navigation meshes, however it’s not the best for all applications. It uses the same mechanisms as the original mesh generation, making it simple to implement and the ability to create new paths based on player actions makes it very powerful for sandbox gameplay. The alternative is a purely subtractive approach, also supported by Recast, where we can place obstacles, but new routes cannot be created. This gives much greater control to designers and is potentially more efficient.