Transcript A Navigation mesh for dynamic Environments
A Navigation Mesh for Dynamic Environments
Wouter G. van Toll, Atlas F. Cook IV, Roland Geraerts
CASA 2012
Problem solved?
2 / 16
Motivation
Path planning in games and simulations
•
Send virtual characters from start to goal
•
Increasing desire for efficiency and realism
– Characters: smooth movement, collision avoidance, … – Environments: complex (2.5D), dynamic, … •
Foundation: a navigation mesh
– Subdivision of the walkable space into 2D polygons – Allows smooth, flexible movement •
Our framework: corridors
– Based on the 2D medial axis
Contribution: dynamic updates
3 / 16
Preliminaries: 2D medial axis
Medial axis: The set of all points with at least two closest obstacle points
•
Pruned version of the Voronoi diagram
•
Subdivision into cells with 1 closest obstacle
4 / 16
A useful roadmap
•
Maximum clearance to obstacles
•
Preserves connectivity
Preliminaries: Explicit Corridor Map
5 / 16
ECM: Annotated medial axis (Geraerts, 2010)
•
Bisector vertices store a closest obstacle point on both sides
•
Exact subdivision of the walkable space An efficient nav. mesh
•
O(n) storage
•
O(n log n) build time
Preliminaries: Explicit Corridor Map
6 / 16
Some features of the ECM
•
Clearance information
– Supports all character sizes •
Global planning on the MA
– Result: path +
corridor
•
Following indicative routes
• •
Short paths with clearance Local forces can be added
– – Collision avoidance Group coherence •
Multi-layered environments
•
Dynamic updates
Contribution: Local updates
Dynamic environments can change locally
•
E.g. collapsing bridges, newly built roads, …
•
Complete navmesh reconstruction is expensive!
Local operations: adding/removing obstacles
•
Update the mesh only where it is necessary Recall: The ECM is an annotated medial axis
We use Voronoi algorithms; skip the annotations today 1.
Inserting a point among points 2.
Inserting a point among polygons 3.
Inserting a polygon among polygons 4.
Deleting an obstacle
7 / 16
1. Inserting a point among points
8 / 16
Insertion = 1 step of incremental construction
– – Let C
j
be the Voronoi cell of point p
j
Let p be the point to add
Algorithm (Green and Sibson, 1978)
– – – – Find the cell C
i
in which p lies Compute the bisector of p and p
i
Find the intersections of bisector and C
i
Compute new neighbor + bisector – – Iterate until the new cell is finished Remove the old edges •
Complexity: O(log n + k)
– – n = number of points k = complexity of the new cell
2. Inserting a point among polygons
9 / 16
What if the other obstacles are polygons?
• •
Bisector edges are chains of line/parabola segments A bisector vertex (BV) marks a switch
•
BV occurs when the edge intersects a surface normal Adapted insertion algorithm
•
In each iteration, choose the 1st of 2 intersections
3. Inserting polygon among polygons
10 / 16
What if the inserted obstacle P is a line or polygon?
•
P can also induce bisector vertices Adapted insertion algorithm
•
In each iteration, choose the 1st of 3
– With the Voronoi cell
intersections
– – With the neighbour’s normal vector With P’s normal vector
4. Deleting an obstacle
Deleting P: the cell C
P
•
needs to be removed Its interior must be filled in with new edges
•
These can only come from P’s neighbors!
Deletion algorithm
– – – Compute N
P
, set of P’s neighbors Build the medial axis for N
P
Connect the old/new medial axes – Delete the boundary of C
P
•
Complexity: O(m log m)
– m = number of neighbors for P 11 / 16
Experimental results
1. Inserting random points into an empty scene
• •
Incremental insertion Local updates vs. global reconstruction
– – Local: Always fast (< 1 ms) Global: Slower, depends on #points so far 12 / 16
Experimental results (2)
2. Inserting polygons into various scenes
• •
Running times: 1.3ms to 2.5ms Efficiency depends on the new cell’s complexity
13 / 16
In practice, most updates will be very local
Fast enough for real-time updates!
Experimental results (3)
3. Deleting polygons from various scenes
• •
Same polygons/scenes as before Running times: 1.2ms to 5.4ms
•
Efficiency depends on the old cell’s complexity 4. Moving a polygon through various scenes
•
Re-insert the polygon into a static version
•
Running times below 1.5ms
We can handle multiple moving obstacles in real-time
14 / 16
Conclusions
Algorithms for updating a navigation mesh
• •
Based on Voronoi diagram techniques Insertions of points and polygons
•
Deletions based on insertions Implementation and experiments
•
Insertions: real-time performance
•
Deletions: slower, but still applicable
•
Movement: real-time insertions into a static scene
•
Applications in 2D and 2.5D
15 / 16 demo 1 demo 2
Future work
16 / 16
Goal: a generic path planning framework for games and simulations
Thank you
Contact
• •
Roland Geraerts [email protected]
•
http://www.staff.science.uu.nl/~gerae101
17 / 16