Path Look-up Tables & An Overview of Navigation Systems Hai Hoang 10/4/2004.

40
Path Look-up Tables Path Look-up Tables & & An Overview of An Overview of Navigation Systems Navigation Systems Hai Hoang Hai Hoang 10/4/2004 10/4/2004

Transcript of Path Look-up Tables & An Overview of Navigation Systems Hai Hoang 10/4/2004.

Page 1: Path Look-up Tables & An Overview of Navigation Systems Hai Hoang 10/4/2004.

Path Look-up Tables &Path Look-up Tables & An Overview of An Overview of

Navigation SystemsNavigation Systems

Hai HoangHai Hoang

10/4/200410/4/2004

Page 2: Path Look-up Tables & An Overview of Navigation Systems Hai Hoang 10/4/2004.

Path Look-up Tables (2.3)Path Look-up Tables (2.3)

►Outline:Outline: Why Use Look-up Tables?Why Use Look-up Tables? 3 types of look-up tables3 types of look-up tables

►Path look-up matrixPath look-up matrix►Indexed path look-up matrix Indexed path look-up matrix ►Area-based look-up tableArea-based look-up table

Design and Performance of eachDesign and Performance of each

Page 3: Path Look-up Tables & An Overview of Navigation Systems Hai Hoang 10/4/2004.

Why Use Path-Look Up Why Use Path-Look Up Tables?Tables?

► A* is a popular path search algorithm, but A* is a popular path search algorithm, but slow.slow.

► Fastest way to find a path Fastest way to find a path NOT to search NOT to search but to look up a path from a precomputed tablebut to look up a path from a precomputed table

► Free up the CPU for other AI decisions Free up the CPU for other AI decisions ► How much faster? How much faster?

10 to 200 times faster, depending on 10 to 200 times faster, depending on implementation and terrainimplementation and terrain

► A* Explorer demoA* Explorer demo http://www.generation5.org/content/2002/ase.asphttp://www.generation5.org/content/2002/ase.asp

Page 4: Path Look-up Tables & An Overview of Navigation Systems Hai Hoang 10/4/2004.

11stst Type of Path Look-Up Type of Path Look-Up TableTable

►Using a Using a matrixmatrix For N waypoints, the matrix size is N x NFor N waypoints, the matrix size is N x N Each cell stores Each cell stores

►The next neighboring waypoint to visit on the The next neighboring waypoint to visit on the pathpath

►Or the “no path available” markerOr the “no path available” marker

To look up path from a to bTo look up path from a to b►Retrieve next neighbor nRetrieve next neighbor n00 for (a , b) for (a , b)

►Followed by next neighbor nFollowed by next neighbor n11 for (n for (n0 0 , b), b)

►Repeat until nRepeat until nii = b = b

Page 5: Path Look-up Tables & An Overview of Navigation Systems Hai Hoang 10/4/2004.

Path Look-Up Matrix ExamplePath Look-Up Matrix Example

Page 6: Path Look-up Tables & An Overview of Navigation Systems Hai Hoang 10/4/2004.

BenefitsBenefits

►Fast path retrievalFast path retrieval►Predictable path Predictable path ►Low CPU consumptionLow CPU consumption►Path retrieval performance is not Path retrieval performance is not

influenced by terrain layoutinfluenced by terrain layout Unlike A* - as efficiently with deserted Unlike A* - as efficiently with deserted

plains as with 3D mazesplains as with 3D mazes

Page 7: Path Look-up Tables & An Overview of Navigation Systems Hai Hoang 10/4/2004.

ProblemsProblems

►Hug memory consumptionHug memory consumption Increases quadratically with the number of Increases quadratically with the number of

waypointswaypoints Typically, each entry is 2 bytesTypically, each entry is 2 bytes

►For 1,000 waypoints – 2MB For 1,000 waypoints – 2MB ►For 2,000 waypoints – 8MBFor 2,000 waypoints – 8MB

►Contains only Contains only staticstatic representation of representation of terrainterrain Can only reflect Can only reflect changeschanges via an update or via an update or

patchpatch O(nO(n33) to update) to update

Page 8: Path Look-up Tables & An Overview of Navigation Systems Hai Hoang 10/4/2004.

22ndnd Type of Path Look-Up Type of Path Look-Up TableTable

► Using an Using an Indexed Path Look-up MatrixIndexed Path Look-up Matrix Reduce memory consumption by factor of 4 by:Reduce memory consumption by factor of 4 by:

