Chapter 5.4 Artificial Intelligence: Pathfinding

Slides:



Advertisements
Similar presentations
Artificial Intelligence: Knowledge Representation
Advertisements

Heuristic Search techniques
Problem solving with graph search
AI Pathfinding Representing the Search Space
an incremental version of A*
Pathfinding Basic Methods.
CSE 380 – Computer Game Programming Pathfinding AI
CSC 423 ARTIFICIAL INTELLIGENCE
MAE 552 – Heuristic Optimization Lecture 27 April 3, 2002
Using Search in Problem Solving
Spring 2010CS 2251 Graphs Chapter 10. Spring 2010CS 2252 Chapter Objectives To become familiar with graph terminology and the different types of graphs.
Uninformed Search Reading: Chapter 3 by today, Chapter by Wednesday, 9/12 Homework #2 will be given out on Wednesday DID YOU TURN IN YOUR SURVEY?
Using Search in Problem Solving
Fall 2007CS 2251 Graphs Chapter 12. Fall 2007CS 2252 Chapter Objectives To become familiar with graph terminology and the different types of graphs To.
Routing 2 Outline –Maze Routing –Line Probe Routing –Channel Routing Goal –Understand maze routing –Understand line probe routing.
Chapter 5.4 Artificial Intelligence: Pathfinding.
State-Space Searches.
Chapter 5.4 Artificial Intelligence: Pathfinding.
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.
1 CO Games Development 1 Week 6 Introduction To Pathfinding + Crash and Turn + Breadth-first Search Gareth Bellaby.
Probabilistic Roadmaps for Path Planning in High-Dimensional Configuration Spaces (1996) L. Kavraki, P. Švestka, J.-C. Latombe, M. Overmars.
1 CO Games Development 1 Week 11 Search Methods Gareth Bellaby.
State-Space Searches. 2 State spaces A state space consists of A (possibly infinite) set of states The start state represents the initial problem Each.
1 Artificial Intelligence in Games Week 6 Steve Rabin TA: Chi-Hao Kuo TA: Allan.
Artificial Intelligence in Game Design Dynamic Path Planning Algorithms.
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.
1 Artificial Intelligence in Games Week 5 Steve Rabin TA: Chi-Hao Kuo TA: Allan.
WORLD NAVIGATION Don’t Fall Asleep Through These Topics  Tile Graphs  Points of Visibility  NavMesh  Path Smoothing  Hierarchical Pathfinding.
Chapter 16 – Data Structures and Recursion. Data Structures u Built-in –Array –struct u User developed –linked list –stack –queue –tree Lesson 16.1.
REFERENCE: “ARTIFICIAL INTELLIGENCE FOR GAMES”, IAN MILLINGTON. A* (A-STAR)
A* Reference: “Artificial Intelligence for Games”, Ian Millington.
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.
Chapter 20: Graphs. Objectives In this chapter, you will: – Learn about graphs – Become familiar with the basic terminology of graph theory – Discover.
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.
Beard & McLain, “Small Unmanned Aircraft,” Princeton University Press, 2012, Chapter 12: Slide 1 Chapter 12 Path Planning.
CSCE 552 Spring 2012 AI (III) & Multiplayer By Jijun Tang.
A* Reference: “Artificial Intelligence for Games”, Ian Millington.
Chap 4: Searching Techniques Artificial Intelligence Dr.Hassan Al-Tarawneh.
Review: Tree search Initialize the frontier using the starting state
School of Computer Science & Engineering
Plan Agents Chapter 7..
Constraint Satisfaction Problems vs. Finite State Problems
Lookahead pathology in real-time pathfinding
Chap 4: Searching Techniques Artificial Intelligence Dr.Hassan Al-Tarawneh.
Maze Implementation, Analysis and Design to find Shortest Paths
Mathematics & Path Planning for Autonomous Mobile Robots
Finding Heuristics Using Abstraction
Search-Based Footstep Planning
Comp 245 Data Structures Graphs.
A* Path Finding Ref: A-star tutorial.
Searching for Solutions
Graphs.
Reference: “Artificial Intelligence for Games”, Ian Millington.
Team 17c ****** Pathfinding
The Rock Boxers: Tabitha Greenwood Cameron Meade Noah Cahan
CSE 373: Data Structures and Algorithms
CO Games Development 1 Week 8 Depth-first search, Combinatorial Explosion, Heuristics, Hill-Climbing Gareth Bellaby.
Chap 4: Searching Techniques
Artificial Intelligence Chapter 7 Agents That Plan
CSCE 552 Spring 2009 AI (III) By Jijun Tang.
Graphs.
Graphs.
Efficient Graph Traversal with Realistic Conditions
State-Space Searches.
Graphs.
State-Space Searches.
Graphs.
State-Space Searches.
Presentation transcript:

Chapter 5.4 Artificial Intelligence: Pathfinding (hacked by Jeffery)

