Pathfinding Over Streaming Terrain By James Stewart jmstewar@smu.edu
The Problem: How do you find a path when the search space is too large to fit into memory?
Features of the Solution Use same data representation for both rendering and AI. Solution requires no explicit intervention by a designer—terrain is by definition very large. Handles only static pathfinding. Dynamic obstacles such as deformable terrain or physics entities require a separate AI layer.
Terrain Preprocessing A simple tool packages a gigantic height map into leaf nodes of a Restricted Quadtree Triangulation. (Long story short, Wouter’s LOD method plus stripification and an error metric to collapse distant vertices.)
Terrain Preprocessing Lowest LOD used as a basis for a navmesh. Export neighbor accessibility summary (eight neighbors = 3 bits / chunk)
Terrain Database 1. Dedicated thread asynchronously pages chunks from storage to be accessed as memory-mapped files. 2. Paging candidates and victims selected via motion prediction (prediction scheme very dependent on game design).
AI Solution Use neighbor accessibility classification to build a “good enough” path. Refine path over subsequent frames by paging in chunks along path.
Challenges Scalability: How will database prioritize paging requests when many units each require different chunks, and memory is limited? Path Optimality: Is the “good enough” path really good enough? Compression: How can the size of the terrain and navmesh data be reduced?