General Pathfinding: Tables and Navigation Jeremy Christman.

Slides:



Advertisements
Similar presentations
Artificial Intelligent
Advertisements

Airline Schedule Optimization (Fleet Assignment I)
Informed search algorithms
Review: Search problem formulation
Heuristic Search techniques
CHAPTER OBJECTIVE: NORMALIZATION THE SNOWFLAKE SCHEMA.
Problem solving with graph search
Introduction to Algorithms Quicksort
AI Pathfinding Representing the Search Space
February 12, 2007 WALCOM '2007 1/22 DiskTrie: An Efficient Data Structure Using Flash Memory for Mobile Devices N. M. Mosharaf Kabir Chowdhury Md. Mostofa.
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.
P3 / 2004 Register Allocation. Kostis Sagonas 2 Spring 2004 Outline What is register allocation Webs Interference Graphs Graph coloring Spilling Live-Range.
Navigation Set Hierarchy Tom Gianos Chapter 2.2. Mike Dickheiser Works (worked?) for Red Storm Entertainment Works (worked?) for Red Storm Entertainment.
Problem Solving by Searching Copyright, 1996 © Dale Carnegie & Associates, Inc. Chapter 3 Spring 2007.
Pathfinding Basic Methods.
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
Lecture 11 CSS314 Parallel Computing
© Karen Miller, What do we want from our computers?  correct results we assume this feature, but consider... who defines what is correct?  fast.
Data Structures Data Structures Topic #13. Today’s Agenda Sorting Algorithms: Recursive –mergesort –quicksort As we learn about each sorting algorithm,
Technical Advisor : Mr. Roni Stern Academic Advisor : Dr. Meir Kalech Team members :  Amit Ofer  Liron Katav Project Homepage :
Computer ArchitectureFall 2007 © November 14th, 2007 Majd F. Sakr CS-447– Computer Architecture.
MAE 552 – Heuristic Optimization Lecture 27 April 3, 2002
Prof. Bodik CS 164 Lecture 171 Register Allocation Lecture 19.
MAE 552 – Heuristic Optimization Lecture 26 April 1, 2002 Topic:Branch and Bound.
Register Allocation (via graph coloring)
Register Allocation (via graph coloring). Lecture Outline Memory Hierarchy Management Register Allocation –Register interference graph –Graph coloring.
1 Liveness analysis and Register Allocation Cheng-Chia Chen.
Computer ArchitectureFall 2008 © November 3 rd, 2008 Nael Abu-Ghazaleh CS-447– Computer.
4/29/09Prof. Hilfinger CS164 Lecture 381 Register Allocation Lecture 28 (from notes by G. Necula and R. Bodik)
Chapter 5.4 Artificial Intelligence: Pathfinding.
Dynamic Programming Introduction to Algorithms Dynamic Programming CSE 680 Prof. Roger Crawfis.
Tree-Structured Indexes. Range Searches ``Find all students with gpa > 3.0’’ –If data is in sorted file, do binary search to find first such student,
Game Trees: MiniMax strategy, Tree Evaluation, Pruning, Utility evaluation Adapted from slides of Yoonsuck Choe.
Chapter 5.4 Artificial Intelligence: Pathfinding.
Minimax Trees: Utility Evaluation, Tree Evaluation, Pruning CPSC 315 – Programming Studio Spring 2008 Project 2, Lecture 2 Adapted from slides of Yoonsuck.
Network Aware Resource Allocation in Distributed Clouds.
1 CO Games Development 1 Week 6 Introduction To Pathfinding + Crash and Turn + Breadth-first Search Gareth Bellaby.
WAES 3308 Numerical Methods for AI
Path Planning Part I: Search Space Representation Part II: Table Lookup Path Finder Path III: Convincing Hunting Ref: AIWisdom 2.
8.4 paging Paging is a memory-management scheme that permits the physical address space of a process to be non-contiguous. The basic method for implementation.
Cosc 2150: Computer Organization Chapter 6, Part 2 Virtual Memory.
Chapter 8 – Main Memory (Pgs ). Overview  Everything to do with memory is complicated by the fact that more than 1 program can be in memory.
Sorting – Insertion and Selection. Sorting Arranging data into ascending or descending order Influences the speed and complexity of algorithms that use.
Neural Networks and Machine Learning Applications CSC 563 Prof. Mohamed Batouche Computer Science Department CCIS – King Saud University Riyadh, Saudi.
Review 1 Selection Sort Selection Sort Algorithm Time Complexity Best case Average case Worst case Examples.
Path Look-up Tables & An Overview of Navigation Systems Hai Hoang 10/4/2004.
Pathfinding and Movement Michael Moll September 29, 2004.
1 Lecture 8: Virtual Memory Operating System Fall 2006.
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.
Graphs. Graph Definitions A graph G is denoted by G = (V, E) where  V is the set of vertices or nodes of the graph  E is the set of edges or arcs connecting.
The NP class. NP-completeness Lecture2. The NP-class The NP class is a class that contains all the problems that can be decided by a Non-Deterministic.
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.
Understanding AI of 2 Player Games. Motivation Not much experience in AI (first AI project) and no specific interests/passion that I wanted to explore.
Maestro AI Vision and Design Overview Definitions Maestro: A naïve Sensorimotor Engine prototype. Sensorimotor Engine: Combining sensory and motor functions.
Author : Tzi-Cker Chiueh, Prashant Pradhan Publisher : High-Performance Computer Architecture, Presenter : Jo-Ning Yu Date : 2010/11/03.
CMPT 438 Algorithms.
Chapter 5.4 Artificial Intelligence: Pathfinding
Virtual memory.
Chapter 2 Memory and process management
Schedule for next 2 weeks
Navigation In Dynamic Environment
CIS 488/588 Bruce R. Maxim UM-Dearborn
Introduction to Artificial Intelligence Lecture 9: Two-Player Games I
Sorting "There's nothing in your head the sorting hat can't see. So try me on and I will tell you where you ought to be." -The Sorting Hat, Harry Potter.
CSCE 552 Spring 2009 AI (III) By Jijun Tang.
Graphs.
Presentation transcript:

