Pathfinding in partially explored games environments

Preview:

Citation preview

Path finding in partially

explored environments

John StamfordDe Montfort University

Centre for Computational Intelligence

Introduction

• Aims and Objectives

• The Problem

• The Proposed Solution

• Occupancy Grids

• Representation of the Occupancy Grid

• Path Finding Algorithm

• Final Performance

The Problem• Path Finding in Games

• Generally know the environment

• Predefined node based systems

• Works well on tiled based games Bourg (2004 p.128)

Node Based Example - Chin (2012) Tile Based Example – Bourg (2004)

How can we emulate real

world path finding in game

AI systems?

The System• Unity 3D Games Engine

• Physics / Collision Boxes

• Simulates Sonar/LIDAR

• Builds a path based on what it knows about the environment

• Updates the path as it learns more about the environment

The System

• Does not need to know the

environment

• Can adapt in Real Time

with dynamically changing

environments

The System

• Does not need to know the

environment

• Can adapt in Real Time

with dynamically changing

environments

How is ‘knowledge’ store?

ProbablyOccupied

ProbablyEmpty

Unknown

1.00.0 0.5

Occupancy Grids- 100 x 100

- Multidimensional Array (Doubles)

Storage- 10,000

- 8 bit per double

- 9.8 KB (or 0.01 MB)

Representation- Create a dynamic Mesh

- UV Texture every update

Sensor Readings

Updating the Grids values

Zone 1Zone 2 Zone 3

Sub Section

𝑷 𝑯 𝒔𝒏 =𝑷 𝒔𝒏 𝑯 𝑷 𝑯 𝒔𝒏−𝟏

𝑷 𝒔𝒏 𝑯 𝑷 𝑯 𝒔𝒏−𝟏 + 𝑷 𝒔𝒏 ¬𝑯 𝑷 ¬𝑯 𝒔𝒏−𝟏

Grids values are updated using a Bayesian approach as discussed by Murphy (?????)𝐖𝐡𝐞𝐫𝐞 𝑷 𝑯 𝒔𝒏 𝐫𝐞𝐩𝐫𝐞𝐬𝐞𝐧𝐭𝐬 𝐭𝐡𝐞 𝐥𝐚𝐭𝐞𝐬𝐭 𝐎𝐜𝐜𝐮𝐩𝐚𝐧𝐜𝐲 𝐆𝐫𝐢𝐝 𝐯𝐚𝐥𝐮𝐥𝐞𝐬 𝐚𝐧𝐝𝑷 𝒔𝒏 𝑯 𝐫𝐞𝐩𝐫𝐞𝐬𝐞𝐧𝐭𝐬 𝐭𝐡𝐞 𝐜𝐮𝐫𝐫𝐞𝐧𝐭 𝐒𝐨𝐧𝐚𝐫 𝐕𝐚𝐥𝐮𝐞.

𝑷 𝑶𝒄𝒄𝒖𝒑𝒊𝒆𝒅 =

𝑹 − 𝒓𝑹

+𝜷 − 𝜶𝜷

𝟐×𝑴𝒂𝒙𝑶𝒄𝒄𝒖𝒑𝒂𝒏𝒄𝒚

𝑷 𝑬𝒎𝒑𝒕𝒚 = 𝟏 − 𝑷(𝑬𝒎𝒑𝒕𝒚)

𝑷 𝑬𝒎𝒑𝒕𝒚 =

𝑹 − 𝒓𝑹

+𝜷 − 𝜶𝜷

𝟐

𝑷 𝑶𝒄𝒄𝒖𝒑𝒊𝒆𝒅 = 𝟏 − 𝑷(𝑬𝒎𝒑𝒕𝒚)

𝑷 𝑶𝒄𝒄𝒖𝒑𝒊𝒆𝒅 = 𝟎. 𝟓

𝑷 𝑬𝒎𝒑𝒕𝒚 = 𝟏 − 𝑷(𝑬𝒎𝒑𝒕𝒚)

Zon

e 1

Zon

e 2

Zon

e 3

Video 1 – Occupancy Grid

https://www.youtube.com/watch?v=pwfPg2diKOY

Path Finding Methods

• Alternative methods

• A* Algorithm

• Dijlstra’s Algorithm

• Anytime D*

• Final Choice – A*• Bourg (2004 p.126) highlights that A*is the most widely used and fastest

method

• Millington (2009 p.275) discuss performance issues with path finding and

states that the A* can minimise this by the ability for it to be stopped and

started

𝒇 = 𝒈 + 𝒉

G Cost

• Movement Cost

14 10 14

10 10

14 10 14

10

10 10

10

H Cost

5 4 3 2 1 2

4 3 2 1 0 1

5 4 3 2 1 2

6 5 4 3 2 3

7 6 5 4 3 4

8 7 6 5 4 5

HeuristicManhattan

dx + dy

Pre-calculated

Experimental

dx + dy + On

Where On is a value based on the squares Occupancy Grid value

Path Finding Process144 + 10

1313 + 10

123 + 10

144 + 10

1313 + 10

123+ 10

111 + 10

165 + 10

144 + 10

1313 + 10

123 + 10

184 + 10

155 + 10

144 + 10

185 + 10

155 +10

177 + 10

Path Finding - Obstacle

Path Finding - Obstacle

Video 2 – Route Planning

The robot knows...

• The target position

• Its own position

Everything else is automated

https://www.youtube.com/watch?v=ZoWj5-bWGV0

Video 3 – More complex

The robot knows...

• The target position

• Its own position

Everything else is automated

https://www.youtube.com/watch?v=3JRBRpuOxcE

Summary• Overall Performance is good

• Uses sonar based models

• Could be omitted to reduce complexity

• Unique combination of Occupancy Grids and the A* Algorithm

• Fine tuning of tolerances and resolution can be performed for different scenarios

• Low computational costs, however could be better optimised

ReferencesBourg, DM. (2004) AI for Game Developers. 1st Edition. O'Reilly Media.

Chin, R. (2012) “Beginning iOS 3D Unreal Games Development” 1st

Edition. Apress.

Millington, I. (2009) Artificial Intelligence for Games. 2 Edition. CRC

Press.

Murphy, R. (2000) “An Introduction to AI Robotics (Intelligent Robotics

and Autonomous Agents)” 1st Edition. A Bradford Book.

Recommended