680 likes | 701 Views
Explore advanced techniques like Ontogenetic Modeling, Constructive Path Planning, and Hierarchical Search to navigate virtual worlds efficiently. Learn about weighted graphs, heuristic search, and the use of hierarchies in pathfinding. Discover how to create realistic environments and optimize navigation for game players and computer-controlled agents.
E N D
Creating and Navigating Virtual Worlds David Mould
Overview • Creating scenery in virtual worlds • Navigating through virtual worlds • Helping game players to understand virtual worlds
Ontogenetic Modeling • Ontogenetic modeling: approach appearance of model without regard for underlying process • Seek lightweight means of mimicking appearance of dendritic objects • Path planning: • irregular curves • paths from root never cross
Path Planning Problem • Given a weighted graph, a start node S, and a destination D, find the path from S to D that has the lowest cost. • a path is a sequence of edges. • the cost of a path is the sum of all the edge weights along the path.
Basic Idea • Shortest paths in a weighted graph • Automated process • Offers user control: • weights in graph influence path shape • endpoint choice affects dendrite’s appearance • generator shape, likewise
Implementation • Dijkstra’s algorithm used to get costs from root to all other nodes in graph • O(N) to cover graph • O(n) for path from arbitrary endpoint to root • endpoints placed by hand or procedurally
Fractal Dendrites • Real objects often exhibit fractal (multiscale) detail • Explicitly introduce hierarchical detail: • Create low-frequency detail • Add structure at higher frequency • Repeat previous step
real DLA imitated DLA
“Rocks” • Multi-source path planning partitions space – can be used to produce irregular 3D objects
Constructive Path Planning • Path planning for procedural structure • Simple implementation • Rich control handles • Wide variety of phenomena • Trees, rocks, coral, lightning
Navigating Virtual Worlds • Virtual worlds are full of obstacles and hazards, and getting from point A to point B is not trivial • Both computer-controlled and player-controlled agents need automatic navigation • Formal framework: least-cost path through a weighted graph
[Total Annihilation, 1997] [Heroes of Might and Magic V, 2007]
Weighted Graphs 3 2 7 1 1 4 3 4 3 8 2 2 5 2 1
Weighted Graphs 3 1 - Weights represent difficulty - distance - time - hazard
Heuristic Search: A* • If the heuristic is perfect, we always search exactly in the right direction, and only look at nodes on the path • If the heuristic is admissible, the final path is guaranteed to be optimal
Bad heuristics • If the heuristic is poor (doesn’t give much information about where to search) then A* does no better than breadth-first search • It's very difficult to devise general heuristics • In computer games, level designers try to invent maps which defeat simple heuristics
Giving up • But, is there much need for optimal paths? • People don’t usually use the optimal path, and they seem to get around fine • A path can be “good enough” without being optimal • [Aside: non-admissible heuristics can work OK, but can result in extremely high costs fixing the errors in tricky maps]
Hierarchical Search • Create a second graph which is an abstraction of the first (maybe repeat) • Use the hierarchy to give the paths • waypoints • Use the hierarchy to give estimates • Use the hierarchy to constrain the search • HTAP’s pyramid
HTAP • HTAP: Hierarchical Terrain Representation for Approximately Shortest Paths [Mould and Horsch 2004; Mould and Horsch 2005] • Offline construction of hierarchy • Online linear-time pathfinding • Search space constrained by hierarchy
Creating the Hierarchy • Choose “representatives” – nodes estimated to be on many paths • Associate nodes with representatives • Insight: according to path cost in original graph • Place edges between representatives • again, based on original-graph path cost • New graph obtained; repeat if still too big
Using the Hierarchy • Find representatives of endpoints in coarsest graph, and search for path there • Next level down: • find representatives of endpoints in current level (just a lookup) • find path, searching only in regions whose representatives one level up were on the path • Repeat until bottom level reached
Results computational cost (number of vertices opened) A* - quadratic HTAP - linear path cost
Results computational cost (number of vertices opened) path cost