Anda di halaman 1dari 133

JPS+: Over 100x Faster than A*

Steve Rabin
Principal Lecturer
DigiPen Institute of Technology
JPS+: Over 100x Faster than A*
JPS+ now with Goal Bounding:
Over 1000x Faster than A*
Slides:

www.gameaipro.com
Coming out April 2015

however, back in
June 2014

however,
2 months ago
Two Primary Techniques (Node Pruning)

JPS+ (ICAPS July 2014)


Avoid redundant paths on grids

Goal Bounding (developed in Jan 2015)


Avoid wrong directions on any kind of map
Test Maps (movingai.com)
75 StarCraft maps (198,230 problems)

156 Dragon Age Origins maps (159,465 problems)

36 Warcraft III maps (50,971 problems)


Test Maps (movingai.com)
75 StarCraft maps (198,230 problems)

156 Dragon Age Origins maps (159,465 problems)

36 Warcraft III maps (50,971 problems)


A* JPS+ JPS+ Goal Bounding
A* JPS+ JPS+ Goal Bounding
A* JPS+ JPS+ Goal Bounding
A* JPS+ JPS+ Goal Bounding
A* JPS+ JPS+ Goal Bounding
Goal
JPS+ Bounding

70x to 350x 1400x to 5000x 20x to 60x


faster faster faster

Avoid Avoid
Redundant Wrong
Paths Directions
StarCraft Maps:
JPS+
400

350

300

250

200

150

100

50

0
StarCraft Maps:
Subgoal Graph
1800

1600

1400

1200

1000

800

600

400

200

0
StarCraft Maps:
JPS+ Goal Bounds
6000

5000

4000

3000

2000

1000

0
StarCraft Maps:
Comparison
400 1800 6000

350 1600
5000
1400
300

1200 4000
250
1000
200 3000
800
150
600 2000

100
400
1000
50 200

0 0 0
JPS+ Subgoal Graph JPS+ Goal Bounds
StarCraft Maps:
Comparison
6000

5000

4000

3000

1800 2000
1600
1400
1200
1000
1000
800
400 600
400
200 200
0
JPS+ Subgoal Graph JPS+ Goal Bounds
0 0
1 value 4 values Goal
JPS+ Per Edge Per Edge Bounding
Grids, NavMesh, Graphs

Fast O(n) Slow O(n2)


No Map
Precompute Precompute
Changes
Dijkstra, A*,
Uniform other algorithms
Avoid Cost Avoid
Non-Uniform
Redundant Wrong
Cost
Paths Directions
Overview
JPS+ Preprocessing & Runtime
Goal Bounding Preprocessing & Runtime
Results and Analysis
Future Work
JPS+ Explained
Equivalent Paths on Grids
JPS Search Strategy
JPS Search Strategy
JPS Search Strategy
JPS Search Strategy
JPS Search Strategy
JPS Search Strategy
Forced Neighbor Cases
Fewer Open List Nodes
Four Types of Jump Points
Primary
Straight
Diagonal
Target
Primary Jump Points
Straight Jump Points
Straight Jump Point Distance
Diagonal Jump Points
Add in Wall Distances (0 or neg)
Four Types of Jump Points
Primary
Straight
Diagonal
Target (runtime)
JPS+ Runtime Example
Goal Bounding
A* Search

Reachable optimally Optimal goal bounds


by exploring left when exploring left
JPS+ Search

Reachable optimally Optimal goal bounds


by exploring left when exploring left
A* Search Goal Bounds

JPS+ Search Goal Bounds