General Pathfinding: Tables and Navigation Jeremy Christman

Introduction: Why Pathfinding and Navigation Systems are Important Pathfinding provides a basis for every navigation system; lookup tables are the fastest way to find the best path from a starting point to a destination Navigation systems are necessary for fluid movement and animation; they are also a necessary part of what makes agents intelligent, it tells them where to go based on information about the environment Agents on the players side would quickly frustrate the player and slow him down a lot whereas the enemies would be too easy Thus, it is important for AI programmers to understand pathfinding and navigation for agents in these increasingly complex games and environments

Memory Capacity

The Power of Game Computing and Its Consequences Every year, computers are made with more and more memory This makes for bigger and bigger maps in games Much effort must be spent on pathfinding which could be better utilized elsewhere The amount of memory gained goes into the bigger maps and unfortunately a lot of it must be spent on navigation

How Nodes are Generated

The First Step: Simplify The Search Area By breaking the search area into a grid as shown above, it is possible to form a simple two dimensional array Nodes can actually be any shape one wants; they are very versatile

One Basic Pathfinding Tool: The Transition Table Each generalized position on the map is represented by a node in a graph Each path to get there is represented by an edge The mapping of edges to nodes is called a navigation map The mapping of a source node to the optimal node to get to a goal node is called a transition table

The Fastest Way to Find a Path Recall the A* algorithm It is an informed search that is better suited than the greedy algorithm In summary, it is optimal, complete, and efficient if the heuristic is admissible Although A* is an excellent pathfinding algorithm, it is faster to look up a path from a table than to search for it Pathfinding can be made exponentially faster with lookup tables than with any searching algorithm

Review of Searching Algorithms TypeOrderingOptimal?Complete?Efficient? Depth FirstUninformedLIFONo If lucky Breadth FirstUninformedFIFOIf step costs are identical YesNo Uniform CostUninformedg(n)If step cost>0 No GreedyInformedh(n)No Usually A*Informedg(n)+h(n)If heuristic is admissible Yes

Using the Table Recursively to Find the Correct Path Simply use the lookup table to match the node you start with to the goal node If the node you get is not the goal node, repeat the process with that node instead while(source != goal) {source=transition_table[source][goal]; path.push_back(source); }

