Top Banner
Navigation Set Navigation Set Hierarchy Hierarchy Tom Gianos Tom Gianos Chapter 2.2 Chapter 2.2
26

Navigation Set Hierarchy Tom Gianos Chapter 2.2. Mike Dickheiser Works (worked?) for Red Storm Entertainment Works (worked?) for Red Storm Entertainment.

Dec 14, 2015

Download

Documents

Lyric Cauthorn
Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
Page 1: Navigation Set Hierarchy Tom Gianos Chapter 2.2. Mike Dickheiser Works (worked?) for Red Storm Entertainment Works (worked?) for Red Storm Entertainment.

Navigation Set Navigation Set HierarchyHierarchy

Tom GianosTom Gianos

Chapter 2.2Chapter 2.2

Page 2: Navigation Set Hierarchy Tom Gianos Chapter 2.2. Mike Dickheiser Works (worked?) for Red Storm Entertainment Works (worked?) for Red Storm Entertainment.

Mike DickheiserMike Dickheiser

Works (worked?) for Red Storm Works (worked?) for Red Storm EntertainmentEntertainment Part of UbisoftPart of Ubisoft Developer of Tom Clancy Games like Developer of Tom Clancy Games like

Ghost Recon and Rainbow SixGhost Recon and Rainbow Six His work focuses on efficient AI His work focuses on efficient AI

systems for games and AI control of systems for games and AI control of highly realistic vehicleshighly realistic vehicles

Page 3: Navigation Set Hierarchy Tom Gianos Chapter 2.2. Mike Dickheiser Works (worked?) for Red Storm Entertainment Works (worked?) for Red Storm Entertainment.

Problem With Dynamic Problem With Dynamic PathfindingPathfinding

Dynamic pathfinding acts as CPU hogDynamic pathfinding acts as CPU hog

Blocks the development of more Blocks the development of more exciting AI features by wasting CPU exciting AI features by wasting CPU cyclescycles

Solution: Solution: Precompute navigation informationPrecompute navigation information

Page 4: Navigation Set Hierarchy Tom Gianos Chapter 2.2. Mike Dickheiser Works (worked?) for Red Storm Entertainment Works (worked?) for Red Storm Entertainment.

Issues with Issues with PrecomputationPrecomputation

Levels/maps of games today are Levels/maps of games today are massivemassive

Could contain thousands of nodesCould contain thousands of nodes Precomputed navigation information Precomputed navigation information

could take up massive amounts of could take up massive amounts of memorymemory

Solution:Solution: Navigation Set HierarchyNavigation Set Hierarchy

Page 5: Navigation Set Hierarchy Tom Gianos Chapter 2.2. Mike Dickheiser Works (worked?) for Red Storm Entertainment Works (worked?) for Red Storm Entertainment.

What is Navigation Set What is Navigation Set Hierarchy?Hierarchy?

A multitier extension of the basic A multitier extension of the basic preprocessed navigation solution preprocessed navigation solution with comparable speed and with comparable speed and considerably less memory overheadconsiderably less memory overhead

Page 6: Navigation Set Hierarchy Tom Gianos Chapter 2.2. Mike Dickheiser Works (worked?) for Red Storm Entertainment Works (worked?) for Red Storm Entertainment.

What is the basic What is the basic precomputed solution?precomputed solution?

Basic component is a lookup table Basic component is a lookup table (called a transition or solution table) (called a transition or solution table) where each entry represents the next where each entry represents the next step between a source node and a goal step between a source node and a goal nodenode

In other words, for every pair of nodes In other words, for every pair of nodes Source and Goal, the entry [S][G] Source and Goal, the entry [S][G] represents the node that should be represents the node that should be visited nextvisited next

Page 7: Navigation Set Hierarchy Tom Gianos Chapter 2.2. Mike Dickheiser Works (worked?) for Red Storm Entertainment Works (worked?) for Red Storm Entertainment.

A Simple ExampleA Simple Example

Table Size = n2

Page 8: Navigation Set Hierarchy Tom Gianos Chapter 2.2. Mike Dickheiser Works (worked?) for Red Storm Entertainment Works (worked?) for Red Storm Entertainment.