►using 1 matrix to store an index, using 1 matrix to store an index, ►another to store the outgoing waypointsanother to store the outgoing waypoints

► Replace the 2 bytes “next waypoint to visit” Replace the 2 bytes “next waypoint to visit” with a 4-bit index into the waypoint list of with a 4-bit index into the waypoint list of outgoing waypointsoutgoing waypoints

► Assumption: Assumption: Reduce the waypoint graph so each waypoint Reduce the waypoint graph so each waypoint

use a maximum of only 15 outgoing waypointsuse a maximum of only 15 outgoing waypoints►By trimming away outgoing waypoints best By trimming away outgoing waypoints best

approximated by another link or via a shorter pathapproximated by another link or via a shorter path

Page 9: Path Look-up Tables & An Overview of Navigation Systems Hai Hoang 10/4/2004.

Example of Indexed Look-Up Example of Indexed Look-Up TableTable

Page 10: Path Look-up Tables & An Overview of Navigation Systems Hai Hoang 10/4/2004.

Example of Indexed Look-Up Example of Indexed Look-Up Table(cont.)Table(cont.)

Page 11: Path Look-up Tables & An Overview of Navigation Systems Hai Hoang 10/4/2004.

Memory ConsumptionMemory Consumption

►Memory consumed for the 4 bit index Memory consumed for the 4 bit index look-up matrix is:look-up matrix is: N x N x .5 (.5 byte is 4 bits)N x N x .5 (.5 byte is 4 bits)

►For the 15 outgoing waypoints look-up For the 15 outgoing waypoints look-up matrix:matrix: N x 15 x 2N x 15 x 2

►For 1,000 waypoints: 542 kbFor 1,000 waypoints: 542 kb►For 2,000 waypoints: 4 MBFor 2,000 waypoints: 4 MB

Page 12: Path Look-up Tables & An Overview of Navigation Systems Hai Hoang 10/4/2004.

Benefits and ProblemsBenefits and Problems

►Benefits:Benefits:►4 times a much terrain for the same amount 4 times a much terrain for the same amount

of memory as regular path-look up matrixof memory as regular path-look up matrix►Only about 5% reduction in performanceOnly about 5% reduction in performance► 2 to 5 times better than area-based matrix2 to 5 times better than area-based matrix

►Problem:Problem:

►Hard to update for terrain changesHard to update for terrain changes►Still grows very fastStill grows very fast

Page 13: Path Look-up Tables & An Overview of Navigation Systems Hai Hoang 10/4/2004.

33rdrd Type of Path Look-Up Type of Path Look-Up TableTable

► Using Using Area-Based look-up matrixArea-Based look-up matrix Divide terrain up into areas Divide terrain up into areas Move from area to area using portalsMove from area to area using portals Path look-up is performed on two levelsPath look-up is performed on two levels

Page 14: Path Look-up Tables & An Overview of Navigation Systems Hai Hoang 10/4/2004.

Designing Portal Path TableDesigning Portal Path Table

Page 15: Path Look-up Tables & An Overview of Navigation Systems Hai Hoang 10/4/2004.
Page 16: Path Look-up Tables & An Overview of Navigation Systems Hai Hoang 10/4/2004.

Look-Up at Top Level (pseudo-Look-Up at Top Level (pseudo-code)code)

► if (A==B) then both waypoints in the same if (A==B) then both waypoints in the same area, just look in the area tablearea, just look in the area table

► If (A!=B) - 2 different areasIf (A!=B) - 2 different areas Retrieve portal for area A , call it PaRetrieve portal for area A , call it Pa

►Stores the path from a to Pa in path[]Stores the path from a to Pa in path[] Retrieve portal for area B, call it PbRetrieve portal for area B, call it Pb Find the shortest path from Pa to PbFind the shortest path from Pa to Pb From Pa to Pb, there might be portals in betweenFrom Pa to Pb, there might be portals in between

► If there is, find path from Pa to Pi If there is, find path from Pa to Pi ►Translate the portal path into waypoints moves and add Translate the portal path into waypoints moves and add

to path[]to path[]►until Pi == Pbuntil Pi == Pb

Finally, add path from Pb to b to path[]Finally, add path from Pb to b to path[]

Problem: to move from a (in area A) to b (in area B)