Goal Bounding
A* Search
Goal Bounding
A* Search
Goal Bounding
A* Search
Goal Bounding
A* Search
Goal Bounding
A* Search
Goal Bounding
A* Search
Goal Bounding
A* Search
Goal Bounding
A* Search
Goal Bounding
A* Search
Goal Bounding
A* Search
Goal Bounding
A* Search
Goal Bounding
A* Search
Goal Bounding
A* Search
How to calculate Goal Bounds
Dijkstra floodfill from each node
When you put a node on the Closed list
Update start nodes Goal Bounds
(for the edge it originally came from!)
Embarrassingly parallel
Calculating
Goal Bounds
Calculating
Goal Bounds
Calculating
Goal Bounds
Calculating
Goal Bounds
Calculating
Goal Bounds
Calculating
Goal Bounds
Calculating
Goal Bounds
Calculating
Goal Bounds
Calculating
Goal Bounds
Calculating
Goal Bounds
Calculating
Goal Bounds
Calculating
Goal Bounds
Calculating
Goal Bounds
Calculating
Goal Bounds
Calculating
Goal Bounds
Calculating
Goal Bounds
Calculating
Goal Bounds
Calculating
Goal Bounds
Calculating
Goal Bounds
Calculating
Goal Bounds
Calculating
Goal Bounds
Calculating
Goal Bounds
Calculating
Goal Bounds
Calculating
Goal Bounds
Calculating
Goal Bounds
Calculating
Goal Bounds
Calculating
Goal Bounds
Calculating
Goal Bounds
Calculating
Goal Bounds
Calculating
Goal Bounds
Calculating
Goal Bounds
Calculating
Goal Bounds
Calculating
Goal Bounds
Calculating
Goal Bounds
Calculating
Goal Bounds
Calculating
Goal Bounds
Calculating
Goal Bounds
Calculating
Goal Bounds
Calculating
Goal Bounds
Calculating
Goal Bounds
Calculating
Goal Bounds
Calculating
Goal Bounds
Calculating
Goal Bounds
Calculating
Goal Bounds
Optimizations
JPS+ Goal Bounding
Fast stack and unsorted Open list
Only works for grids using Octile heuristic
Across the Cape (768x768)
2940 tests
From 4.41 to 1176.61
Search Max Open Avg Size On
List Size PopCheapest
A*
JPS+ GB
Across the Cape (768x768)
2940 tests
From 4.41 to 1176.61
Search Max Open Avg Size On
List Size PopCheapest
A* 3464
JPS+ GB
Across the Cape (768x768)
2940 tests
From 4.41 to 1176.61
Search Max Open Avg Size On
List Size PopCheapest
A* 3464 1204
JPS+ GB
Across the Cape (768x768)
2940 tests
From 4.41 to 1176.61
Search Max Open Avg Size On
List Size PopCheapest
A* 3464 1204
JPS+ GB 11
Across the Cape (768x768)
2940 tests
From 4.41 to 1176.61
Search Max Open Avg Size On
List Size PopCheapest
A* 3464 1204
JPS+ GB 11 3

3711x faster than A*


Arctic Station (768x768)
4100 tests
From 4 to 1643.06 long
Search Max Open Avg Size On
List Size PopCheapest
A*
JPS+ GB
Arctic Station (768x768)
4100 tests
From 4 to 1643.06 long
Search Max Open Avg Size On
List Size PopCheapest
A* 4373 1154
JPS+ GB
Arctic Station (768x768)
4100 tests
From 4 to 1643.06 long
Search Max Open Avg Size On
List Size PopCheapest
A* 4373 1154
JPS+ GB 8 1

4907x faster than A*


JPS+ Goal Bounding
Function pointer table
256 wall permutations X 8 parent directions
2048 look-up table pointing at 42 functions
Problem: Dynamic Maps
Goal Bounding
Gates
Goal Bounding
Gates
Goal Bounding
Gates
Recap
Goal
JPS+ Bounding

70x to 350x 1400x to 5000x 20x to 60x


faster faster faster

Avoid Avoid
Redundant Wrong
Paths Directions
1 value 4 values Goal
JPS+ Per Edge Per Edge Bounding
Grids, NavMesh, Graphs

Fast O(n) Slow O(n2)


No Map
Precompute Precompute
Changes
Dijkstra, A*,
Uniform other algorithms
Avoid Cost Avoid
Non-Uniform
Redundant Wrong
Cost
Paths Directions
StarCraft Maps:
Comparison
6000

5000

4000

3000

1800 2000
1600
1400
1200
1000
1000
800
400 600
400
200 200
0
JPS+ Subgoal Graph JPS+ Goal Bounds
0 0
Future Work
Can Goal Bounding work with Subgoal?
Can the precompute be done in O(n)?
Are there better bounds than a box?
How much does it actually speed up A* on a
NavMesh?
Questions?
steve.rabin@gmail.com

Email me for source code

Slides at:
www.gameaipro.com

Anda mungkin juga menyukai