SlideShare a Scribd company logo
INTERACTIVE OBJECTS IN
GAMING APPLICATIONS
Basic principles and practical scenarios in Unity
June 2013Stavros Vassos Sapienza University of Rome, DIAG, Italy vassos@dis.uniroma1.it
Interactive objects in games
2
 Pathfinding
 Part 1: A* heuristic search on a grid
 Part 2: Examples in Unity
 Part 3: Beyond the basics
 Action-based decision making
 AI Architectures
Pathfinding
3
 Preview
Interactive objects in games
4
 Pathfinding
 Part 1: A* heuristic search on a grid
 Part 2: Examples in Unity
 Part 3: Beyond the basics
 Action-based decision making
 AI Architectures
Pathfinding
5
 Find a path that connects two points in the game world
Pathfinding
6
 Find a path that connects two points in the game world
 Fundamental requirement in most video games
 Traditionally considered as “AI for games”
 Typically dealt as separate component of the game
that is used “as a service” by other AI components,
e.g., the decision making component of characters
Pathfinding
7
 Find a path that connects two points in the game world
 Fundamental requirement in most video games
 Traditionally considered as “AI for games”
 Typically dealt as separate component of the game
that is used “as a service” by other AI components,
e.g., the decision making component of characters
 More complicated than it looks!
Pathfinding
8
 Funny video with bugs by Paul Tozour (2008)
youtube link
Pathfinding: A* heuristic search
9
 Let’s start with a textbook approach
 Game-world as a grid, A* heuristic search
Pathfinding: A* heuristic search
10
 Let’s start with a textbook approach
 Using tool from http://www.policyalmanac.org/
Pathfinding: A* heuristic search
11
 Let’s start with a textbook approach
 Game-world as a grid, A* heuristic search
 Simple forward search
 Explore until the target is found
 Open list
 Possible nodes to visit next
 Closed list
 Visited nodes
 Choose next node using
 A cost function g(n) – cost so far
 A heuristic function h(n) – remaining
Pathfinding: A* heuristic search
12
 Let’s start with a textbook approach
 Game-world as a grid, A* heuristic search
 Open list
 Possible nodes to visit next
 Closed list in blue
 Visited nodes
Pathfinding: A* heuristic search
13
 Let’s start with a textbook approach
 Game-world as a grid, A* heuristic search
 Open list in green
 Possible nodes to visit next
 Closed list
 Visited nodes
Pathfinding: A* heuristic search
14
 Let’s start with a textbook approach
 Game-world as a grid, A* heuristic search
 Open list in green
 Possible nodes to visit next
 Closed list in blue
 Visited nodes
 Here exactly one node is
expanded (i.e., the starting node)
Pathfinding: A* heuristic search
15
 Let’s start with a textbook approach
 Game-world as a grid, A* heuristic search
 Use f(n) = g(n) + h(n) for each
node in the open list to pick the
next one to expand
 f(n) is computed when node n is
added to the open list, when
node n’ is expanded, e.g.:
 g(n) = g(n’) + 10 if straight
 g(n) = g(n’) + 14 if diagonal
 h(n) = manhattan distance to target
Pathfinding: A* heuristic search
16
 Estimated remaining cost h(n) guides the search
 Cost so far g(n) balances wrt weak estimates
g(n) = 0+10
h(n) = 80
f(n) = 90
Pathfinding: A* heuristic search
17
 Manhattan distance: x2-x1 + y2-y1
 Here it is an accurate estimate as the example is trivial
g(n) = 0+10
h(n) = 80
f(n) = 90
Pathfinding: A* heuristic search
18
 Expanding the node with the minimal value of f(n)..
Pathfinding: A* heuristic search
19
 Expanding the node with the minimal value of f(n)..
Pathfinding: A* heuristic search
20
 Expanding the node with the minimal value of f(n)..
Pathfinding: A* heuristic search
21
 Things become more interesting when there are
obstacles in the way
Pathfinding: A* heuristic search
22
 What percentage of the search space will be
expanded (i.e., explored) in this case?
Pathfinding: A* heuristic search
23
 We expect that the search would go directly
toward the destination expanding only nodes to the
right, until it hits the wall and then go toward up
and down in parallel
 Then, as the g(n) cost of each expanded node
increases though, it forces the search method to look
back and expand also in the other directions away
from the goal
 This way, following a dead-end for too long is
avoided, but also more nodes are explored
Pathfinding: A* heuristic search
24
Pathfinding: A* heuristic search
25
Pathfinding: A* heuristic search
26
Pathfinding: A* heuristic search
27
All four nodes are equally
promising
Pathfinding: A* heuristic search
28
f(n1) = 54+50 = 104
f(n2) = 44+60 = 104
Pathfinding: A* heuristic search
29
f(n1) = 54+50 = 104
f(n2) = 44+60 = 104
But why not
f(n1) = 60+50 ?
f(n2) = 50+60 ?
Pathfinding: A* heuristic search
30
 Some important details
 What happens when a node is already visited
 The closed list keeps track about visited nodes
 Also keeps track of the best way so far to get there
 When a node n is expanded by node n’, and f(n) is
better than the value stored in the closed list, then we
update the f(n) value
Pathfinding: A* heuristic search
31
This node is considered both when
the two other nodes are expanded
Pathfinding: A* heuristic search
32
 Some important details
 What happens when a node is already visited
 The closed list keeps track about visited nodes
 Also keeps track of the best way so far to get there
 When a node n is expanded by node n’, and f(n) is
better than the value stored in the closed list, then we
update the f(n) value
 We also need to update the best path that leads there
Pathfinding: A* heuristic search
33
 Keeping track of the best path that leads to a node
 In general we could store with each node also the path
that takes us there (we will see this in heuristic search A*
planning later)
 Here we just need to store the parent of the node n,
i.e., the node n’ that we expanded to get n with the
best f(n) value
Pathfinding: A* heuristic search
34
 Keeping track of the best path that leads to a node
 In general we could store with each node also the path
that takes us there (we will see this in heuristic search A*
planning later)
 Here we just need to store the parent of the node n,
i.e., the node n’ that we expanded to get n with the
best f(n) value
 This is what these little arrows do in the images we saw
