Toward More Realistic Pathfinding Authored by: Marco Pinter Presentation Date: 11/17/03 Presented by: Ricky Uy.

Slides:



Advertisements
Similar presentations
Artificial Intelligence
Advertisements

Heuristic Search techniques
Traffic assignment.
Problem solving with graph search
AI Pathfinding Representing the Search Space
Greedy best-first search Use the heuristic function to rank the nodes Search strategy –Expand node with lowest h-value Greedily trying to find the least-cost.
Traveling Salesperson Problem
AVL Trees COL 106 Amit Kumar Shweta Agrawal Slide Courtesy : Douglas Wilhelm Harder, MMath, UWaterloo
Cooperative Pathfinding
Pathfinding Basic Methods.
ICS-171:Notes 4: 1 Notes 4: Optimal Search ICS 171 Summer 1999.
Problem Solving Agents A problem solving agent is one which decides what actions and states to consider in completing a goal Examples: Finding the shortest.
Solving Problems by Searching Currently at Chapter 3 in the book Will finish today/Monday, Chapter 4 next.
CSE 380 – Computer Game Programming Pathfinding AI
Generated Waypoint Efficiency: The efficiency considered here is defined as follows: As can be seen from the graph, for the obstruction radius values (200,
CPSC 322, Lecture 9Slide 1 Search: Advanced Topics Computer Science cpsc322, Lecture 9 (Textbook Chpt 3.6) January, 23, 2009.
Informed Search (no corresponding text chapter). Recall: Wanted " An algorithm and associated data structure(s) that can: 1) Solve an arbitrary 8-puzzle.
Accessing Spatial Data
MAE 552 – Heuristic Optimization Lecture 27 April 3, 2002
Find a Path s A D B E C F G Heuristically Informed Methods  Which node do I expand next?  What information can I use to guide this.
Using Search in Problem Solving
Using Search in Problem Solving
Routing 2 Outline –Maze Routing –Line Probe Routing –Channel Routing Goal –Understand maze routing –Understand line probe routing.
Chapter 5.4 Artificial Intelligence: Pathfinding.
3.0 State Space Representation of Problems 3.1 Graphs 3.2 Formulating Search Problems 3.3 The 8-Puzzle as an example 3.4 State Space Representation using.
Informed Search Strategies
Chapter 5.4 Artificial Intelligence: Pathfinding.
Graphs II Robin Burke GAM 376. Admin Skip the Lua topic.
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.
Geography and CS Philip Chan. How do I get there? Navigation Which web sites can give you turn-by-turn directions?
WAES 3308 Numerical Methods for AI
3.3 Pathfinding Design Architecture 저 자 : Dan Higgins 발표자 : 김용욱.
Introduction to search Chapter 3. Why study search? §Search is a basis for all AI l search proposed as the basis of intelligence l inference l all learning.
P ROBLEM Write an algorithm that calculates the most efficient route between two points as quickly as possible.
Content Addressable Network CAN. The CAN is essentially a distributed Internet-scale hash table that maps file names to their location in the network.
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.
A RTIFICIAL I NTELLIGENCE UNIT : 2 Search Techniques.
Informed Search Strategies Lecture # 8 & 9. Outline 2 Best-first search Greedy best-first search A * search Heuristics.
CMSC 341 B- Trees D. Frey with apologies to Tom Anastasio.
Monte-Carlo methods for Computation and Optimization Spring 2015 Based on “N-Grams and the Last-Good-Reply Policy Applied in General Game Playing” (Mandy.
For Monday Read chapter 4, section 1 No homework..
Lecture 3: Uninformed Search
Week 8 - Wednesday.  What did we talk about last time?  Level order traversal  BST delete  2-3 trees.
Computer Science CPSC 322 Lecture 6 Iterative Deepening and Search with Costs (Ch: 3.7.3, 3.5.3)
Informed Search Reading: Chapter 4.5 HW #1 out today, due Sept 26th.
Problem Reduction So far we have considered search strategies for OR graph. In OR graph, several arcs indicate a variety of ways in which the original.
Modifying A* Pathfinding for Video Games By: David Gelhardt.
AVL Trees and Heaps. AVL Trees So far balancing the tree was done globally Basically every node was involved in the balance operation Tree balancing can.
A* optimality proof, cycle checking CPSC 322 – Search 5 Textbook § 3.6 and January 21, 2011 Taught by Mike Chiang.
CSCI 4310 Lecture 4: Search 2 – Including A*. Book Winston Chapters 4,5,6.
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.
Adversarial Search 2 (Game Playing)
8/3/2007CMSC 341 BTrees1 CMSC 341 B- Trees D. Frey with apologies to Tom Anastasio.
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.
Chapter 3 Solving problems by searching. Search We will consider the problem of designing goal-based agents in observable, deterministic, discrete, known.
Review: Tree search Initialize the frontier using the starting state
Chapter 5.4 Artificial Intelligence: Pathfinding
Heuristic Search Introduction to Artificial Intelligence
B- Trees D. Frey with apologies to Tom Anastasio
CS Fall 2016 (Shavlik©), Lecture 10, Week 6
BEST FIRST SEARCH -OR Graph -A* Search -Agenda Search CSE 402
CO Games Development 1 Week 8 Depth-first search, Combinatorial Explosion, Heuristics, Hill-Climbing Gareth Bellaby.
Heuristic Search Methods
Introducing Underestimates
Efficiently Estimating Travel Time
HW 1: Warmup Missionaries and Cannibals
More advanced aspects of search
HW 1: Warmup Missionaries and Cannibals
Reading: Chapter 4.5 HW#2 out today, due Oct 5th
Presentation transcript:

Toward More Realistic Pathfinding Authored by: Marco Pinter Presentation Date: 11/17/03 Presented by: Ricky Uy

Background – A* Commonly used in video games Finds a path from start to goal, if one exists Finds optimal path given that the heuristic is an underestimate, i.e. always <= actual cheapest path cost from a node X to the goal

Background – A* Algorithm 1.Repeatedly examines the most promising unexplored location it has seen 2.If an examined location is the goal, algorithm is complete; else, note all neighboring locations for further exploration

Background – A* Algorithm Uses “Open” and “Closed” states for unexamined and examined nodes “Open” is a priority queue Priority determined by whatever the path is trying to minimize, e.g. distance traveled Total cost = actual cost from start to node X + heuristic cost from X to goal

Background – A* Algorithm Initially only the start location is in Open, with start.parent = null Pop node off Open and examine it Place node into Closed list All unblocked neighbors updated and placed into Open queue If Open list becomes empty before goal is found, there is no path from the start to the goal location

Background – A* Demo – taken from an article by Bryan Stout in Game Programming Gems

Background – A* Limitations Worst case time: when there is no path from start to goal Produces zigzag effect Does not produce smooth turns Does not check for “illegal moves” or for abrupt turning when a unit has a particular turning radius Memory limitations: huge number of nodes in Open and Closed lists

Background – A* Optimizations Hierarchical pathfinding, albeit subject to path failure by choosing impossible locations as midpoints Use a basic non-priority list with previous and next pointers instead of a priority queue Loses on search time: O(n) compared to O(log n), but wins on insertions and deletions

Removing the Zigzag Effect Can just associate a cost with each turn, but that does not solve the problem entirely. A better smoothing process is to remove as many waypoints as possible.

Removing the Zigzag Effect checkPoint = starting point of path currentPoint = next point in path while (currentPoint->next != NULL) if Walkable(checkPoint, currentPoint->next) // Make a straight path between those points: temp = currentPoint currentPoint = currentPoint->next delete temp from the path else checkPoint = currentPoint currentPoint = currentPoint->next

Removing the Zigzag Effect Checks path from waypoint to waypoint. If the path traveled intersects a blocked location, the waypoint is not removed. Otherwise, remove the waypoint. Leaves “impossible” sections as is.

Adding Realistic Turns Want to be aware of a unit’s turning radius and choose shortest route to destination, in this case the right turn will lead to the shortest route.

Adding Realistic Turns Calculate the length of the arc plus the line segment for both left and right turns. Shortest path is the one to use.

Adding Legal Turns Several Postprocess Solutions (cheats) Ignore blocked tiles – obviously bad Path recalculations – associate a byte with each tile, each bit denoting the surrounding tiles as legal or illegal; may invalidate legal paths from other directions = bad Decrease turning radius until it is legal – bad for units with constant turning radius (e.g. truck), good for units such as people Backing up – make a three point turn – good for units such as trucks, weird for people

Adding Legal Turns Problems Methods shown previously are basically cheats, except for the second one (path recalculations), which can fail to find valid paths How can we make sure that paths taken are both legal and do not violate the turning radius?

Directional A* Sometimes the only legal path that does not violate the turning radius constraints is completely different from the path that the standard A* algorithm produces. To get around this, Pinter proposes a modification known as Directional A*.

Directional A* First things first Add an orientation associated with each node, where the orientation can be any one of the eight compass directions Each node now represented by three dimensions: [x, y, orientation]

Directional A* Check the path from a parent to a child node, not just whether or not the child is a blocked tile Consider the orientation at parent and child nodes as well as the turning radius and size of the unit to see if path hits any blocked tiles Result: a valid path given the size and turning radius of the unit

Directional A* Directional A* does not go directly from a to c because it sees that an abrupt right turn would cause the unit to hit blocked tiles. Thus, waypoint b is found as the shortest legal path.

Directional A* Problem: adding an end orientation Four common paths

Directional A* Can easily compute the four common paths and choose the shortest one Can add smoothing algorithm presented earlier, with the modification of sampling points along a valid curve between two points rather than just a straight line between two points

Expanding the Search So far, have been using a Directional-8 search Some paths will fail under this method Try searching more than one tile away Directional-24: search two tiles away, rarely fails to find a valid path Directional-48: search three tiles away, almost never fails to find a valid path

Expanding the Search Example of a case where Directional-8 fails, but Directional-24 finds a valid path

Modifying the Heuristic Standard A* measures straight line distance from start to goal Modify so that it measures the shortest curve and line segment as calculated earlier, considering turn radius If units can go in reverse, consider adding a cost penalty to encourage units to move in reverse only when necessary

Directional A* Limitations Very slow, constantly uses tables as a means to optimize it (directional table, heuristic table, hit-check table, etc) Directional-48 may still possibly (though rarely) fail The four common paths from origin to destination are not the only ones; there is an infinite number of paths

Better Smoothing Algorithm Previous method of removing waypoints has some faults

Better Smoothing Algorithm Perform standard A* algorithm Then, perform Directional-48 algorithm that favors the path found by the standard A* algorithm by modifying the cost heuristic Finally, perform the smoothing algorithm described earlier (removing waypoints) This will find the blue line path on the previous slide

Limitations on Better Smoothing Algorithm Fails to find valid paths that a full Directional-48 search would find

Limitations on Better Smoothing Algorithm Does not find blue line path because of its bias towards the original path Ends up not finding any path at all To help performance in this worst case scenario, return failure if six or more points have been searched backwards

More Optimizations Timeslice the search Only use Directional-24 and -48 if a Directional-8 fails Divide map into regions and pre- compute whether a tile in one region can reach a tile in another Use two matrices to calculate intermediate search results, one for slow, timesliced searches and the other for faster searches

One Possible Hybrid Solution Perform standard A* search, checking only four tiles at every node Perform Smoothing-48 pass; if successful, skip to last step, otherwise note farthest node hit Work backwards from goal using Smoothing-48 pass and note farthest node hit Take the two farthest point nodes and make sure they are less than, but close to, 12 tiles apart. If more than 12 tiles, return failure. Perform Directional-8 between the two nodes and connect the three segments into one path Perform the initial simple smoothing algorithm (the one that removes unnecessary waypoints)

One Possible Hybrid Solution

Speed and Other Considerations For sand, add a cost to the heuristic For speed, add a cost for turns made

Summary Directional A* finds legal paths and realistic turns Directional A* is slow Examples only take into account a 2D space partitioned into a grid, but can be extended to support various partitioning methods in 2D or 3D Suggest standard A* for most units and Directional A* for various large units

Questions?