UE4 Open World AI Navigation
And how did we get here
Recast by Mikko Mononen
Best thing that happened to game AI navigation since sliced bread!• Lightweight, fast and open-source! • De facto industry standard• Resurrected and available on github
https://github.com/memononen/recastnavigation
UE4 Navigation parts
• Navigation bounds volumes• Navigation relevant actors – geometry & other data (links, areas)
• Navigation Octree– stores navigation-relevant data– speeds up gathering relevant data for
specific navmesh tile’s generation
So what’s the problem?
This doesn’t scale all that well
GDC Demo Map, 256 km2
Naive approach
Navigation Octree ~10.3GB
NavMesh ~500MB
Plus ~30 minute navmesh generation (8 core machine)And requires loading all levels for navmesh generation purposesThis, of course, is useless.
Why it was so much?
• Empty NavMesh tile - 176 bytes• 10000 tiles, ~50kB each, 16000uu x
16000uu • Every piece of navigation-relevant
data kept in Navigation Octree
Solution ideas
Dump the navigation octree!– Static navmesh of 500MB is acceptable– No work required, supported out of the
box– NO GO, we wanted to show dynamic
navmesh generation!
Solution ideas
Custom Landscape-specific navigation graph–Main navoctree
occupant– NO GO, more then
just lanscapes in the demo
Solution ideas
High level navigation mesh– Huge voxels, very
low precision– Low memory, fast
generation
– NO GO, would require a custom local-navigation solution
No worries!
Low-hanging fruit solution• We don’t need all of navmesh all the time• We need only the nav octree information
required by tiles we need
Applied to UE4 Navigation System
• Navigation bound stay the same• Navigation octree to store only the
data relevant “now”• Introduce a way to communicate to
Navigation System where navmesh is required
Navigation Octree
• Lazy geometry gathering– outside of game thread
• Landscape slicing– never stored in octree– constant cost, outside of game thread
Navigation Invokers
• Internal and external radii• Updated on a regular basis• Only “new” tiles require work
GDC Demo Map, 256 km2
Naive approach At GDC
Navigation Octree ~10.3GB 572MB
NavMesh ~500MB 31MB
The end result still not ideal But we’re not done yet! :D
Future work
• Don’t store anything in nav octree unless it’s necessarry– Currently only geometry is treated the smart way
• Moveable navigation bounds • Give lazily gathered octree data a lifetime
limit• Multithreaded lazy geometry gathering
Hit me up [email protected]