Pathfinding: A* heuristic search
35
Pathfinding: A* heuristic search
36
Pathfinding: A* heuristic search
37
f(n1) = 58+60 = 118
In fact more costly than the other
f(n2) = 10+100 = 110
Pathfinding: A* heuristic search
38
f(n1) = 58+60 = 118
In fact more costly than the other
f(n2) = 10+100 = 110
Put it differently: a
lot of cost g(n1) has
been invested, but
the estimated cost
h(n1) is not small
enough to make the
overall cost f(n1) the
best promising
Pathfinding: A* heuristic search
39
Pathfinding: A* heuristic search
40
Pathfinding: A* heuristic search
41
Pathfinding: A* heuristic search
42
f(n1) = 146
h(n2) = 146
Pathfinding: A* heuristic search
43
 Important point about A*!
 Does A* provide the shortest path?
Pathfinding: A* heuristic search
44
 Important point about A*!
 Does A* provide the shortest path?
 It depends on the heuristic
 One particular class of heuristics that ensure optimal
solutions are the admissible heuristics
 These are optimistic heuristics that always
underestimate the remaining cost
Pathfinding: A* heuristic search
45
 Important point about A*!
 Does A* provide the shortest path?
 It depends on the heuristic
 One particular class of heuristics that ensure optimal
solutions are the admissible heuristics
 These are optimistic heuristics that always
underestimate the remaining cost
 Intuition1: Think of a heuristic that hugely overestimates
the optimal path and is zero for all other nodes.
Pathfinding: A* heuristic search
46
 Important point about A*!
 Does A* provide the shortest path?
 It depends on the heuristic
 One particular class of heuristics that ensure optimal
solutions are the admissible heuristics
 These are optimistic heuristics that always
underestimate the remaining cost
 Intuition2: When heuristic is zero for all nodes, the best
node is based on total cost so the optimal path is found.
Pathfinding: A* heuristic search
47
 Important point about A*!
 Does A* provide the shortest path?
 It depends on the heuristic
 One particular class of heuristics that ensure optimal
solutions are the admissible heuristics
 These are optimistic heuristics that always
underestimate the remaining cost
 (Understanding heuristics will become very important
when we talk about heuristic search A* planning later)
Pathfinding: A* heuristic search
48
 Basic options to consider for pathfinding problems
 Forward/backward/bi-directional search
 A*/best-first/weighted A*/…
 Domain-dependent/independent heuristics
 Manhattan, Chebyshev, Euclidian
 Heuristics on Amit's A* pages
 Diagonal movement: 4-connected vs 8-connected grid
 A* playground to try out different combinations
 http://qiao.github.io/PathFinding.js/visual/
Pathfinding: A* heuristic search
49
Pathfinding: A* heuristic search
50
h(n): Euclidean
Grid: 4-connected
Pathfinding: A* heuristic search
51
h(n): Euclidean
Grid: 8-connected
Pathfinding: A* heuristic search
52
h(n): Manhattan
Grid: 4-connected
Pathfinding: A* heuristic search
53
h(n): Manhattan
Grid: 8-connected
Pathfinding: A* heuristic search
54
 In many cases this is all you need to handle
pathfinding in a game (modulo tuning your
implementation to be efficient)
 In AAA modern games though, the game-world is
more complicated both in terms of features and in
terms of size, and tricks (or research) is needed!
Pathfinding: A* heuristic search
55
 More complicated game-worlds
 Different types of terrain  different cost
 Road, path, water, terrain, mud, …
 Different type of characters  different cost/ability
 Walking units, vehicles, air-units, scouters, …
 More than one level
 Stairs, elevators, hills, slopes, …
 “Nicer” paths are needed!
 Smoother curves, more “organic”, with variation, …
 The game-world is huge!
 Need for memory and CPU efficiency
Pathfinding: A* heuristic search
56
 More complicated game-worlds
 Different types of terrain  different cost
 Different type of characters  different cost/ability
 More than one level
 “Nicer” paths are needed!
 The game-world is huge!
 We can deal with some of these with simple tricks
 There is a lot of applied and research work!
 E.g., AI Programming Wisdom book series
 Also in top AI/Robotics conferences, e.g., AAAI, ICAPS,
AIIDE, IROS
Pathfinding: A* heuristic search
57
 Commercial game grid-world benchmarks
 http://www.movingai.com/benchmarks/
Pathfinding: A* heuristic search
58
 GPPC: Grid-Based Path Planning Competition
 http://movingai.com/GPPC/cfp.html
 Maps
 Size at most 2048x2048
 Static (unchanging)
 8-connected
 Diagonal actions in an optimal path cost sqrt(2)
Pathfinding: A* heuristic search
59
 Many neat tricks for efficient/nice pathfinding
 Alternative game-world representations
 Better heuristics
 Beyond A*
 But first let’s see how this simple grid representation
and A* heuristic works in a game setting in Unity
Pathfinding Part 2: Examples in Unity
60

More Related Content

What's hot

Jarrar.lecture notes.aai.2011s.ch4.informedsearch
Jarrar.lecture notes.aai.2011s.ch4.informedsearchJarrar.lecture notes.aai.2011s.ch4.informedsearch
Jarrar.lecture notes.aai.2011s.ch4.informedsearch
PalGov
 
Jarrar: Informed Search
Jarrar: Informed Search  Jarrar: Informed Search
Jarrar: Informed Search
Mustafa Jarrar
 
Solving problems by searching Informed (heuristics) Search
Solving problems by searching Informed (heuristics) SearchSolving problems by searching Informed (heuristics) Search
Solving problems by searching Informed (heuristics) Search
matele41
 
A Star Search
A Star SearchA Star Search
A Star Search
Computing Cage
 
M4 heuristics
M4 heuristicsM4 heuristics
M4 heuristics
Yasir Khan
 
AI Lesson 05
AI Lesson 05AI Lesson 05
AI Lesson 05
Assistant Professor
 
Heuristic Searching: A* Search
Heuristic Searching: A* SearchHeuristic Searching: A* Search
Heuristic Searching: A* Search
IOSR Journals
 
Lecture 14 Heuristic Search-A star algorithm
Lecture 14 Heuristic Search-A star algorithmLecture 14 Heuristic Search-A star algorithm
Lecture 14 Heuristic Search-A star algorithm
Hema Kashyap
 
Informed search (heuristics)
Informed search (heuristics)Informed search (heuristics)
Informed search (heuristics)
Bablu Shofi
 
A star algorithms
A star algorithmsA star algorithms
A star algorithms
sandeep54552
 
Artificial intelligence(06)
Artificial intelligence(06)Artificial intelligence(06)
Artificial intelligence(06)
Nazir Ahmed
 
AI Greedy and A-STAR Search
AI Greedy and A-STAR SearchAI Greedy and A-STAR Search
AI Greedy and A-STAR Search
Andrew Ferlitsch
 