Simple CodeSimple Code

Void buildBestPath(int source, int goal, list<int>& Void buildBestPath(int source, int goal, list<int>& path)path)

{{path.push_back(source);path.push_back(source);

while(source != goal)while(source != goal){{

source = _transitionTable[source][goal];source = _transitionTable[source][goal];path.push_back(source);path.push_back(source);

}}}}

Page 9: Navigation Set Hierarchy Tom Gianos Chapter 2.2. Mike Dickheiser Works (worked?) for Red Storm Entertainment Works (worked?) for Red Storm Entertainment.

Navigation SetsNavigation Sets

Transform the single monolithic Transform the single monolithic navigation map into a hierarchy of navigation map into a hierarchy of several smaller sub-maps called several smaller sub-maps called navigation setsnavigation sets

Navigation Set:Navigation Set: A self contained collection of nodes that A self contained collection of nodes that

requires no links to external nodes in order requires no links to external nodes in order to complete a path from one internal node to complete a path from one internal node to anotherto another

A complete precomputed transition table A complete precomputed transition table can be constructed for each navigation setcan be constructed for each navigation set

Page 10: Navigation Set Hierarchy Tom Gianos Chapter 2.2. Mike Dickheiser Works (worked?) for Red Storm Entertainment Works (worked?) for Red Storm Entertainment.

Interface Nodes and the Interface Nodes and the Interface Navigation SetInterface Navigation Set

Once the monolithic map is broken up into Once the monolithic map is broken up into navigation sets a problem that arises is navigation sets a problem that arises is cross set navigationcross set navigation

To solve this, identify all nodes in the To solve this, identify all nodes in the navigation sets that connect to nodes in navigation sets that connect to nodes in other navigation sets (Interface Nodes)other navigation sets (Interface Nodes)

These navigation nodes together create These navigation nodes together create their own second level navigation set their own second level navigation set called an Interface Set Transition table called an Interface Set Transition table and hence the Navigation Set Hierarchyand hence the Navigation Set Hierarchy

Page 11: Navigation Set Hierarchy Tom Gianos Chapter 2.2. Mike Dickheiser Works (worked?) for Red Storm Entertainment Works (worked?) for Red Storm Entertainment.

Navigation Set Hierarchy Navigation Set Hierarchy ExampleExample

Monolithic Map = 441 transition table entries (212), 21 Nodes, 1 Navigation Set

Hierarchical Map = 183 transition table entries (72 + 72 + 72 + 62)Memory overhead reduced 60%

Page 12: Navigation Set Hierarchy Tom Gianos Chapter 2.2. Mike Dickheiser Works (worked?) for Red Storm Entertainment Works (worked?) for Red Storm Entertainment.

Constructing the Constructing the HierarchyHierarchy

Key goals for deconstructing single Key goals for deconstructing single large transition table into navigation large transition table into navigation sets:sets: Determining the number of smaller Determining the number of smaller

tables to createtables to create Intelligently choosing where to partition Intelligently choosing where to partition

to minimize number of interface nodesto minimize number of interface nodes

Page 13: Navigation Set Hierarchy Tom Gianos Chapter 2.2. Mike Dickheiser Works (worked?) for Red Storm Entertainment Works (worked?) for Red Storm Entertainment.

Selecting the Number of Selecting the Number of Navigation SetsNavigation Sets

Depends on the resources of the projectDepends on the resources of the project In breaking up a monolithic map into n In breaking up a monolithic map into n

equal-sized partitions, reduce data size to equal-sized partitions, reduce data size to 1/n of the original size plus the interface set1/n of the original size plus the interface set

Once size of partition is chosen designers Once size of partition is chosen designers can control the number of interface nodes can control the number of interface nodes and thus the size of the interface setand thus the size of the interface set

If the interface nodes are chosen wisely If the interface nodes are chosen wisely navigation sets can become larger and the navigation sets can become larger and the relative cost of the interface sets will relative cost of the interface sets will become smallerbecome smaller

