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.

Slides:



Advertisements
Similar presentations
Artificial Intelligence: Knowledge Representation
Advertisements

Heuristic Search techniques
Problem solving with graph search
AI Pathfinding Representing the Search Space
Artificial Intelligence Presentation
Pathfinding AI John See 29 Nov, 13 Dec 2010.
an incremental version of A*
Pathfinding Basic Methods.
CPSC 322, Lecture 5Slide 1 Uninformed Search Computer Science cpsc322, Lecture 5 (Textbook Chpt 3.4) January, 14, 2009.
CSE 380 – Computer Game Programming Pathfinding AI
CSC 423 ARTIFICIAL INTELLIGENCE
Artificial Intelligence CGDD Artificial Intelligence Human-level intelligence - an unsolved problem AI “describes the intelligence embodied in any.
PATHFINDING WITH A* Presented by Joseph Siefers February 19 th, 2008.
Applications of Single and Multiple UAV for Patrol and Target Search. Pinsky Simyon. Supervisor: Dr. Mark Moulin.
1 AI for Computer Game Developers Finite state machines Path finding and waypoints A-Star path finding.
1 Using Search in Problem Solving Part II. 2 Basic Concepts Basic concepts: Initial state Goal/Target state Intermediate states Path from the initial.
Path-Finding with Motion Constraints Amongst Obstacles in Real Time Strategies By Jeremiah J. Shepherd Committee: Jijun Tang Roger Dougal Jason O’Kane.
MAE 552 – Heuristic Optimization Lecture 27 April 3, 2002
Using Search in Problem Solving
Research Related to Real-Time Strategy Games Robert Holte November 8, 2002.
Introduction to AI & AI Principles (Semester 1) WEEK 10 (07/08) [John Barnden’s slides only] School of Computer Science University of Birmingham, UK.
Pathfinding Algorithms Josh Palmer Rachael Beers.
Using Search in Problem Solving
Intelligent Pac-Man Ghost AI
Chapter 5.4 Artificial Intelligence: Pathfinding.
State-Space Searches.
Heuristic Search Heuristic - a “rule of thumb” used to help guide search often, something learned experientially and recalled when needed Heuristic Function.
Chapter 5.4 Artificial Intelligence: Pathfinding.
Lab 3 How’d it go?.
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 State Space of a Problem Lecture 03 ITS033 – Programming & Algorithms Asst. Prof.
1 CO Games Development 1 Week 6 Introduction To Pathfinding + Crash and Turn + Breadth-first Search Gareth Bellaby.
WAES 3308 Numerical Methods for AI
How are things going? Core AI Problem Mobile robot path planning: identifying a trajectory that, when executed, will enable the robot to reach the goal.
1 CO Games Development 1 Week 11 Search Methods Gareth Bellaby.
P ROBLEM Write an algorithm that calculates the most efficient route between two points as quickly as possible.
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.
Informed search strategies Idea: give the algorithm “hints” about the desirability of different states – Use an evaluation function to rank nodes and select.
1 Artificial Intelligence in Games Week 5 Steve Rabin TA: Chi-Hao Kuo TA: Allan.
For Monday Read chapter 4, section 1 No homework..
Review: Tree search Initialize the frontier using the starting state While the frontier is not empty – Choose a frontier node to expand according to search.
1 CO Games Development 1 Week 13 - Revision Lecture AI Revision Gareth Bellaby.
REFERENCE: “ARTIFICIAL INTELLIGENCE FOR GAMES”, IAN MILLINGTON. A* (A-STAR)
Informed Search II CIS 391 Fall CIS Intro to AI 2 Outline PART I  Informed = use problem-specific knowledge  Best-first search and its variants.
Search in State Spaces Problem solving as search Search consists of –state space –operators –start state –goal states A Search Tree is an efficient way.
1 CO Games Development 1 Week 8 A* Gareth Bellaby.
A* Reference: “Artificial Intelligence for Games”, Ian Millington.
CPSC 322, Lecture 5Slide 1 Uninformed Search Computer Science cpsc322, Lecture 5 (Textbook Chpt 3.5) Sept, 13, 2013.
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 Chapter 7 Advanced Pathfinding Techniques improving performance & quality Reference: Game Development Essentials Game Artificial Intelligence.
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.
Chapter 5.4 Artificial Intelligence: Pathfinding
Schedule for next 2 weeks
Maze Implementation, Analysis and Design to find Shortest Paths
Searching for Solutions
CIS 488/588 Bruce R. Maxim UM-Dearborn
Team 17c ****** Pathfinding
CO Games Development 1 Week 8 Depth-first search, Combinatorial Explosion, Heuristics, Hill-Climbing Gareth Bellaby.
Chap 4: Searching Techniques
CSCE 552 Spring 2009 AI (III) By Jijun Tang.
State-Space Searches.
State-Space Searches.
State-Space Searches.
Presentation transcript:

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 about the destination to direct the search A* is regarded as the best  Guaranteed to find a path if one exists  Will find the optimal path  Very efficient and fast

Command Hierarchy Strategy for dealing with decisions at different levels  From the general down to the foot soldier Modeled after military hierarchies  General directs high-level strategy  Foot soldier concentrates on combat

Dead Reckoning Method for predicting object ’ s future position based on current position, velocity and acceleration Works well since movement is generally close to a straight line over short time periods Can also give guidance to how far object could have moved Example: shooting game to estimate the leading distance

Flocking/Formation

Influence Mapping

Stack-based FSM Player escapes in combat, pop Combat off, goes to search; if not find the player, pop Search off, goes to patrol, …

Subsumption Architecture

Bayesian Networks

Blackboard Architecture Complex problem is posted on a shared communication space  Agents propose solutions  Solutions scored and selected  Continues until problem is solved Alternatively, use concept to facilitate communication and cooperation

Genetic Algorithm

Neural Networks

Artificial Intelligence: Pathfinding

PathPlannerApp Demo

Representing the Search Space Agents need to know where they can move 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  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  Radius of the path

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 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

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

Class Definition 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

Data Structures 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

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)

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 most optimal path Complete algorithm

Example

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

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

Example

Start Node and Costs F=G+H

First Move

Second Move

Cost Map

Path

Geometry Algorithms

Pathfinding with Constraints

More Example

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