Example of iterative deepening search & bidirectional search
Example of iterative deepening search & bidirectional searchExample of iterative deepening search & bidirectional search
Example of iterative deepening search & bidirectional search
Abhijeet Agarwal
 
Control Strategies in AI
Control Strategies in AIControl Strategies in AI
Control Strategies in AI
Amey Kerkar
 
Game Paper
Game PaperGame Paper
Game Paper
Siddharth Gupta
 
Presentation - Bi-directional A-star search
Presentation - Bi-directional A-star searchPresentation - Bi-directional A-star search
Presentation - Bi-directional A-star search
Mohammad Saiful Islam
 
Astar algorithm
Astar algorithmAstar algorithm
Astar algorithm
Shuqing Zhang
 
A* Search Algorithm
A* Search AlgorithmA* Search Algorithm
A* Search Algorithm
vikas dhakane
 
M3 search
M3 searchM3 search
M3 search
Yasir Khan
 

What's hot (19)

Jarrar.lecture notes.aai.2011s.ch4.informedsearch
Jarrar.lecture notes.aai.2011s.ch4.informedsearchJarrar.lecture notes.aai.2011s.ch4.informedsearch
Jarrar.lecture notes.aai.2011s.ch4.informedsearch
 
Jarrar: Informed Search
Jarrar: Informed Search  Jarrar: Informed Search
Jarrar: Informed Search
 
Solving problems by searching Informed (heuristics) Search
Solving problems by searching Informed (heuristics) SearchSolving problems by searching Informed (heuristics) Search
Solving problems by searching Informed (heuristics) Search
 
A Star Search
A Star SearchA Star Search
A Star Search
 
M4 heuristics
M4 heuristicsM4 heuristics
M4 heuristics
 
AI Lesson 05
AI Lesson 05AI Lesson 05
AI Lesson 05
 
Heuristic Searching: A* Search
Heuristic Searching: A* SearchHeuristic Searching: A* Search
Heuristic Searching: A* Search
 
Lecture 14 Heuristic Search-A star algorithm
Lecture 14 Heuristic Search-A star algorithmLecture 14 Heuristic Search-A star algorithm
Lecture 14 Heuristic Search-A star algorithm
 
Informed search (heuristics)
Informed search (heuristics)Informed search (heuristics)
Informed search (heuristics)
 
A star algorithms
A star algorithmsA star algorithms
A star algorithms
 
Artificial intelligence(06)
Artificial intelligence(06)Artificial intelligence(06)
Artificial intelligence(06)
 
AI Greedy and A-STAR Search
AI Greedy and A-STAR SearchAI Greedy and A-STAR Search
AI Greedy and A-STAR Search
 
Example of iterative deepening search & bidirectional search
Example of iterative deepening search & bidirectional searchExample of iterative deepening search & bidirectional search
Example of iterative deepening search & bidirectional search
 
Control Strategies in AI
Control Strategies in AIControl Strategies in AI
Control Strategies in AI
 
Game Paper
Game PaperGame Paper
Game Paper
 
Presentation - Bi-directional A-star search
Presentation - Bi-directional A-star searchPresentation - Bi-directional A-star search
Presentation - Bi-directional A-star search
 
Astar algorithm
Astar algorithmAstar algorithm
Astar algorithm
 
A* Search Algorithm
A* Search AlgorithmA* Search Algorithm
A* Search Algorithm
 
M3 search
M3 searchM3 search
M3 search
 

Similar to Pathfinding - Part 1: Α* heuristic search

shamwari dzerwendo.mmmmmmfmmfmfkksrkrttkt
shamwari dzerwendo.mmmmmmfmmfmfkksrkrttktshamwari dzerwendo.mmmmmmfmmfmfkksrkrttkt
shamwari dzerwendo.mmmmmmfmmfmfkksrkrttkt
PEACENYAMA1
 
Informed-search TECHNIQUES IN ai ml data science
Informed-search TECHNIQUES IN ai ml data scienceInformed-search TECHNIQUES IN ai ml data science
Informed-search TECHNIQUES IN ai ml data science
devvpillpersonal
 
Search 2
Search 2Search 2
informed_search.pdf
informed_search.pdfinformed_search.pdf
informed_search.pdf
SankarTerli
 
Artificial intelligence and machine learning
Artificial intelligence and machine learningArtificial intelligence and machine learning
Artificial intelligence and machine learning
GuruKiran18
 
Artificial intelligence(06)
Artificial intelligence(06)Artificial intelligence(06)
Artificial intelligence(06)
Nazir Ahmed
 
Final slide (bsc csit) chapter 5
Final slide (bsc csit) chapter 5Final slide (bsc csit) chapter 5
Final slide (bsc csit) chapter 5
Subash Chandra Pakhrin
 
What is A * Search? What is Heuristic Search? What is Tree search Algorithm?
What is A * Search? What is Heuristic Search? What is Tree search Algorithm?What is A * Search? What is Heuristic Search? What is Tree search Algorithm?
What is A * Search? What is Heuristic Search? What is Tree search Algorithm?
Santosh Pandeya
 
AIw06.pptx
AIw06.pptxAIw06.pptx
AIw06.pptx
Nguyễn Tiến
 
Route-Planning other sesion for Universal
Route-Planning other sesion for UniversalRoute-Planning other sesion for Universal
Route-Planning other sesion for Universal
Didik56
 
A Star Search
A Star SearchA Star Search
Searching
SearchingSearching
Astar.ppt hjguyjgukyjgoyjgugukgulgoyulgyilglyi
Astar.ppt hjguyjgukyjgoyjgugukgulgoyulgyilglyiAstar.ppt hjguyjgukyjgoyjgugukgulgoyulgyilglyi
Astar.ppt hjguyjgukyjgoyjgugukgulgoyulgyilglyi
kamaleshs183
 
Informed Search.pptx
Informed Search.pptxInformed Search.pptx
Informed Search.pptx
MohanKumarP34
 
A star search
A star searchA star search
A star search
Megha Sharma
 
Searching Informed Search.pdf
Searching Informed Search.pdfSearching Informed Search.pdf
Searching Informed Search.pdf
DrBashirMSaad
 
CS767_Lecture_03.pptx
CS767_Lecture_03.pptxCS767_Lecture_03.pptx
CS767_Lecture_03.pptx
ShujatHussainGadi
 
A* Algorithm
A* AlgorithmA* Algorithm
A* Algorithm
maharajdey
 