Page 14: Navigation Set Hierarchy Tom Gianos Chapter 2.2. Mike Dickheiser Works (worked?) for Red Storm Entertainment Works (worked?) for Red Storm Entertainment.

Partitioning a 1000-node Partitioning a 1000-node MapMap

PartitioPartitionsns

Transition Transition Table EntriesTable Entries

InterfacInterface Nodese Nodes

InterfacInterface Table e Table EntriesEntries

Total Table Total Table EntriesEntries

11 1000100022 = = 1,000,0001,000,000

00 00 1,000,0001,000,000

22 2*5002*50022 = = 500,000500,000

1010 100100 500,100500,100

55 5*2005*20022 = = 200,000200,000

2525 625625 200,625200,625

1010 10*10010*10022 = = 100,000100,000

5050 25002500 102,500102,500

5050 50*2050*2022 = = 20,00020,000

250250 62,50062,500 82,50082,500

Page 15: Navigation Set Hierarchy Tom Gianos Chapter 2.2. Mike Dickheiser Works (worked?) for Red Storm Entertainment Works (worked?) for Red Storm Entertainment.

Selecting the Partition Selecting the Partition BoundariesBoundaries

Keeping the number of interface nodes as Keeping the number of interface nodes as low as possible is the number one goal for low as possible is the number one goal for two reasons:two reasons: Fewer interface nodes results in a smaller Fewer interface nodes results in a smaller

interface table size, saving memoryinterface table size, saving memory Fewer interface nodes there are per set the Fewer interface nodes there are per set the

faster the pathfinding process will befaster the pathfinding process will be Identify natural choke points in navigation Identify natural choke points in navigation

data, a small collection of nodes that data, a small collection of nodes that single-handedly connect to larger single-handedly connect to larger collection of nodescollection of nodes

If natural choke points do not present If natural choke points do not present themselves then modify the mapthemselves then modify the map

Page 16: Navigation Set Hierarchy Tom Gianos Chapter 2.2. Mike Dickheiser Works (worked?) for Red Storm Entertainment Works (worked?) for Red Storm Entertainment.

Choke Point DemoChoke Point Demo

Page 17: Navigation Set Hierarchy Tom Gianos Chapter 2.2. Mike Dickheiser Works (worked?) for Red Storm Entertainment Works (worked?) for Red Storm Entertainment.

The Complete Pathfinding The Complete Pathfinding SolutionSolution

If source and goal nodes are in the If source and goal nodes are in the same navigation set, the process is same navigation set, the process is the same as beforethe same as before

Inter-set pathfinding requires more Inter-set pathfinding requires more workwork

4 step process4 step process

Page 18: Navigation Set Hierarchy Tom Gianos Chapter 2.2. Mike Dickheiser Works (worked?) for Red Storm Entertainment Works (worked?) for Red Storm Entertainment.

The 4 StepsThe 4 Steps 1) Determine the best paths leading from 1) Determine the best paths leading from

the source node to the boundary of the the source node to the boundary of the source set (interface nodes)source set (interface nodes)

2) Determine the best path from the source 2) Determine the best path from the source set boundary to the goal set boundaryset boundary to the goal set boundary

3) Determine the best paths from the goal 3) Determine the best paths from the goal set boundary (interface nodes) to the goal set boundary (interface nodes) to the goal nodenode

4) create a list of complete paths 4) create a list of complete paths assembled from the first three steps and assembled from the first three steps and chose path with the least costchose path with the least cost

Page 19: Navigation Set Hierarchy Tom Gianos Chapter 2.2. Mike Dickheiser Works (worked?) for Red Storm Entertainment Works (worked?) for Red Storm Entertainment.

Example going from A3 Example going from A3 to C7to C7

Page 20: Navigation Set Hierarchy Tom Gianos Chapter 2.2. Mike Dickheiser Works (worked?) for Red Storm Entertainment Works (worked?) for Red Storm Entertainment.

Transition TablesTransition Tables

Page 21: Navigation Set Hierarchy Tom Gianos Chapter 2.2. Mike Dickheiser Works (worked?) for Red Storm Entertainment Works (worked?) for Red Storm Entertainment.

Example Step 1Example Step 1

