Pathfinding and Movement Michael Moll September 29, 2004.

Slides:



Advertisements
Similar presentations
Artificial Intelligence in Game Design
Advertisements

Wall Building for RTS Games Patrick Schmid. Age of Empires.
General Pathfinding: Tables and Navigation Jeremy Christman.
AI Pathfinding Representing the Search Space
P3 / 2004 Register Allocation. Kostis Sagonas 2 Spring 2004 Outline What is register allocation Webs Interference Graphs Graph coloring Spilling Live-Range.
Pathfinding AI John See 29 Nov, 13 Dec 2010.
Navigation Set Hierarchy Tom Gianos Chapter 2.2. Mike Dickheiser Works (worked?) for Red Storm Entertainment Works (worked?) for Red Storm Entertainment.
Quick Review of Apr 10 material B+-Tree File Organization –similar to B+-tree index –leaf nodes store records, not pointers to records stored in an original.
Administrative Project due Tuesday: – your code to Yisheng Tang no later than 11:59PM EST Monday February 6 (the day BEFORE the.
Pathfinding Basic Methods.
Lecture 12: Revision Lecture Dr John Levine Algorithms and Complexity March 27th 2006.
By Lydia E. Kavraki, Petr Svestka, Jean-Claude Latombe, Mark H. Overmars Emre Dirican
CSE 380 – Computer Game Programming Pathfinding AI
University of Amsterdam Search, Navigate, and Actuate - Quantitative Navigation Arnoud Visser 1 Search, Navigate, and Actuate Quantative Navigation.
Week 14 - Monday.  What did we talk about last time?  Bounding volume/bounding volume intersections.
Iterative Relaxation of Constraints (IRC) Can’t solve originalCan solve relaxed PRMs sample randomly but… start goal C-obst difficult to sample points.
Tirgul 9 Amortized analysis Graph representation.
Brent Dingle Marco A. Morales Texas A&M University, Spring 2002
Modelling. Outline  Modelling methods  Editing models – adding detail  Polygonal models  Representing curves  Patched surfaces.
Artificial Intelligence CSE 191A: Seminar on Video Game Programming Lecture 7: Artificial Intelligence UCSD, Spring, 2003 Instructor: Steve Rotenberg.
Randomized Planning for Short Inspection Paths Tim Danner Lydia E. Kavraki Department of Computer Science Rice University.
Introduction General Data Structures - Arrays, Linked Lists - Stacks & Queues - Hash Tables & Binary Search Trees - Graphs Spatial Data Structures -Why.
Chapter 5: Path Planning Hadi Moradi. Motivation Need to choose a path for the end effector that avoids collisions and singularities Collisions are easy.
Graphs, Goals and NPCs Advanced Programming for 3D Applications CE
Chapter 5.4 Artificial Intelligence: Pathfinding.
Multi-Layered Navigation Meshes Wouter G. van Toll, Atlas F. Cook IV, Roland Geraerts ICT.OPEN 2011.
Visibility Graphs and Cell Decomposition By David Johnson.
Chapter 5.4 Artificial Intelligence: Pathfinding.
Pathfinding: Search Space Representations Chapter 2.1 Dan Bader.
1 CO Games Development 1 Week 1 Introduction to AI Gareth Bellaby.
1 Game AI Path Finding. A Common Situation of Game AI A Common Situation of Game AI Path Planning Path Planning –From a start position to a destination.
© Manfred Huber Autonomous Robots Robot Path Planning.
Survey of AI for games. AI vs. AI for games Traditional AI: – Made to handle unseen inputs, large state space – Too many options possible to compute an.
1 CO Games Development 1 Week 6 Introduction To Pathfinding + Crash and Turn + Breadth-first Search Gareth Bellaby.
Path Planning Part I: Search Space Representation Part II: Table Lookup Path Finder Path III: Convincing Hunting Ref: AIWisdom 2.
Algorithms  Al-Khwarizmi, arab mathematician, 8 th century  Wrote a book: al-kitab… from which the word Algebra comes  Oldest algorithm: Euclidian algorithm.
Arrays Tonga Institute of Higher Education. Introduction An array is a data structure Definitions  Cell/Element – A box in which you can enter a piece.
Probabilistic Roadmaps for Path Planning in High-Dimensional Configuration Spaces (1996) L. Kavraki, P. Švestka, J.-C. Latombe, M. Overmars.
Holistic Mobile Game Development with Unity 2015 Taylor & Francis. All rights Reserved.
Evolving Virtual Creatures & Evolving 3D Morphology and Behavior by Competition Papers by Karl Sims Presented by Sarah Waziruddin.
Motion Planning in Games Mark Overmars Utrecht University.
CPSC 320: Intermediate Algorithm Design & Analysis Greedy Algorithms and Graphs Steve Wolfman 1.
Real-time Graphics for VR Chapter 23. What is it about? In this part of the course we will look at how to render images given the constrains of VR: –we.
Adrian Treuille, Seth Cooper, Zoran Popović 2006 Walter Kerrebijn
Artificial Intelligence in Game Design Complex Steering Behaviors and Combining Behaviors.
WORLD NAVIGATION Don’t Fall Asleep Through These Topics  Tile Graphs  Points of Visibility  NavMesh  Path Smoothing  Hierarchical Pathfinding.
Path Look-up Tables & An Overview of Navigation Systems Hai Hoang 10/4/2004.
F.E.A.R. Game AI Evaluation by Robert Rak. What is F.E.A.R. ? FEAR is a First Person Shooter game Player takes on the role of an elite strike force team.
CSCI1600: Embedded and Real Time Software Lecture 33: Worst Case Execution Time Steven Reiss, Fall 2015.
1 CO Games Development 1 Week 13 - Revision Lecture AI Revision Gareth Bellaby.
M1G Introduction to Programming 2 3. Creating Classes: Room and Item.
Maths & Technologies for Games Spatial Partitioning 1 CO3303 Week 8-9.
Autonomous Robots Robot Path Planning (3) © Manfred Huber 2008.
11/8/2001CS 638, Fall 2001 Today Admin Path Planning –Intro –Waypoints –A* Path Planning.
Artificial Intelligence in Game Design Lecture 8: Complex Steering Behaviors and Combining Behaviors.
Lecture 7 Page 1 CS 111 Summer 2013 Dynamic Domain Allocation A concept covered in a previous lecture We’ll just review it here Domains are regions of.
CSCE 552 Spring 2010 AI (III) By Jijun Tang. A* Pathfinding Directed search algorithm used for finding an optimal path through the game world Used knowledge.
Source: CSE 214 – Computer Science II Graphs.
1 Advanced Scene Management. 2 This is a game-type-oriented issue Bounding Volume Hierarchies (BVHs) Binary space partition trees (BSP Trees) “Quake”
CSCE 552 Fall 2012 AI By Jijun Tang. Homework 3 List of AI techniques in games you have played; Select one game and discuss how AI enhances its game play.
Autonomous Robots Robot Path Planning (2) © Manfred Huber 2008.
Introduction to Parametric Curve and Surface Modeling.
Chapter 5.4 Artificial Intelligence: Pathfinding
ECE 448 Lecture 4: Search Intro
CSCI1600: Embedded and Real Time Software
Craig Schroeder October 26, 2004
CIS 488/588 Bruce R. Maxim UM-Dearborn
Toward Solving Pathfinding
CSCI1600: Embedded and Real Time Software
Presentation transcript:

Pathfinding and Movement Michael Moll September 29, 2004

A Character Has to Move Amount of processing time per cycle for AI is low While movement is obviously a vital part of a game, it’s not exactly the most interesting task performed With A* as an example, plenty of algorithms to find paths, but probably less considered, but more important is How will we represent space we move through??

Overview Alternative Search Space Representations –Grids –Graphs –Meshes… Ok, we know what the world looks like, how can we move through it? –A* –Precomputed Pathfinding with Navigation Sets –Potential Fields

Search Space Considerations Scope of articles in book and presentation are 2- D worlds Main consideration for search spaces are memory requirements and if they facilitate fast searches (using whatever algorithm we choose) Since all of these are basically graphs, bigger worlds will require more nodes, more edges  more memory, longer searches

Path Optimality

More Considerations Representation must take into account way an character moves (size, etc) How will we create the search space? Can they be automatically generated? Scripting paths should use different structure

Regular Grids

How do we generate? Advantages –Random access lookup (O(1)) to determine what tile lies at any coordinate –Complete Negatives –Usually requires large number of nodes to accurately represent world –Path Quality -Agent can only walk in four cardinal directions? That’s no fun. -Let them walk diagonals! Still not much fun

Regular Grids NWSE Diagonals String-Pulling Catmull-Rom Spline

Grids as Graphs Everything else we look at will be a graph Grids are graphs too –Each cell is a node and edges are adjoining cells Maybe we should just handle grid as a graph –Undirected graph could tell us about topography, etc, whereas array can’t

Grids as Graphs

Corner Graphs Waypoints around obstacles

Corner Graphs How do we generate? –Identify convex corners, can character walk in straight line between? Add edge if possible Advantages –Less memory –Faster generation Negatives –Character will “walk on a rail” hugging edges of obstacles instead of walking through open space –And what about different sized characters? –Lookup is O(n 2 ), have to check every node in graph against every other. Imagine a world with a boat load or corners!

Corner Graphs

Waypoint Graphs Place nodes in middle of rooms instead of at convex corners

How do we generate? –Place nodes wherever we want (suits 3-D worlds But requires hand tuning to be effective  ) Advantages –Reduce memory footprint from regular grids, reduce wall hugging from corner graphs –Work well in “human” architectures Negatives –Still O(n 2 ) –Path Quality vs. Simplicity –Works poorly in open areas Waypoint Graphs

Circle-Based Waypoint Graphs Add radius parameter to indicate open space near waypoint

Circle-Based Waypoint Advantages –Only look at overlapping circles, alleviating O(n 2 ) problem from before –Easier to obtain optimal paths –Works well in open terrain Negatives –Doesn’t work as well in human architectures that aren’t circle friendly

Space-Filling Volumes Use rectangles or 3-D Boxes instead of circles

Space-Filling Volumes How do we generate? –Seed and Grow –Make Grid and Merge Very similar to circle-based, but handles angles better

Navigation Meshes Enough with the graphs already! Let’s try and cover walk able surfaces with convex polygons Character can travel between adjoining polygons

Navigation Meshes

How do we generate? –By hand (time consuming) Automated tools to analyze and optimize geometry of world Too complex and not represented as a single polygon mesh, instead may be overlapping, etc

Navigation Meshes Advantages –Quickly find optimal paths independent of character shapes and capabilities –Handle indoor and outdoor terrains well Negatives –Can become complex and expensive memory wise –Difficult to generate

Problem with N-Sided Meshes

Interacting with Pathfinding What about dynamic objects in world? All the representations discussed have been static and obviously can’t handle a dynamic world directly These representations need to be able to provide information to system determining path –Waypoint Graphs and Corner Graphs don’t illustrate walk able surfaces –Meshes and Grids do map every walk able surface –Space-filling volumes and Circle Waypoints provide some representation of walk able areas

Further Options for Representation Any other ideas of what we can do to make job of path finding algorithm easier? Prof. Munoz has mentioned this before…. Hierarchical Representations –Choose most suitable scheme for given world, and break up into more manageable pieces Any other ideas of what we can do to make job of path finding algorithm easier? Prof. Munoz has mentioned this before…. Hierarchical Representations –Choose most suitable scheme for given world, and break up into more manageable pieces

Path finding Now that we have world represented, how do we plan movement? –A*, Depth-First, Dijkstra Dynamic path finding is expensive –Precompiled solutions can eliminate runtime cost, but memory expensive Article suggests technique of Navigation Set Hierarchy

Transition Table Main element in pre computed solutions is a lookup table Each entry represents next step to take from one node to some goal node

Transition Table

Do not need full search of nodes at run time, just series of lookups Fast, but becomes memory expensive as size of world grows –How expensive? n 2 …solution to shrink transition tables? Hierarchy!

Navigation Set Self-contained collection of nodes that requires no links to external nodes to complete a path Nodes can be members of more than one set Goal: Find someway to partition large Navigation Sets into smaller ones

Complete Hierarchy

Interface Nodes and Sets Need to account for paths that cross navigation sets Any node that connects to a node in another navigation set is an interface node Have a second layer of nodes in addition to navigation sets, called interface set Interface set itself is a navigation set –Therefore, can make transition table for it too

Complete Hierarchy 21 nodes –1 Navigation Set = 441 Table Entries (21*21) –4 Navigation Sets = 183 Table Entries (7*7 + 7*7 + 7*7 + 6*6)

Constructing the Hierarchy Two goals to process –How many tables to create? Amount of data needed is 1/n of original size + interface set As size of navigation sets increase, cost of interface set becomes less a factor –Where to place boundaries? Keep interface nodes as low as possible

Constructing the Hierarchy

Path finding Determine best paths leading from source node to boundary of source set Determine best path from source set boundary to goal set boundary Determine best path from goal set boundary to goal node Compile list of complete paths and choose one with least cost

Cost Amount of searching is limited to number of interface nodes in goal and source sets only Cost of searching between sets does not scale up with increases in navigation set size –Dependent on number of interface nodes

Applications of Navigation Set Hierarchy Interfacing heterogeneous navigation regions Navigation data on demand Extending beyond two tiers

Potential Fields Used by Scared Little Girl in Robocode Reactive approach to path finding –Setup virtual potential or force field around objects –Must define field and agents reaction to field Interactions in general are explicitly stated and movement “emerges” –Paths are not planned explicitly

Potential Fields Think of world as matrix –Each point tells has value to represent strength of field under it –Possibly assign potential based on distance from goal Might get stuck behind obstacle –Result/Goal: “Glide down gradient/path of least resistance”

Potential Fields Advantages? –Works in continuous space! No need to make grid, place waypoints, etc Disadvantages? –Can be trapped in local minima –It’s emergent, not sure what it will do

Commercial Implementations How advanced is Half-Life 2's path finding? Is it still based around triangulations, or is it more focused on waypoints, or both... or? Steve Bond: I guess the best answer to this question is "A character who wants to get somewhere will find a way to get there". Half-Life 2's path finding supports swimming, flying, jumping, climbing ladders, and opening doors.

Commercial Implementations Unreal Tournament –Waypoints with pre computed paths Navigation Points placed throughout world –Assumes world is generally static Run local path finding on top of global path finding Local path finder constants queries physics engine to find dynamic objects

Commercial Implementations Area Awareness System –Designed for Quake 3, used in Doom 3 –Does not use waypoints, instead 3-D bounded hulls, called areas Cost of moving from one point to another within a hull (reachable area) is minimal Reachability can also be determined if a hull touches another – averen_Jean-Paul_van/thesis.pdfhttp:// averen_Jean-Paul_van/thesis.pdf

Commercial Implementations Half Life 2 –Waypoint Based Call of Duty –Based off of Quake 3 AAS –Path finding handled by Conduit Engine

Sources AI Game Programming Wisdom 2 H. Munoz-Avila & T. Fisher, Strategic Planning for Unreal Tournament Bots. First Person Shooter Architecture AI, ture ture Bryan Stout, Smart Moves: Intelligent Pathfinding, JMP van Wavern, The Quake III Arena Bot, Paul_van/thesis.pdf Paul_van/thesis.pdf Stefan Baert, Motion Planning Using Potential Fields, nning/ nning/ John Spletzer, Lecture Notes from An Introduction to Mobile Robotics, 9/16/03