AI3391 ARTIFICIAL INTELLIGENCE UNIT II notes.pdf
AI3391 ARTIFICIAL INTELLIGENCE UNIT II notes.pdfAI3391 ARTIFICIAL INTELLIGENCE UNIT II notes.pdf
AI3391 ARTIFICIAL INTELLIGENCE UNIT II notes.pdf
Asst.prof M.Gokilavani
 
2-Heuristic Search.ppt
2-Heuristic Search.ppt2-Heuristic Search.ppt
2-Heuristic Search.ppt
MIT,Imphal
 

Similar to Pathfinding - Part 1: Α* heuristic search (20)

shamwari dzerwendo.mmmmmmfmmfmfkksrkrttkt
shamwari dzerwendo.mmmmmmfmmfmfkksrkrttktshamwari dzerwendo.mmmmmmfmmfmfkksrkrttkt
shamwari dzerwendo.mmmmmmfmmfmfkksrkrttkt
 
Informed-search TECHNIQUES IN ai ml data science
Informed-search TECHNIQUES IN ai ml data scienceInformed-search TECHNIQUES IN ai ml data science
Informed-search TECHNIQUES IN ai ml data science
 
Search 2
Search 2Search 2
Search 2
 
informed_search.pdf
informed_search.pdfinformed_search.pdf
informed_search.pdf
 
Artificial intelligence and machine learning
Artificial intelligence and machine learningArtificial intelligence and machine learning
Artificial intelligence and machine learning
 
Artificial intelligence(06)
Artificial intelligence(06)Artificial intelligence(06)
Artificial intelligence(06)
 
Final slide (bsc csit) chapter 5
Final slide (bsc csit) chapter 5Final slide (bsc csit) chapter 5
Final slide (bsc csit) chapter 5
 
What is A * Search? What is Heuristic Search? What is Tree search Algorithm?
What is A * Search? What is Heuristic Search? What is Tree search Algorithm?What is A * Search? What is Heuristic Search? What is Tree search Algorithm?
What is A * Search? What is Heuristic Search? What is Tree search Algorithm?
 
AIw06.pptx
AIw06.pptxAIw06.pptx
AIw06.pptx
 
Route-Planning other sesion for Universal
Route-Planning other sesion for UniversalRoute-Planning other sesion for Universal
Route-Planning other sesion for Universal
 
A Star Search
A Star SearchA Star Search
A Star Search
 
Searching
SearchingSearching
Searching
 
Astar.ppt hjguyjgukyjgoyjgugukgulgoyulgyilglyi
Astar.ppt hjguyjgukyjgoyjgugukgulgoyulgyilglyiAstar.ppt hjguyjgukyjgoyjgugukgulgoyulgyilglyi
Astar.ppt hjguyjgukyjgoyjgugukgulgoyulgyilglyi
 
Informed Search.pptx
Informed Search.pptxInformed Search.pptx
Informed Search.pptx
 
A star search
A star searchA star search
A star search
 
Searching Informed Search.pdf
Searching Informed Search.pdfSearching Informed Search.pdf
Searching Informed Search.pdf
 
CS767_Lecture_03.pptx
CS767_Lecture_03.pptxCS767_Lecture_03.pptx
CS767_Lecture_03.pptx
 
A* Algorithm
A* AlgorithmA* Algorithm
A* Algorithm
 
AI3391 ARTIFICIAL INTELLIGENCE UNIT II notes.pdf
AI3391 ARTIFICIAL INTELLIGENCE UNIT II notes.pdfAI3391 ARTIFICIAL INTELLIGENCE UNIT II notes.pdf
AI3391 ARTIFICIAL INTELLIGENCE UNIT II notes.pdf
 
2-Heuristic Search.ppt
2-Heuristic Search.ppt2-Heuristic Search.ppt
2-Heuristic Search.ppt
 

More from Stavros Vassos

Pathfinding - Part 2: Examples in Unity
Pathfinding - Part 2: Examples in UnityPathfinding - Part 2: Examples in Unity
Pathfinding - Part 2: Examples in Unity
Stavros Vassos
 
Intro to AI STRIPS Planning & Applications in Video-games Lecture1-Part1
Intro to AI STRIPS Planning & Applications in Video-games Lecture1-Part1Intro to AI STRIPS Planning & Applications in Video-games Lecture1-Part1
Intro to AI STRIPS Planning & Applications in Video-games Lecture1-Part1
Stavros Vassos
 
Intro to AI STRIPS Planning & Applications in Video-games Lecture6-Part1
Intro to AI STRIPS Planning & Applications in Video-games Lecture6-Part1Intro to AI STRIPS Planning & Applications in Video-games Lecture6-Part1
Intro to AI STRIPS Planning & Applications in Video-games Lecture6-Part1
Stavros Vassos
 
Intro to AI STRIPS Planning & Applications in Video-games Lecture5-Part1
Intro to AI STRIPS Planning & Applications in Video-games Lecture5-Part1Intro to AI STRIPS Planning & Applications in Video-games Lecture5-Part1
Intro to AI STRIPS Planning & Applications in Video-games Lecture5-Part1
Stavros Vassos
 
Intro to AI STRIPS Planning & Applications in Video-games Lecture4-Part2
Intro to AI STRIPS Planning & Applications in Video-games Lecture4-Part2Intro to AI STRIPS Planning & Applications in Video-games Lecture4-Part2
Intro to AI STRIPS Planning & Applications in Video-games Lecture4-Part2
Stavros Vassos
 
Intro to AI STRIPS Planning & Applications in Video-games Lecture4-Part1
Intro to AI STRIPS Planning & Applications in Video-games Lecture4-Part1Intro to AI STRIPS Planning & Applications in Video-games Lecture4-Part1
Intro to AI STRIPS Planning & Applications in Video-games Lecture4-Part1
Stavros Vassos
 
Intro to AI STRIPS Planning & Applications in Video-games Lecture3-Part1
Intro to AI STRIPS Planning & Applications in Video-games Lecture3-Part1Intro to AI STRIPS Planning & Applications in Video-games Lecture3-Part1
Intro to AI STRIPS Planning & Applications in Video-games Lecture3-Part1
Stavros Vassos
 
Intro to AI STRIPS Planning & Applications in Video-games Lecture2-Part2
Intro to AI STRIPS Planning & Applications in Video-games Lecture2-Part2Intro to AI STRIPS Planning & Applications in Video-games Lecture2-Part2
Intro to AI STRIPS Planning & Applications in Video-games Lecture2-Part2
Stavros Vassos
 