The Downfall….. The map and table previously shown were simple: they required almost no thought Unfortunately, due to growing map sizes, these navigation nodes could contain thousands of nodes Since the table is of O(n 2 ), millions of cells of the table must be generated All in all, this method is not very effective A way to reduce search space would be very helpful

Summary: Monolithic vs. Hierarchical Total NodesNavigation SetsTransition Table Entries Monolithic Map (21) 2 Hierarchical Map ( ) PartitionsTransition Table Entries Interface Nodes Interface Table Entries Total Table Entries 1 (monolith)1,000 2 =1,000,000001,000,000 22*500 2 =500, ,100 55*200 2 =200, , *100 2 =100,000502,500102, *20 2 =20, ,50082,500

An Important Goal for Hierarchical Pathfinding Choke points are small collections of nodes that connects two larger collections of nodes All paths coming to and from each partition must enter and exit through one of the choke points A big issue is to try to use the least number of choke points as possible This results in the final interface table being as small as possible which saves memory The fewer interface nodes there are, the faster the pathfinding process will be because there are less paths to consider

Applying the Hierarchical Approach Inner set pathfinding is trivial: it is no different from the monolithic approach Inter set pathfinding is more difficult and requires four steps 1. Determine the best path from the source node to the choke point. This is no different from the monolithic approach 2. Determine the best path from the boundary of the source set to the boundary of the destination set 3. Determine the best path from the boundary of the destination set to the destination node 4. Create a list of all possible paths from the first three steps and choose the minimal path

Is It Really Worth the Effort? Many different paths and path costs to consider; one may wonder if this really is better than a monolithic pathfinding case However, it turns out that the number of paths that must be searched is ENTIRELY dependant on how many interface nodes there are in the source and goal sets Thus, maps can be big and complicated, but if there are a limited number of interface nodes, the cost of the set path will still be very small The growth involved is so small that big maps can be made with ease of pathfinding as long as their boundary nodes are kept to a limited size

Specialized Benefits of Hierarchical Pathfinding Heterogeneous regions: Different navigation regions such as vehicle games with pedestrian areas. Since each region can be represented by its own pathfinding solution, the modular nature can be perfectly implemented by choke points Data on Demand: Lends itself easily to the fact that only certain parts of the map may be available in memory at any one time; a navigation set often provides all the data that is needed Extension: So far only a two-tiered example was provided, but more tiers may be required to handle much larger maps. The modular nature of the hierarchy easily lends itself to higher tiers Ease of Implementation: A minimal amount of work may be required to place the nodes into sets, but it is fairly trivial compared to the amount of memory saved which could be better used on other aspects of the game

Disadvantages to Lookup Tables As previously stated, looking up information on a table is faster than searching for a path However, any changes made to terrain on maps may be difficult to change on tables Look up tables are generally not good for representing variable movement capabilities Although memory use can be optimized, on average it is still much greater than the A* search even if it is faster

Pathfinding Comparisons Pathfinding Approach Memory Use Optimized A*32KB Path Look-Up Matrix4572KB Area-based look-up Table 274KB

Path Look Up Matrices: A Monolithic Example Advantages: This is the absolute fastest way to find the shortest path. It works just as well on a flat field as it does on a maze. Disadvantages: For n waypoints or nodes, the matrix will be n by n; again, this is O(n 2 ). This by far uses the most memory. Also, static memory is used, this will reflect poorly with changes to the environment. It may take O(n 3 ) to fix environmental changes!

Area Based Path Look Up Tables: A Hierarchical Example

Example of Areas and Portals

Systems of Navigation The definition of a navigation system varies among developers, but the most basic can be thought of as a separate component responsible for synthesizing movement behaviors Software engineering tells us that modularization makes for the ease of testing each unit separately and independently Two important components of Navigation Systems: Interfaces and Movement Paradigms: decisions must be made based on circumstances

Abstraction It is often unclear how much responsibility the navigation system puts on pathfinding It can often be grouped to three categories Planner: the agent makes the path request and uses the result Pathfinder: trusts the navigation system a bit more, can now make decisions based on paths, but the tedious computations are already done for it Sub-Architecture: trust the navigation system to find the shortest path with movement behaviors