Page 17: Path Look-up Tables & An Overview of Navigation Systems Hai Hoang 10/4/2004.

In Area Look-UpIn Area Look-Up

Page 18: Path Look-up Tables & An Overview of Navigation Systems Hai Hoang 10/4/2004.

BenefitsBenefits over Matrix & Indexed Look-up Tableover Matrix & Indexed Look-up Table

► Using many smaller tables, 1 for portals Using many smaller tables, 1 for portals paths, several for the path with in each area.paths, several for the path with in each area. Save lots of memory, especially for larger Save lots of memory, especially for larger

numbers of waypointsnumbers of waypoints Since look-up tables are quadratic,Since look-up tables are quadratic, aa22 + b + b22 < (a + b) < (a + b)22

►More suitable for patching to reflect changes uitable for patching to reflect changes in the terrainin the terrain Can open or close portalsCan open or close portals Patch an areaPatch an area

Page 19: Path Look-up Tables & An Overview of Navigation Systems Hai Hoang 10/4/2004.

Problems?Problems?

►Memory consumption depends on the Memory consumption depends on the quality of the area and the size of quality of the area and the size of areas interconnectionareas interconnection

►And the reason: open areasAnd the reason: open areas More memory if not partitioned wellMore memory if not partitioned well Larger area interconnections – needs Larger area interconnections – needs

more portalsmore portals Could be harder to patchCould be harder to patch

Page 20: Path Look-up Tables & An Overview of Navigation Systems Hai Hoang 10/4/2004.

Memory Consumption & Memory Consumption & Performance Relative to A*Performance Relative to A*

Page 21: Path Look-up Tables & An Overview of Navigation Systems Hai Hoang 10/4/2004.

Area-Based Look-Up Table???Area-Based Look-Up Table???

Page 22: Path Look-up Tables & An Overview of Navigation Systems Hai Hoang 10/4/2004.

Quake 3 ArenaQuake 3 Arena

► Used a technique similar to area look-up tableUsed a technique similar to area look-up table► Map is divided into convex hulls called areasMap is divided into convex hulls called areas

Minimal navigation complexity, such as walk or Minimal navigation complexity, such as walk or swimswim

Maps with 5000 or more areas are common.Maps with 5000 or more areas are common. Moving from one area to another depends on Moving from one area to another depends on

reachabilityreachability Quake uses a real-time dynamic routing algorithmQuake uses a real-time dynamic routing algorithm The routing data is caches for fast look-upThe routing data is caches for fast look-up The idea of portals are used for teleporting The idea of portals are used for teleporting

between areasbetween areas

Page 23: Path Look-up Tables & An Overview of Navigation Systems Hai Hoang 10/4/2004.

Does it make you wonder?Does it make you wonder?

►How graphics are rendered fast enough. How graphics are rendered fast enough. ►Handle multi-players – added delayHandle multi-players – added delay► CPU Time left for AI for bots CPU Time left for AI for bots

► ““If you're a fan of Quake like I am, you're If you're a fan of Quake like I am, you're surely aware that your computer is not able surely aware that your computer is not able to render that entire 3D, shadowed, textured to render that entire 3D, shadowed, textured world at 30 frames a second. But for some world at 30 frames a second. But for some reason, it appears to.” reason, it appears to.” Alex ZavatoneAlex Zavatone

► Video from:Video from: http://www.planetquake3.net/http://www.planetquake3.net/

Page 24: Path Look-up Tables & An Overview of Navigation Systems Hai Hoang 10/4/2004.

Fast graphics???Fast graphics???

►What it is doing is taking data from a What it is doing is taking data from a prerendered world and turning that prerendered world and turning that into a textured, shadowed realistic into a textured, shadowed realistic looking environment. That's possible looking environment. That's possible because the information has already because the information has already been calculated and is stored in some been calculated and is stored in some sort of look up tables. “sort of look up tables. “

Alex Zavatone Alex Zavatone

http://www.director-online.com/buildArticle.php?id=152

Page 25: Path Look-up Tables & An Overview of Navigation Systems Hai Hoang 10/4/2004.

An Overview of Navigation An Overview of Navigation Systems (2.4)Systems (2.4)

Page 26: Path Look-up Tables & An Overview of Navigation Systems Hai Hoang 10/4/2004.

Navigation SystemNavigation System

►A Navigation System is a separate A Navigation System is a separate component responsible for component responsible for synthesizing movement behaviors.synthesizing movement behaviors.