Intro to AI STRIPS Planning & Applications in Video-games Lecture1-Part2
Intro to AI STRIPS Planning & Applications in Video-games Lecture1-Part2Intro to AI STRIPS Planning & Applications in Video-games Lecture1-Part2
Intro to AI STRIPS Planning & Applications in Video-games Lecture1-Part2
Stavros Vassos
 
Intro to AI STRIPS Planning & Applications in Video-games Lecture6-Part2
Intro to AI STRIPS Planning & Applications in Video-games Lecture6-Part2Intro to AI STRIPS Planning & Applications in Video-games Lecture6-Part2
Intro to AI STRIPS Planning & Applications in Video-games Lecture6-Part2
Stavros Vassos
 
The SimpleFPS Planning Domain: A PDDL Benchmark for Proactive NPCs
The SimpleFPS Planning Domain: A PDDL Benchmark for Proactive NPCsThe SimpleFPS Planning Domain: A PDDL Benchmark for Proactive NPCs
The SimpleFPS Planning Domain: A PDDL Benchmark for Proactive NPCs
Stavros Vassos
 

More from Stavros Vassos (11)

Pathfinding - Part 2: Examples in Unity
Pathfinding - Part 2: Examples in UnityPathfinding - Part 2: Examples in Unity
Pathfinding - Part 2: Examples in Unity
 
Intro to AI STRIPS Planning & Applications in Video-games Lecture1-Part1
Intro to AI STRIPS Planning & Applications in Video-games Lecture1-Part1Intro to AI STRIPS Planning & Applications in Video-games Lecture1-Part1
Intro to AI STRIPS Planning & Applications in Video-games Lecture1-Part1
 
Intro to AI STRIPS Planning & Applications in Video-games Lecture6-Part1
Intro to AI STRIPS Planning & Applications in Video-games Lecture6-Part1Intro to AI STRIPS Planning & Applications in Video-games Lecture6-Part1
Intro to AI STRIPS Planning & Applications in Video-games Lecture6-Part1
 
Intro to AI STRIPS Planning & Applications in Video-games Lecture5-Part1
Intro to AI STRIPS Planning & Applications in Video-games Lecture5-Part1Intro to AI STRIPS Planning & Applications in Video-games Lecture5-Part1
Intro to AI STRIPS Planning & Applications in Video-games Lecture5-Part1
 
Intro to AI STRIPS Planning & Applications in Video-games Lecture4-Part2
Intro to AI STRIPS Planning & Applications in Video-games Lecture4-Part2Intro to AI STRIPS Planning & Applications in Video-games Lecture4-Part2
Intro to AI STRIPS Planning & Applications in Video-games Lecture4-Part2
 
Intro to AI STRIPS Planning & Applications in Video-games Lecture4-Part1
Intro to AI STRIPS Planning & Applications in Video-games Lecture4-Part1Intro to AI STRIPS Planning & Applications in Video-games Lecture4-Part1
Intro to AI STRIPS Planning & Applications in Video-games Lecture4-Part1
 
Intro to AI STRIPS Planning & Applications in Video-games Lecture3-Part1
Intro to AI STRIPS Planning & Applications in Video-games Lecture3-Part1Intro to AI STRIPS Planning & Applications in Video-games Lecture3-Part1
Intro to AI STRIPS Planning & Applications in Video-games Lecture3-Part1
 
Intro to AI STRIPS Planning & Applications in Video-games Lecture2-Part2
Intro to AI STRIPS Planning & Applications in Video-games Lecture2-Part2Intro to AI STRIPS Planning & Applications in Video-games Lecture2-Part2
Intro to AI STRIPS Planning & Applications in Video-games Lecture2-Part2
 
Intro to AI STRIPS Planning & Applications in Video-games Lecture1-Part2
Intro to AI STRIPS Planning & Applications in Video-games Lecture1-Part2Intro to AI STRIPS Planning & Applications in Video-games Lecture1-Part2
Intro to AI STRIPS Planning & Applications in Video-games Lecture1-Part2
 
Intro to AI STRIPS Planning & Applications in Video-games Lecture6-Part2
Intro to AI STRIPS Planning & Applications in Video-games Lecture6-Part2Intro to AI STRIPS Planning & Applications in Video-games Lecture6-Part2
Intro to AI STRIPS Planning & Applications in Video-games Lecture6-Part2
 
The SimpleFPS Planning Domain: A PDDL Benchmark for Proactive NPCs
The SimpleFPS Planning Domain: A PDDL Benchmark for Proactive NPCsThe SimpleFPS Planning Domain: A PDDL Benchmark for Proactive NPCs
The SimpleFPS Planning Domain: A PDDL Benchmark for Proactive NPCs
 

Recently uploaded

Pride Month Slides 2024 David Douglas School District
Pride Month Slides 2024 David Douglas School DistrictPride Month Slides 2024 David Douglas School District
Pride Month Slides 2024 David Douglas School District
David Douglas School District
 
Executive Directors Chat Leveraging AI for Diversity, Equity, and Inclusion
Executive Directors Chat  Leveraging AI for Diversity, Equity, and InclusionExecutive Directors Chat  Leveraging AI for Diversity, Equity, and Inclusion
Executive Directors Chat Leveraging AI for Diversity, Equity, and Inclusion
TechSoup
 
Liberal Approach to the Study of Indian Politics.pdf
Liberal Approach to the Study of Indian Politics.pdfLiberal Approach to the Study of Indian Politics.pdf
Liberal Approach to the Study of Indian Politics.pdf
WaniBasim
 
Assessment and Planning in Educational technology.pptx
Assessment and Planning in Educational technology.pptxAssessment and Planning in Educational technology.pptx
Assessment and Planning in Educational technology.pptx
Kavitha Krishnan
 
Natural birth techniques - Mrs.Akanksha Trivedi Rama University
Natural birth techniques - Mrs.Akanksha Trivedi Rama UniversityNatural birth techniques - Mrs.Akanksha Trivedi Rama University
Natural birth techniques - Mrs.Akanksha Trivedi Rama University
Akanksha trivedi rama nursing college kanpur.
 
Main Java[All of the Base Concepts}.docx
Main Java[All of the Base Concepts}.docxMain Java[All of the Base Concepts}.docx
Main Java[All of the Base Concepts}.docx
adhitya5119
 
Life upper-Intermediate B2 Workbook for student
Life upper-Intermediate B2 Workbook for studentLife upper-Intermediate B2 Workbook for student
Life upper-Intermediate B2 Workbook for student
NgcHiNguyn25
 
How to Add Chatter in the odoo 17 ERP Module
How to Add Chatter in the odoo 17 ERP ModuleHow to Add Chatter in the odoo 17 ERP Module
How to Add Chatter in the odoo 17 ERP Module
Celine George
 