Introduction Almost every game requires pathfinding Agents must be able to find their way around the game world Pathfinding is nontrivial The fastest pathfinding techniques consume a lot of space

Representing the Search Space Agents need to know where they can move Might involve data structure used in rendering Search space should represent either Clear routes that can be traversed Or the entire walkable surface Search space typically doesn’t represent: Small obstacles or moving objects Most common search space representations: Grids Waypoint graphs Navigation meshes

Grids 2D grids – intuitive world representation Each cell is flagged Works well for many games including some 3D games such as Warcraft III Each cell is flagged Passable or impassable Each object in the world can occupy one or more cells

Characteristics of Grids Fast look-up Easy access to neighboring cells Complete representation of the level

Waypoint Graph A waypoint graph specifies lines/routes that are “safe” for traversing Each line (or link) connects exactly two waypoints

Characteristics of Waypoint Graphs Waypoint node can be connected to any number of other waypoint nodes Waypoint graph can easily represent arbitrary 3D levels Can incorporate auxiliary information Such as ladders and jump pads Incomplete representation of the level NPC’s subset knowledge of the level

Navigation Meshes Combination of grids and waypoint graphs Every node of a navigation mesh represents a convex polygon (or area) As opposed to a single position in a waypoint node Advantage of convex polygon Any two points inside can be connected without crossing an edge of the polygon Navigation mesh can be thought of as a walkable surface

Navigation Meshes (continued)

Characteristics of Navigation Meshes Complete representation of the level Ties pathfinding and collision detection together Can easily be used for 2D and 3D games

Searching for a Path A path is a list of cells, points, or nodes that an agent must traverse A pathfinding algorithm finds a path From a start position to a goal position The following pathfinding algorithms can be used on Grids Waypoint graphs Navigation meshes

Criteria for Evaluating Pathfinding Algorithms Quality of final path Is quality “shortest”, or “most believable”? Resource consumption during search CPU and memory Whether it is a complete algorithm A complete algorithm guarantees to find a path if one exists

Random Trace Simple algorithm Agent moves towards goal If goal reached, then done If obstacle Trace around the obstacle clockwise or counter-clockwise (pick randomly) until free path towards goal Repeat procedure until goal reached Humans often do this in mazes

Random Trace (continued) How will Random Trace do on the following maps?

Random Trace Characteristics Not a complete algorithm Found paths are unlikely to be optimal Consumes very little memory

Understanding A* To understand A* First understand Breadth-First, Best-First, and Dijkstra algorithms These algorithms use nodes to represent candidate paths

Understanding A* class PlannerNode { public: PlannerNode *m_pParent; int m_cellX, m_cellY; ... }; The m_pParent member is used to chain nodes sequentially together to represent a path a list of absolute coordinates, instead of relative directions

Understanding A* All of the following algorithms use two lists The open list The closed list Open list keeps track of promising nodes When a node is examined from open list Taken off open list and checked to see whether it has reached the goal If it has not reached the goal Used to create additional nodes Then placed on the closed list Potentially exhaustive

Overall Structure of the Algorithms 1. Create start point node – push onto open list 2. While open list is not empty A. Pop node from open list (call it currentNode) B. If currentNode corresponds to goal, break from step 2 C. Create new nodes (successors nodes) for cells around currentNode and push them onto open list D. Put currentNode onto closed list

Breadth-First Finds a path from the start to the goal by examining the search space ply-by-ply

Breadth-First Characteristics Exhaustive search Systematic, but not clever Consumes substantial amount of CPU and memory Guarantees to find paths that have fewest number of nodes in them Not necessarily the shortest distance! Complete algorithm

Best-First Uses problem specific knowledge to speed up the search process Head straight for the goal Computes the distance of every node to the goal Uses the distance (or heuristic cost) as a priority value to determine the next node that should be brought out of the open list

Best-First (continued)

Best-First (continued) Situation where Best-First finds a suboptimal path

Best-First Characteristics Heuristic search Uses fewer resources than Breadth-First Tends to find good paths No guarantee to find most optimal path Complete algorithm

Dijkstra Disregards distance to goal Keeps track of the cost of every path No guessing Computes accumulated cost paid to reach a node from the start Uses the cost (called the given cost) as a priority value to determine the next node that should be brought out of the open list

Dijkstra Characteristics Exhaustive search At least as resource intensive as Breadth-First Always finds the optimal path Complete algorithm

A* Uses both heuristic cost and given cost to order the open list Final Cost = Given Cost + (Heuristic Cost * Heuristic Weight)

A* (continued) Avoids Best-First trap!

A* Characteristics Heuristic search On average, uses fewer resources than Dijkstra and Breadth-First Admissible heuristic guarantees it will find the most optimal path Complete algorithm

Summary Two key aspects of pathfinding: Representing the search space Searching for a path

PathPlannerApp Demo

Waypoint Graph Demo