►By encapsulating navigation into a By encapsulating navigation into a component, it’s simpler to craft component, it’s simpler to craft behaviors and movements.behaviors and movements.

►Purpose is to provide modularity in AI Purpose is to provide modularity in AI programming. programming.

Page 27: Path Look-up Tables & An Overview of Navigation Systems Hai Hoang 10/4/2004.

3 Levels of Abstraction3 Levels of Abstraction

► Planner:Planner: Only the shortest path algorithm abstracted and Only the shortest path algorithm abstracted and

implemented in the navigation systemimplemented in the navigation system The agent has to make the request and interpret The agent has to make the request and interpret

the result.the result.► Pathfinder: Pathfinder:

The pathfinder would deal with the execution of The pathfinder would deal with the execution of the plansthe plans

The agent still has direct control of the pathsThe agent still has direct control of the paths► Sub-architecture:Sub-architecture:

Planning abilities and composing different Planning abilities and composing different movement behaviorsmovement behaviors

Page 28: Path Look-up Tables & An Overview of Navigation Systems Hai Hoang 10/4/2004.

Navigation InterfacesNavigation Interfaces

► Allows agent to send information to the navigation Allows agent to send information to the navigation systemsystem

► When designing the interface the programmer must When designing the interface the programmer must decide between a focused or flexible interfacedecide between a focused or flexible interface

► Existing paradigms for navigation interfaces Existing paradigms for navigation interfaces (starting with the most focused)(starting with the most focused) Single pairSingle pair: Two points are specified, the shortest path is : Two points are specified, the shortest path is

returned.returned. Weighted destinationsWeighted destinations: Can have multiple destinations, : Can have multiple destinations,

each with its own reward coefficient. each with its own reward coefficient. Spatial desiresSpatial desires: Specifying the movement by passing the : Specifying the movement by passing the

motivation from the agent to the navigation system (e.g. motivation from the agent to the navigation system (e.g. get armor or get weapon)get armor or get weapon)

Page 29: Path Look-up Tables & An Overview of Navigation Systems Hai Hoang 10/4/2004.

AI Paradigms for MovementAI Paradigms for Movement

►Reactive BehaviorsReactive Behaviors►Deliberative PlanningDeliberative Planning►Hybrid SystemsHybrid Systems

Page 30: Path Look-up Tables & An Overview of Navigation Systems Hai Hoang 10/4/2004.

AI Paradigms for MovementAI Paradigms for Movement

►Reactive Behaviors (reactive steering):Reactive Behaviors (reactive steering): Takes sensory input and performs a direct Takes sensory input and performs a direct

mapping to determine outputmapping to determine output Example: takes in local info about obstacles Example: takes in local info about obstacles

and outputs commands as to where to and outputs commands as to where to movemove

Possible behaviors include obstacles Possible behaviors include obstacles avoidance, seeking, and fleeing. avoidance, seeking, and fleeing.

Cannot handle traps ,complex layout, Cannot handle traps ,complex layout, intricate scenarios, and human-level intricate scenarios, and human-level movement with these behaviorsmovement with these behaviors

Page 31: Path Look-up Tables & An Overview of Navigation Systems Hai Hoang 10/4/2004.

AI Paradigms for Movement AI Paradigms for Movement (cont)(cont)

►Deliberative PlanningDeliberative Planning:: Reactive behaviors can’t handle Reactive behaviors can’t handle

traps ,complex layout, intricate scenarios, traps ,complex layout, intricate scenarios, and human-level movementand human-level movement

Planning can formulate suitable paths in Planning can formulate suitable paths in the world before used to solve these the world before used to solve these problemsproblems

Plans are made according to the terrain Plans are made according to the terrain representationrepresentation

Page 32: Path Look-up Tables & An Overview of Navigation Systems Hai Hoang 10/4/2004.

AI Paradigms for Movement AI Paradigms for Movement (cont)(cont)

►Hybrid Systems:Hybrid Systems: Simple obstacles can be handled by Simple obstacles can be handled by

reactive behaviors, no need to waste a lot reactive behaviors, no need to waste a lot of time on finding paths that could be of time on finding paths that could be handled straightforwardlyhandled straightforwardly

Planned is need to optimized between Planned is need to optimized between speed or quality of movementspeed or quality of movement

Solution is to use both paradigmsSolution is to use both paradigms