SourceSource GoalGoal Sub-pathSub-path CostCost

A3A3 A6A6 A3, A6A3, A6 1010

A3A3 A7A7 A3, A6, A3, A6, A7A7

2020

Using transition table for set A, find the Using transition table for set A, find the best paths leading from A3 to the best paths leading from A3 to the boundary set of A (A6 and A7).boundary set of A (A6 and A7).

Page 22: Navigation Set Hierarchy Tom Gianos Chapter 2.2. Mike Dickheiser Works (worked?) for Red Storm Entertainment Works (worked?) for Red Storm Entertainment.

Example Step 2Example Step 2

Using the interface node transition table, find the Using the interface node transition table, find the best paths leading from the boundary set of A (A6 best paths leading from the boundary set of A (A6 and A7) to the boundary set of C (C3 and C5)and A7) to the boundary set of C (C3 and C5)

In other words, the best path from each interface In other words, the best path from each interface node in one set to each interface node in the other node in one set to each interface node in the other setset

SourceSource GoalGoal Sub-PathSub-Path CostCost

A6A6 C3C3 A6, A7, C3A6, A7, C3 2020

A6A6 C5C5 A6, B2, C5A6, B2, C5 2222

A7A7 C3C3 A7, C3A7, C3 1010

A7A7 C5C5 A7, C3, C5A7, C3, C5 2020

Page 23: Navigation Set Hierarchy Tom Gianos Chapter 2.2. Mike Dickheiser Works (worked?) for Red Storm Entertainment Works (worked?) for Red Storm Entertainment.

Example Step 3Example Step 3

Best path from boundary set of C to goal Best path from boundary set of C to goal node C7node C7

Opposite of Step 1Opposite of Step 1

SourceSource GoalGoal Sub-pathSub-path CostCost

C3C3 C7C7 C3, C5, C3, C5, C7C7

2020

C5C5 C7C7 C5, C7C5, C7 1010

Page 24: Navigation Set Hierarchy Tom Gianos Chapter 2.2. Mike Dickheiser Works (worked?) for Red Storm Entertainment Works (worked?) for Red Storm Entertainment.

Example Step 4Example Step 4

Determine all distinct paths that can be Determine all distinct paths that can be generated from source to goal by generated from source to goal by combining results of steps 1-3 and choose combining results of steps 1-3 and choose path with the least costpath with the least cost

PathPath CostCost

A3, A6, A7, C3, C5, A3, A6, A7, C3, C5, C7C7

5050

A3, A6, B2, C5, C7A3, A6, B2, C5, C7 4242

Page 25: Navigation Set Hierarchy Tom Gianos Chapter 2.2. Mike Dickheiser Works (worked?) for Red Storm Entertainment Works (worked?) for Red Storm Entertainment.

Possible Performance Possible Performance Issues?Issues?

Does 4 step process return us to Does 4 step process return us to expensive runtime computation we were expensive runtime computation we were trying to escape to begin with?trying to escape to begin with?

The amount of searching is dependent The amount of searching is dependent only on the amount of only on the amount of interface nodesinterface nodes in in source and goal sets only and not the source and goal sets only and not the actual number of nodes in the navigation actual number of nodes in the navigation sets themselvessets themselves

The cost of the inter-set path search does The cost of the inter-set path search does not scale up with navigation set size, not scale up with navigation set size, number or complexitynumber or complexity

Page 26: Navigation Set Hierarchy Tom Gianos Chapter 2.2. Mike Dickheiser Works (worked?) for Red Storm Entertainment Works (worked?) for Red Storm Entertainment.

ConclusionConclusion

Attempting to give best of both worlds:Attempting to give best of both worlds: Extremely fast pathfindingExtremely fast pathfinding Relatively low memory costRelatively low memory cost

Easy to implement since navigation Easy to implement since navigation sets and tables sit on top of existing sets and tables sit on top of existing underlying data structures of nodes underlying data structures of nodes and edgesand edges

Allows for more creative use of gained Allows for more creative use of gained CPU cycles not spent on A* or other CPU cycles not spent on A* or other dynamic methodsdynamic methods