The basics of sentences session 6pptx.pptx
The basics of sentences session 6pptx.pptxThe basics of sentences session 6pptx.pptx
The basics of sentences session 6pptx.pptx
heathfieldcps1
 
Film vocab for eal 3 students: Australia the movie
Film vocab for eal 3 students: Australia the movieFilm vocab for eal 3 students: Australia the movie
Film vocab for eal 3 students: Australia the movie
Nicholas Montgomery
 
Smart-Money for SMC traders good time and ICT
Smart-Money for SMC traders good time and ICTSmart-Money for SMC traders good time and ICT
Smart-Money for SMC traders good time and ICT
simonomuemu
 
Chapter 4 - Islamic Financial Institutions in Malaysia.pptx
Chapter 4 - Islamic Financial Institutions in Malaysia.pptxChapter 4 - Islamic Financial Institutions in Malaysia.pptx
Chapter 4 - Islamic Financial Institutions in Malaysia.pptx
Mohd Adib Abd Muin, Senior Lecturer at Universiti Utara Malaysia
 
The History of Stoke Newington Street Names
The History of Stoke Newington Street NamesThe History of Stoke Newington Street Names
The History of Stoke Newington Street Names
History of Stoke Newington
 
RPMS TEMPLATE FOR SCHOOL YEAR 2023-2024 FOR TEACHER 1 TO TEACHER 3
RPMS TEMPLATE FOR SCHOOL YEAR 2023-2024 FOR TEACHER 1 TO TEACHER 3RPMS TEMPLATE FOR SCHOOL YEAR 2023-2024 FOR TEACHER 1 TO TEACHER 3
RPMS TEMPLATE FOR SCHOOL YEAR 2023-2024 FOR TEACHER 1 TO TEACHER 3
IreneSebastianRueco1
 
The basics of sentences session 5pptx.pptx
The basics of sentences session 5pptx.pptxThe basics of sentences session 5pptx.pptx
The basics of sentences session 5pptx.pptx
heathfieldcps1
 
বাংলাদেশ অর্থনৈতিক সমীক্ষা (Economic Review) ২০২৪ UJS App.pdf
বাংলাদেশ অর্থনৈতিক সমীক্ষা (Economic Review) ২০২৪ UJS App.pdfবাংলাদেশ অর্থনৈতিক সমীক্ষা (Economic Review) ২০২৪ UJS App.pdf
বাংলাদেশ অর্থনৈতিক সমীক্ষা (Economic Review) ২০২৪ UJS App.pdf
eBook.com.bd (প্রয়োজনীয় বাংলা বই)
 
PIMS Job Advertisement 2024.pdf Islamabad
PIMS Job Advertisement 2024.pdf IslamabadPIMS Job Advertisement 2024.pdf Islamabad
PIMS Job Advertisement 2024.pdf Islamabad
AyyanKhan40
 
Azure Interview Questions and Answers PDF By ScholarHat
Azure Interview Questions and Answers PDF By ScholarHatAzure Interview Questions and Answers PDF By ScholarHat
Azure Interview Questions and Answers PDF By ScholarHat
Scholarhat
 
How to Manage Your Lost Opportunities in Odoo 17 CRM
How to Manage Your Lost Opportunities in Odoo 17 CRMHow to Manage Your Lost Opportunities in Odoo 17 CRM
How to Manage Your Lost Opportunities in Odoo 17 CRM
Celine George
 
MARY JANE WILSON, A “BOA MÃE” .
MARY JANE WILSON, A “BOA MÃE”           .MARY JANE WILSON, A “BOA MÃE”           .
MARY JANE WILSON, A “BOA MÃE” .
Colégio Santa Teresinha
 

Recently uploaded (20)

Pride Month Slides 2024 David Douglas School District
Pride Month Slides 2024 David Douglas School DistrictPride Month Slides 2024 David Douglas School District
Pride Month Slides 2024 David Douglas School District
 
Executive Directors Chat Leveraging AI for Diversity, Equity, and Inclusion
Executive Directors Chat  Leveraging AI for Diversity, Equity, and InclusionExecutive Directors Chat  Leveraging AI for Diversity, Equity, and Inclusion
Executive Directors Chat Leveraging AI for Diversity, Equity, and Inclusion
 
Liberal Approach to the Study of Indian Politics.pdf
Liberal Approach to the Study of Indian Politics.pdfLiberal Approach to the Study of Indian Politics.pdf
Liberal Approach to the Study of Indian Politics.pdf
 
Assessment and Planning in Educational technology.pptx
Assessment and Planning in Educational technology.pptxAssessment and Planning in Educational technology.pptx
Assessment and Planning in Educational technology.pptx
 
Natural birth techniques - Mrs.Akanksha Trivedi Rama University
Natural birth techniques - Mrs.Akanksha Trivedi Rama UniversityNatural birth techniques - Mrs.Akanksha Trivedi Rama University
Natural birth techniques - Mrs.Akanksha Trivedi Rama University
 
Main Java[All of the Base Concepts}.docx
Main Java[All of the Base Concepts}.docxMain Java[All of the Base Concepts}.docx
Main Java[All of the Base Concepts}.docx
 
Life upper-Intermediate B2 Workbook for student
Life upper-Intermediate B2 Workbook for studentLife upper-Intermediate B2 Workbook for student
Life upper-Intermediate B2 Workbook for student
 
How to Add Chatter in the odoo 17 ERP Module
How to Add Chatter in the odoo 17 ERP ModuleHow to Add Chatter in the odoo 17 ERP Module
How to Add Chatter in the odoo 17 ERP Module
 
The basics of sentences session 6pptx.pptx
The basics of sentences session 6pptx.pptxThe basics of sentences session 6pptx.pptx
The basics of sentences session 6pptx.pptx
 
Film vocab for eal 3 students: Australia the movie
Film vocab for eal 3 students: Australia the movieFilm vocab for eal 3 students: Australia the movie
Film vocab for eal 3 students: Australia the movie
 
Smart-Money for SMC traders good time and ICT
Smart-Money for SMC traders good time and ICTSmart-Money for SMC traders good time and ICT
Smart-Money for SMC traders good time and ICT
 
Chapter 4 - Islamic Financial Institutions in Malaysia.pptx
Chapter 4 - Islamic Financial Institutions in Malaysia.pptxChapter 4 - Islamic Financial Institutions in Malaysia.pptx
Chapter 4 - Islamic Financial Institutions in Malaysia.pptx
 
