Mieszko Zielinski (Epic Games), White Nights 2015

20
UE4 Open World AI Navigation And how did we get here

Transcript of Mieszko Zielinski (Epic Games), White Nights 2015

Page 1: Mieszko Zielinski  (Epic Games), White Nights 2015

UE4 Open World AI Navigation

And how did we get here

Page 2: Mieszko Zielinski  (Epic Games), White Nights 2015

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

Page 3: Mieszko Zielinski  (Epic Games), White Nights 2015
Page 4: Mieszko Zielinski  (Epic Games), White Nights 2015

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

Page 5: Mieszko Zielinski  (Epic Games), White Nights 2015

So what’s the problem?

Page 6: Mieszko Zielinski  (Epic Games), White Nights 2015

This doesn’t scale all that well

Page 7: Mieszko Zielinski  (Epic Games), White Nights 2015

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.

Page 8: Mieszko Zielinski  (Epic Games), White Nights 2015

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

Page 9: Mieszko Zielinski  (Epic Games), White Nights 2015

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!

Page 10: Mieszko Zielinski  (Epic Games), White Nights 2015

Solution ideas

Custom Landscape-specific navigation graph–Main navoctree

occupant– NO GO, more then

just lanscapes in the demo

Page 11: Mieszko Zielinski  (Epic Games), White Nights 2015

Solution ideas

High level navigation mesh– Huge voxels, very

low precision– Low memory, fast

generation

– NO GO, would require a custom local-navigation solution

Page 12: Mieszko Zielinski  (Epic Games), White Nights 2015

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

Page 13: Mieszko Zielinski  (Epic Games), White Nights 2015
Page 14: Mieszko Zielinski  (Epic Games), White Nights 2015

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

Page 15: Mieszko Zielinski  (Epic Games), White Nights 2015

Navigation Octree

• Lazy geometry gathering– outside of game thread

• Landscape slicing– never stored in octree– constant cost, outside of game thread

Page 16: Mieszko Zielinski  (Epic Games), White Nights 2015

Navigation Invokers

• Internal and external radii• Updated on a regular basis• Only “new” tiles require work

Page 17: Mieszko Zielinski  (Epic Games), White Nights 2015
Page 18: Mieszko Zielinski  (Epic Games), White Nights 2015

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

Page 19: Mieszko Zielinski  (Epic Games), White Nights 2015

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

Page 20: Mieszko Zielinski  (Epic Games), White Nights 2015

Hit me up [email protected]