Page 33: Path Look-up Tables & An Overview of Navigation Systems Hai Hoang 10/4/2004.

Implementing Reactive Implementing Reactive BehaviorBehavior

►Simplest technique is steering Simplest technique is steering behaviorsbehaviors Using mathematical equations to decide Using mathematical equations to decide

where to steer nextwhere to steer next Problem with:Problem with:

►Integration of multiple behaviorsIntegration of multiple behaviors Fixed by prioritize behaviorsFixed by prioritize behaviors

►RealismRealism Fuzzy logic – blend the behaviors together to make Fuzzy logic – blend the behaviors together to make

it look more realisticit look more realistic

Page 34: Path Look-up Tables & An Overview of Navigation Systems Hai Hoang 10/4/2004.

Implementing Deliberate Implementing Deliberate PlanningPlanning

►Planning doesn’t necessary mean Planning doesn’t necessary mean searchsearch Precompute everythingPrecompute everything Use reactive approximation to build near Use reactive approximation to build near

optimal pathoptimal path Use threshold to trigger replanUse threshold to trigger replan Use D* to research the tree from A*Use D* to research the tree from A* Use quality of service algorithmUse quality of service algorithm

Page 35: Path Look-up Tables & An Overview of Navigation Systems Hai Hoang 10/4/2004.

ConclusionConclusion

►Choose the right navigation Choose the right navigation architecture is important architecture is important Improve quality of the behaviorsImprove quality of the behaviors Increase performanceIncrease performance Make it easier for Agent to integrate with Make it easier for Agent to integrate with

your navigation systemyour navigation system

Page 36: Path Look-up Tables & An Overview of Navigation Systems Hai Hoang 10/4/2004.

Examples of Navigation Examples of Navigation SystemsSystems

►PathEnginePathEngine http://www.pathengine.comhttp://www.pathengine.com

►BioGraphic Technologies AI.implantBioGraphic Technologies AI.implant http://www.biographictech.comhttp://www.biographictech.com

Page 37: Path Look-up Tables & An Overview of Navigation Systems Hai Hoang 10/4/2004.

D* AlgorithmD* Algorithm

Page 38: Path Look-up Tables & An Overview of Navigation Systems Hai Hoang 10/4/2004.

D* SimplifiedD* Simplified►S = Start stateS = Start state►G = Goal stateG = Goal state►X = Current stateX = Current state►M = Current map M = Current map

►1) Store all known, approximate, 1) Store all known, approximate, estimated, and believed information estimated, and believed information about the environment in Mabout the environment in M

►2) Let X = S2) Let X = S

Page 39: Path Look-up Tables & An Overview of Navigation Systems Hai Hoang 10/4/2004.

D* Simplified (cont.)D* Simplified (cont.)

►3) Plan an optimal path from X to G 3) Plan an optimal path from X to G using M -terminate with failure if no using M -terminate with failure if no path foundpath found

►4) Follow path found in 3 until find G or 4) Follow path found in 3 until find G or find discrepancy in M and the find discrepancy in M and the environmentenvironment

►5) Update M to include new sensor 5) Update M to include new sensor info, then go to 3 to replaninfo, then go to 3 to replan

Page 40: Path Look-up Tables & An Overview of Navigation Systems Hai Hoang 10/4/2004.

ReferencesReferences► Game AI Programming Wisdom 2Game AI Programming Wisdom 2, Steve Rabin, 2004, Steve Rabin, 2004

► The Quake III Arena BotThe Quake III Arena Bot, J. P. v. Waveren, J. P. v. Waveren http://www.kbs.twi.tudelft.nl/Publications/MSc/2001-VanWahttp://www.kbs.twi.tudelft.nl/Publications/MSc/2001-VanWa

veren-MSc.htmlveren-MSc.html

► Map-Based Strategies for Robot Navigation in Map-Based Strategies for Robot Navigation in Unknown EnvironmentsUnknown Environments , Anthony Stentz , Anthony Stentz http://www.frc.ri.cmu.edu/~axs/doc/aaai96.pdfhttp://www.frc.ri.cmu.edu/~axs/doc/aaai96.pdf

► A* Explorer demoA* Explorer demo http://www.generation5.org/content/2002/ase.asphttp://www.generation5.org/content/2002/ase.asp

► http://www.director-online.com/buildArticle.php?http://www.director-online.com/buildArticle.php?id=152id=152