The History of Stoke Newington Street Names
The History of Stoke Newington Street NamesThe History of Stoke Newington Street Names
The History of Stoke Newington Street Names
 
RPMS TEMPLATE FOR SCHOOL YEAR 2023-2024 FOR TEACHER 1 TO TEACHER 3
RPMS TEMPLATE FOR SCHOOL YEAR 2023-2024 FOR TEACHER 1 TO TEACHER 3RPMS TEMPLATE FOR SCHOOL YEAR 2023-2024 FOR TEACHER 1 TO TEACHER 3
RPMS TEMPLATE FOR SCHOOL YEAR 2023-2024 FOR TEACHER 1 TO TEACHER 3
 
The basics of sentences session 5pptx.pptx
The basics of sentences session 5pptx.pptxThe basics of sentences session 5pptx.pptx
The basics of sentences session 5pptx.pptx
 
বাংলাদেশ অর্থনৈতিক সমীক্ষা (Economic Review) ২০২৪ UJS App.pdf
বাংলাদেশ অর্থনৈতিক সমীক্ষা (Economic Review) ২০২৪ UJS App.pdfবাংলাদেশ অর্থনৈতিক সমীক্ষা (Economic Review) ২০২৪ UJS App.pdf
বাংলাদেশ অর্থনৈতিক সমীক্ষা (Economic Review) ২০২৪ UJS App.pdf
 
PIMS Job Advertisement 2024.pdf Islamabad
PIMS Job Advertisement 2024.pdf IslamabadPIMS Job Advertisement 2024.pdf Islamabad
PIMS Job Advertisement 2024.pdf Islamabad
 
Azure Interview Questions and Answers PDF By ScholarHat
Azure Interview Questions and Answers PDF By ScholarHatAzure Interview Questions and Answers PDF By ScholarHat
Azure Interview Questions and Answers PDF By ScholarHat
 
How to Manage Your Lost Opportunities in Odoo 17 CRM
How to Manage Your Lost Opportunities in Odoo 17 CRMHow to Manage Your Lost Opportunities in Odoo 17 CRM
How to Manage Your Lost Opportunities in Odoo 17 CRM
 
MARY JANE WILSON, A “BOA MÃE” .
MARY JANE WILSON, A “BOA MÃE”           .MARY JANE WILSON, A “BOA MÃE”           .
MARY JANE WILSON, A “BOA MÃE” .
 

