Presentation is loading. Please wait.

Presentation is loading. Please wait.

Path Planning Part I: Search Space Representation Part II: Table Lookup Path Finder Path III: Convincing Hunting Ref: AIWisdom 2.

Similar presentations


Presentation on theme: "Path Planning Part I: Search Space Representation Part II: Table Lookup Path Finder Path III: Convincing Hunting Ref: AIWisdom 2."— Presentation transcript:

1 Path Planning Part I: Search Space Representation Part II: Table Lookup Path Finder Path III: Convincing Hunting Ref: AIWisdom 2

2 Spring 20052 Taxonomy Local path finding For dynamic environment [characters in motion, obstacles moved by characters] potential energy, steer, … Global path planning For static environment Graph-based search algorithm (Dijkstra, A*, BFS, … )

3 Spring 20053 Task Decomposition Search Space Representations: ways to define the waypoints Search Algorithms Extension: mixed with local algorithm …

4 Spring 20054 Search Space Representations Analogy: C++ STL: algorithms (sort, find, copy, … ) work on various container classes (vector, list, … ) Path finding: algorithms (BFS, DFS, Dijkstra, A*, … ) Search space representation: … Choice of representation has great impact on performance and memory overhead Assumption: 2D, or 3D hovering at fixed height Full 3D: flying, swimming characters

5 Spring 20055 Introduction All search spaces are graphs: nodes and edges Problem definition (Path Optimality): given two points A and B, find the least expensive path from A to B Remarks: not always the shortest [consider swamp] Must consider agent movement capability [size, open door, swim, climb, … ]

6 Spring 20056 Character-dependent Paths

7 Spring 20057 Search Space Generation Options: manually created by level designer Automatically generated by programs “ The AI is broken in your level because you put the path node in the wrong place …” jeopardize the workflow

8 Spring 20058 Types of Representation Regular grid (square, hexagonal) Corner graph Waypoint graph [circle-based] Space-filling volume Navigation Mesh [triangle or poly- based] Understand the pros and cons Smooth technique (string-pulling) Hierarchical representation (thousands of waypoints … )

9 Spring 20059 Example Scene

10 Spring 200510 Regular Grid Simplest way: grid of squares, rectangles, triangles, hexagons, … Large number of grid cell (large memory footprint) Easy for “ random- access lookup ”

11 Spring 200511 Regular Grid (cont) Quality of path 4-way access Allow diagonal

12 Spring 200512 String-Pulling Line-of-sight test: remove P n if P n+1 is visible from P n-1 Can be very expensive Use Catmull-Rom spline to create a smooth curved path

13 Spring 200513 Alternative: Chase the Point Instead of tracking along the path, the agent chases a target point that is moving along the path Start with the target on the path ahead of the agent At each step: Move the target along the path using linear interpolation Move the agent toward the point location, keeping it a constant distance away or moving the agent at the same speed Works best for driving or flying games

14 Spring 200514 Chase the Point Demo

15 Spring 200515 Remark Grid, though seemingly can be implemented as arrays, should be implemented as (directed) graph: path can be directional A B C D

16 Spring 200516 Corner Graph Way points placed at convex corners of the obstacles O(n 2 ) complexity to determine edges in the graph Create sub optimal path Character walk very close to the wall (unnatural) different sized character requires different set of waypoints …

17 Spring 200517 Waypoint Graph Similar to corner graph; but waypoints are usually placed in the middle of rooms and hallways Also suffer from the O(n 2 ) complexity issue Works well in human architecture; tend to work poorly in large rooms and open terrain Usually require hand-tuning by level designer to perform well

18 Spring 200518 Circle-based Waypoints Try to resolve the O(n 2 ) complexity Add to each way point a radius parameter: indicate the amount of open space around it Generate edges between node pairs whose circles overlap Works well in open terrain, but in angular environment circles may not fill well (shown in figure)

19 Spring 200519 Space-Filling Volumes Ways of generation: drop-and-grow; merge from grid Works better (cp. circle-based) for angular environment

20 Spring 200520 NavMesh Cover the game world with convex polygons Handles indoor and outdoor terrain equally well Require storage of large number of polygons Convexity is required because … Triangulation, trapezoidalization

21 Spring 200521 Modified String-Pulling Besides eliminating unnecessary points on the path, path points can move along the link (shared edge) between two nodes

22 Spring 200522 Hierarchical Representation Break the navigation problem into levels [library in NYC to a diner in Seattle] Key step: identify zones; cluster nodes in search graph Indoor scene: use portal information

23 Navigation Set Hierarchy

24 Spring 200524 Introduction Developers are spending more resources in the attempt to deliver interesting and complex AI behavior Basic functions like path-finding should be cheap Precomputing navigation accomplishes this, with a price: memory

25 Spring 200525 Basics: The Transition Table Table requires n 2 entries

26 Spring 200526 Hierarchy Navigation set: a self-contained collection of nodes that requires no links to external nodes in order to complete a path from one internal nodes to another Interface nodes: the connective boundaries between navigation sets Interface set

27 Spring 200527 Example

28 Spring 200528 Constructing the Hierarchy Partitioning by automated means is a complex problem ! Objective: keep the number of interface nodes as low as possible Identify “ choke points ”

29 Spring 200529 Complete Path Planner Source & goal in same NavSet: trivial Four-step solution Source to boundary set Tier-2 paths: interface nodes Boundary set to Target From combinations; select the one with least cost Performance depends on the number of interface nodes in the source and goal sets only

30 Spring 200530 Example A3 A6 A7 C3 C5 C7

31 Spring 200531 Memory Optimization In the transition table, instead of storing node indices (which can be large and requires more bits), store edge indices (edge that lead to the node) I doubt this will work. How to know which node a particular edge leads to?

32 Hunting Down the Player in a Convincing Manner

33 Spring 200533 Introduction Require NPCs to convincingly chase and hunt down the player When a guard has spotted the player, he begins pursuit Routing player ’ s position to a path planner generate a shortest-path may let the player feel cheated Interesting game play: lure the NPC into regions then double back to escape

34 Spring 200534 Facility: Know the positions of target player and hunting character (NPC) Visibility test from NPC to player Three scenarios Player is visible (by the NPC) Player was recently seen Player has never been seen

35 Spring 200535 Scenarios Scenario One: Change from hunting state to attack state Scenario Two: NPC moves to the last seen player location, should be stored by game engine

36 Spring 200536 Scenario Three Create intermediate destination to approach the player Generate random direction and travel distance Successive application


Download ppt "Path Planning Part I: Search Space Representation Part II: Table Lookup Path Finder Path III: Convincing Hunting Ref: AIWisdom 2."

Similar presentations


Ads by Google