170 likes | 296 Views
A Navigation Mesh for Dynamic Environments Wouter G. van Toll, Atlas F. Cook IV, Roland Geraerts CASA 2012. Problem solved?. Motivation. Path planning in games and simulations Send virtual characters from start to goal Increasing desire for efficiency and realism
E N D
A Navigation Mesh for Dynamic EnvironmentsWouter G. van Toll, Atlas F. Cook IV, Roland GeraertsCASA 2012
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
Preliminaries: 2D medial axis The set of all points with at least two closest obstacle points • Medial axis: • Pruned version ofthe Voronoi diagram • Subdivision into cellswith 1 closest obstacle • A useful roadmap • Maximum clearance to obstacles • Preserves connectivity
Preliminaries: Explicit Corridor Map • ECM: Annotated medial axis (Geraerts, 2010) • Bisector vertices storea closest obstacle pointon 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 • 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
1. Inserting a point among points • Insertion = 1 step of incremental construction • Let Cjbe the Voronoi cell of point pj • Let p be the point to add • Algorithm (Green and Sibson, 1978) • Find the cell Ci in which p lies • Compute the bisector of p and pi • Find the intersections of bisector and Ci • 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 • 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 • What if the inserted obstacleP is a line or polygon? • P can also induce bisector vertices • Adapted insertion algorithm • In each iteration, choose the 1st of 3 intersections • With the Voronoi cell • With the neighbour’s normal vector • With P’s normal vector
4. Deleting an obstacle • Deleting P: the cell CP needs to be removed • Its interior must be filled in with new edges • These can only come from P’s neighbors! • Deletion algorithm • Compute NP, set of P’s neighbors • Build the medial axis for NP • Connect the old/new medial axes • Delete the boundary of CP • Complexity: O(m log m) • m = number of neighbors for P
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
Experimental results (2) • 2. Inserting polygons into various scenes • Running times: 1.3ms to 2.5ms • Efficiency depends on the new cell’s complexity 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
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 demo 1 demo 2
Future work Goal: a generic path planning framework for games and simulations
Thank you • Contact • Roland Geraerts • R.J.Geraerts@uu.nl • http://www.staff.science.uu.nl/~gerae101