Pathfinding - Part 1: Α* heuristic search

  • 1. INTERACTIVE OBJECTS IN GAMING APPLICATIONS Basic principles and practical scenarios in Unity June 2013Stavros Vassos Sapienza University of Rome, DIAG, Italy vassos@dis.uniroma1.it
  • 2. Interactive objects in games 2  Pathfinding  Part 1: A* heuristic search on a grid  Part 2: Examples in Unity  Part 3: Beyond the basics  Action-based decision making  AI Architectures
  • 4. Interactive objects in games 4  Pathfinding  Part 1: A* heuristic search on a grid  Part 2: Examples in Unity  Part 3: Beyond the basics  Action-based decision making  AI Architectures
  • 5. Pathfinding 5  Find a path that connects two points in the game world
  • 6. Pathfinding 6  Find a path that connects two points in the game world  Fundamental requirement in most video games  Traditionally considered as “AI for games”  Typically dealt as separate component of the game that is used “as a service” by other AI components, e.g., the decision making component of characters
  • 7. Pathfinding 7  Find a path that connects two points in the game world  Fundamental requirement in most video games  Traditionally considered as “AI for games”  Typically dealt as separate component of the game that is used “as a service” by other AI components, e.g., the decision making component of characters  More complicated than it looks!
  • 8. Pathfinding 8  Funny video with bugs by Paul Tozour (2008) youtube link
  • 9. Pathfinding: A* heuristic search 9  Let’s start with a textbook approach  Game-world as a grid, A* heuristic search
  • 10. Pathfinding: A* heuristic search 10  Let’s start with a textbook approach  Using tool from http://www.policyalmanac.org/
  • 11. Pathfinding: A* heuristic search 11  Let’s start with a textbook approach  Game-world as a grid, A* heuristic search  Simple forward search  Explore until the target is found  Open list  Possible nodes to visit next  Closed list  Visited nodes  Choose next node using  A cost function g(n) – cost so far  A heuristic function h(n) – remaining
  • 12. Pathfinding: A* heuristic search 12  Let’s start with a textbook approach  Game-world as a grid, A* heuristic search  Open list  Possible nodes to visit next  Closed list in blue  Visited nodes
  • 13. Pathfinding: A* heuristic search 13  Let’s start with a textbook approach  Game-world as a grid, A* heuristic search  Open list in green  Possible nodes to visit next  Closed list  Visited nodes
  • 14. Pathfinding: A* heuristic search 14  Let’s start with a textbook approach  Game-world as a grid, A* heuristic search  Open list in green  Possible nodes to visit next  Closed list in blue  Visited nodes  Here exactly one node is expanded (i.e., the starting node)
  • 15. Pathfinding: A* heuristic search 15  Let’s start with a textbook approach  Game-world as a grid, A* heuristic search  Use f(n) = g(n) + h(n) for each node in the open list to pick the next one to expand  f(n) is computed when node n is added to the open list, when node n’ is expanded, e.g.:  g(n) = g(n’) + 10 if straight  g(n) = g(n’) + 14 if diagonal  h(n) = manhattan distance to target
  • 16. Pathfinding: A* heuristic search 16  Estimated remaining cost h(n) guides the search  Cost so far g(n) balances wrt weak estimates g(n) = 0+10 h(n) = 80 f(n) = 90
  • 17. Pathfinding: A* heuristic search 17  Manhattan distance: x2-x1 + y2-y1  Here it is an accurate estimate as the example is trivial g(n) = 0+10 h(n) = 80 f(n) = 90
  • 18. Pathfinding: A* heuristic search 18  Expanding the node with the minimal value of f(n)..
  • 19. Pathfinding: A* heuristic search 19  Expanding the node with the minimal value of f(n)..
  • 20. Pathfinding: A* heuristic search 20  Expanding the node with the minimal value of f(n)..
  • 21. Pathfinding: A* heuristic search 21  Things become more interesting when there are obstacles in the way
  • 22. Pathfinding: A* heuristic search 22  What percentage of the search space will be expanded (i.e., explored) in this case?
  • 23. Pathfinding: A* heuristic search 23  We expect that the search would go directly toward the destination expanding only nodes to the right, until it hits the wall and then go toward up and down in parallel  Then, as the g(n) cost of each expanded node increases though, it forces the search method to look back and expand also in the other directions away from the goal  This way, following a dead-end for too long is avoided, but also more nodes are explored
  • 27. Pathfinding: A* heuristic search 27 All four nodes are equally promising
  • 28. Pathfinding: A* heuristic search 28 f(n1) = 54+50 = 104 f(n2) = 44+60 = 104
  • 29. Pathfinding: A* heuristic search 29 f(n1) = 54+50 = 104 f(n2) = 44+60 = 104 But why not f(n1) = 60+50 ? f(n2) = 50+60 ?
  • 30. Pathfinding: A* heuristic search 30  Some important details  What happens when a node is already visited  The closed list keeps track about visited nodes  Also keeps track of the best way so far to get there  When a node n is expanded by node n’, and f(n) is better than the value stored in the closed list, then we update the f(n) value
  • 31. Pathfinding: A* heuristic search 31 This node is considered both when the two other nodes are expanded
  • 32. Pathfinding: A* heuristic search 32  Some important details  What happens when a node is already visited  The closed list keeps track about visited nodes  Also keeps track of the best way so far to get there  When a node n is expanded by node n’, and f(n) is better than the value stored in the closed list, then we update the f(n) value  We also need to update the best path that leads there
  • 33. Pathfinding: A* heuristic search 33  Keeping track of the best path that leads to a node  In general we could store with each node also the path that takes us there (we will see this in heuristic search A* planning later)  Here we just need to store the parent of the node n, i.e., the node n’ that we expanded to get n with the best f(n) value
  • 34. Pathfinding: A* heuristic search 34  Keeping track of the best path that leads to a node  In general we could store with each node also the path that takes us there (we will see this in heuristic search A* planning later)  Here we just need to store the parent of the node n, i.e., the node n’ that we expanded to get n with the best f(n) value  This is what these little arrows do in the images we saw
  • 37. Pathfinding: A* heuristic search 37 f(n1) = 58+60 = 118 In fact more costly than the other f(n2) = 10+100 = 110
  • 38. Pathfinding: A* heuristic search 38 f(n1) = 58+60 = 118 In fact more costly than the other f(n2) = 10+100 = 110 Put it differently: a lot of cost g(n1) has been invested, but the estimated cost h(n1) is not small enough to make the overall cost f(n1) the best promising
  • 42. Pathfinding: A* heuristic search 42 f(n1) = 146 h(n2) = 146
  • 43. Pathfinding: A* heuristic search 43  Important point about A*!  Does A* provide the shortest path?
  • 44. Pathfinding: A* heuristic search 44  Important point about A*!  Does A* provide the shortest path?  It depends on the heuristic  One particular class of heuristics that ensure optimal solutions are the admissible heuristics  These are optimistic heuristics that always underestimate the remaining cost
  • 45. Pathfinding: A* heuristic search 45  Important point about A*!  Does A* provide the shortest path?  It depends on the heuristic  One particular class of heuristics that ensure optimal solutions are the admissible heuristics  These are optimistic heuristics that always underestimate the remaining cost  Intuition1: Think of a heuristic that hugely overestimates the optimal path and is zero for all other nodes.
  • 46. Pathfinding: A* heuristic search 46  Important point about A*!  Does A* provide the shortest path?  It depends on the heuristic  One particular class of heuristics that ensure optimal solutions are the admissible heuristics  These are optimistic heuristics that always underestimate the remaining cost  Intuition2: When heuristic is zero for all nodes, the best node is based on total cost so the optimal path is found.
  • 47. Pathfinding: A* heuristic search 47  Important point about A*!  Does A* provide the shortest path?  It depends on the heuristic  One particular class of heuristics that ensure optimal solutions are the admissible heuristics  These are optimistic heuristics that always underestimate the remaining cost  (Understanding heuristics will become very important when we talk about heuristic search A* planning later)
  • 48. Pathfinding: A* heuristic search 48  Basic options to consider for pathfinding problems  Forward/backward/bi-directional search  A*/best-first/weighted A*/…  Domain-dependent/independent heuristics  Manhattan, Chebyshev, Euclidian  Heuristics on Amit's A* pages  Diagonal movement: 4-connected vs 8-connected grid  A* playground to try out different combinations  http://qiao.github.io/PathFinding.js/visual/
  • 50. Pathfinding: A* heuristic search 50 h(n): Euclidean Grid: 4-connected
  • 51. Pathfinding: A* heuristic search 51 h(n): Euclidean Grid: 8-connected
  • 52. Pathfinding: A* heuristic search 52 h(n): Manhattan Grid: 4-connected
  • 53. Pathfinding: A* heuristic search 53 h(n): Manhattan Grid: 8-connected
  • 54. Pathfinding: A* heuristic search 54  In many cases this is all you need to handle pathfinding in a game (modulo tuning your implementation to be efficient)  In AAA modern games though, the game-world is more complicated both in terms of features and in terms of size, and tricks (or research) is needed!
  • 55. Pathfinding: A* heuristic search 55  More complicated game-worlds  Different types of terrain  different cost  Road, path, water, terrain, mud, …  Different type of characters  different cost/ability  Walking units, vehicles, air-units, scouters, …  More than one level  Stairs, elevators, hills, slopes, …  “Nicer” paths are needed!  Smoother curves, more “organic”, with variation, …  The game-world is huge!  Need for memory and CPU efficiency
  • 56. Pathfinding: A* heuristic search 56  More complicated game-worlds  Different types of terrain  different cost  Different type of characters  different cost/ability  More than one level  “Nicer” paths are needed!  The game-world is huge!  We can deal with some of these with simple tricks  There is a lot of applied and research work!  E.g., AI Programming Wisdom book series  Also in top AI/Robotics conferences, e.g., AAAI, ICAPS, AIIDE, IROS
  • 57. Pathfinding: A* heuristic search 57  Commercial game grid-world benchmarks  http://www.movingai.com/benchmarks/
  • 58. Pathfinding: A* heuristic search 58  GPPC: Grid-Based Path Planning Competition  http://movingai.com/GPPC/cfp.html  Maps  Size at most 2048x2048  Static (unchanging)  8-connected  Diagonal actions in an optimal path cost sqrt(2)
  • 59. Pathfinding: A* heuristic search 59  Many neat tricks for efficient/nice pathfinding  Alternative game-world representations  Better heuristics  Beyond A*  But first let’s see how this simple grid representation and A* heuristic works in a game setting in Unity
  • 60. Pathfinding Part 2: Examples in Unity 60