international workshop on serious games development and applications

29
Designing a PathFinding Algorithm to Enable Dynamic ELIOS Lab 1 1st International Workshop on Serious Games Development & Applications Univ. of Derby, 8 Jul. 2010 RTS Serious Games M. Bardini, F. Bellotti , R. Berta, A. De Gloria ELIOS Lab DIBE – University of Genoa

Upload: elios-lab

Post on 11-May-2015

792 views

Category:

Education


0 download

DESCRIPTION

"Designing a PathFinding Algorithm to Enable Dynamic RTS Serious Games", in Proceedings of International Workshop on Serious Games Development and Applications. University of Derby, Kedleston Road, Derby, UK. July 2010.

TRANSCRIPT

Page 1: International Workshop on Serious Games Development and Applications

Designing a PathFinding Algorithm to Enable

Dynamic

ELIOS Lab

1

1st International Workshop on Serious Games Development & Applications

Univ. of Derby, 8 Jul. 2010

DynamicRTS Serious Games

M. Bardini, F. Bellotti , R. Berta, A. De Gloria

ELIOS LabDIBE – University of Genoa

Page 2: International Workshop on Serious Games Development and Applications

RTS

Popular game categoryTake decisions and move objects on a territory�Continuous time-line

In typical RTS, roads and tracks in the background map are not considered by the application’s logic

2

1st International Workshop on Serious Games Development & Applications

Univ. of Derby, 8 Jul. 2010

application’s logic Just a different pattern, an ornamentNo benefits by passing through them

Page 3: International Workshop on Serious Games Development and Applications

The past of RTS

Popular game series Age Of EmpireTM

and Total WarTM

In the Age of Empire series any unit follows the shortest path, even if it’s a simple worker or a soldier in patrolIn the Total War series roads are used only to enrich maps� In the world map, roads connect different cities

– In this case they are pre-calculated paths

3

1st International Workshop on Serious Games Development & Applications

Univ. of Derby, 8 Jul. 2010

Page 4: International Workshop on Serious Games Development and Applications

And the future?

Recently, UbisoftTM proposed a new RTS for the WWII, R.U.S.ETM

Official news and videosbenefits for using roads�units will gain a speed up for the transfers, so controlling

roads will become vital

4

1st International Workshop on Serious Games Development & Applications

Univ. of Derby, 8 Jul. 2010

roads will become vital

Page 5: International Workshop on Serious Games Development and Applications

Serious Game for Geo-Training

Work in Progress Serious GameTraining military workforces and civil protection personnel on specific target geographic areas

ChallengesLogic�Artificial opponent’s intelligence, levels, resources etc.

5

1st International Workshop on Serious Games Development & Applications

Univ. of Derby, 8 Jul. 2010

�Artificial opponent’s intelligence, levels, resources etc.

Processing of map images used as dynamic inputs.�Semantic interpretation and annotate of images usable

as a background corresponding to the logic of the application

– Identification of points for resource placement– Characterization of the territory– Definition of best paths to destination

Page 6: International Workshop on Serious Games Development and Applications

The idea

A player moves objects on the mapThe system computes the best path & relevant time cost.� Considering the actual nature of the segments

– E.g. roads, fields, wood– standard image segmentation algorithms

RealPathAutomatic procedure for identifying best routes

6

1st International Workshop on Serious Games Development & Applications

Univ. of Derby, 8 Jul. 2010

Automatic procedure for identifying best routes solely relying on the real-time processing of grayscale input images�With parallel computing implementation

Solution for designing levels of RTSsOther geo-referenced applications with paths in outdoor maps

Page 7: International Workshop on Serious Games Development and Applications

Pathfinding

How to extract the nodes of a path-searchtree from a picture?Grid layouts

Polygonal/Tiles Movement, Edge Movement, Vertex Movement�Hybrid solutions

Waypoints as meaningful points in an

7

1st International Workshop on Serious Games Development & Applications

Univ. of Derby, 8 Jul. 2010

Waypoints as meaningful points in an environment

Placed manually, like the connectionsVery efficient tree building

Page 8: International Workshop on Serious Games Development and Applications

The RealPath algorithm

InputRaster image, satellite or aerial�Possibly ortophotos

– Accurate representation of the earth's surface– Adjusted for topographic relief, lens distortion, and

camera tilt

8

1st International Workshop on Serious Games Development & Applications

Univ. of Derby, 8 Jul. 2010

TargetAutomatic definition of waypoints

Page 9: International Workshop on Serious Games Development and Applications

Automatic definition of waypoints

Pre-processingPixel value normalization�0-255 range

Square to enhance gradient

9

1st International Workshop on Serious Games Development & Applications

Univ. of Derby, 8 Jul. 2010

Page 10: International Workshop on Serious Games Development and Applications

Automatic definition of waypoints

A* search to destinationEvery pixel in the image as a possible nodeTraveling cost proportional to the gradient difference�Differentiate among large roads and small

winding roads

10

1st International Workshop on Serious Games Development & Applications

Univ. of Derby, 8 Jul. 2010

winding roads�Cost weighted with the terrain nature

– Terrain recognition

�A gradient threshold prevents off-road traveling and reduce the number of arcs

�The destination point may be off-road, the graph may result unconnected

– a loop gradually reduces the gradient threshold if the graph results to be unconnected

Page 11: International Workshop on Serious Games Development and Applications

Automatic definition of waypoints

A simple animation

11

1st International Workshop on Serious Games Development & Applications

Univ. of Derby, 8 Jul. 2010

Page 12: International Workshop on Serious Games Development and Applications

Optimizations

A* algorithm scrolls all the nodes in the Open List to know whether a node was already created

Critical for a real-time responseOpen List implemented as a Hash Table

12

1st International Workshop on Serious Games Development & Applications

Univ. of Derby, 8 Jul. 2010

Open List implemented as a Hash Table�Constant computational cost for each element,

independent of the search area�The Hash function relies on the position of the

pixel in the image

Page 13: International Workshop on Serious Games Development and Applications

Optimizations

Our work has not considered optimizations for realizing a natural movement for the NPC

Important for 3D gamesLots of solutions already implemented in

13

1st International Workshop on Serious Games Development & Applications

Univ. of Derby, 8 Jul. 2010

Lots of solutions already implemented in current videogamesThe RealPath’s output can be post-processed by a standard algorithm, to smooth the path and move it away from obstacles�Better results expected as computation points

are much more than in waypoint/grid algorithms

Page 14: International Workshop on Serious Games Development and Applications

Pyramidal parallel implementation

Parallel algorithms to speed-up performance in current architecturesPyramidal algorithms, an established family of parallel algorithms for image processing

14

1st International Workshop on Serious Games Development & Applications

Univ. of Derby, 8 Jul. 2010

processingRobust feature extraction

Multilevel-resolutionA pyramid consists of a sequence of scaled and Gaussian-filtered images

Page 15: International Workshop on Serious Games Development and Applications

Pyramidal parallel algorithms

Not a parallel version of A*RealPath designed to exploit parallel executions of A* processing distinct sets of data obtainable through lower-resolution analysis

15

1st International Workshop on Serious Games Development & Applications

Univ. of Derby, 8 Jul. 2010

resolution analysisCompute a very coarse first path

Define an initial set of points andRecursively refine the subpaths until converging to the final path in the original, high-resolution map.

Page 16: International Workshop on Serious Games Development and Applications

Pyramidal parallel algorithms

A data structure (pyramid shape) is needed for

A first, coarse-grain analysis on a small-size imagesubsequent path refinements in ever more

16

1st International Workshop on Serious Games Development & Applications

Univ. of Derby, 8 Jul. 2010

subsequent path refinements in ever more detailed mapsAfter experiments, for a medium-size image (1-4 MB), 3- or 4-level Gaussian pyramids are sufficient

Page 17: International Workshop on Serious Games Development and Applications

Pyramidal parallel algorithms

From the first path (top of the pyramid), a series of n points is chosen

Dividing a path into 30-40 segments usually gives optimal results�Strong dependence on the parallelism level of the

underlying computing architecture

17

1st International Workshop on Serious Games Development & Applications

Univ. of Derby, 8 Jul. 2010

Every subsequent couple of such n points constitutes the start and arrival points of n-1 sub-paths

Every sub-path is independent of each other => separable working data sets => parallelizable computation

Page 18: International Workshop on Serious Games Development and Applications

Pyramidal parallel algorithms

18

1st International Workshop on Serious Games Development & Applications

Univ. of Derby, 8 Jul. 2010

By joining the sub-paths in the original image, a sub-optimal path from the origin to the destination is obtained.

Page 19: International Workshop on Serious Games Development and Applications

Pyramidal parallel algorithms

19

1st International Workshop on Serious Games Development & Applications

Univ. of Derby, 8 Jul. 2010

By joining the sub-paths in the original image, a sub-optimal path from the origin to the destination is obtained.

Page 20: International Workshop on Serious Games Development and Applications

Pyramidal parallel algorithms

A simple animation

20

1st International Workshop on Serious Games Development & Applications

Univ. of Derby, 8 Jul. 2010

Page 21: International Workshop on Serious Games Development and Applications

Experiment

21

1st International Workshop on Serious Games Development & Applications

Univ. of Derby, 8 Jul. 2010

75 paths from 5 pictures (4 US, 1 Afg)

Page 22: International Workshop on Serious Games Development and Applications

Results

Image Rate1- Suburban area. Large and well defined roads 73%2- Metropolis. Narrow and winding roads 67%3- Residential area. Winding, tree avenues (with noise due to

shadows)73%

4- Residential area. Narrower, but less winding roads 93%5- Central area in Kabul. Only dirt roads, difficult to distinguish 60%

22

1st International Workshop on Serious Games Development & Applications

Univ. of Derby, 8 Jul. 2010

5- Central area in Kabul. Only dirt roads, difficult to distinguishalso at naked eye

60%

Success criterion: path was the shortest and at least 95% on roadsIn all cases, start and arrival points were defined on roads

Page 23: International Workshop on Serious Games Development and Applications

Case studies

Naturalistic ortophotos

23

1st International Workshop on Serious Games Development & Applications

Univ. of Derby, 8 Jul. 2010

Rural paths

Page 24: International Workshop on Serious Games Development and Applications

Case studies

Large and compressed orthophoto

24

1st International Workshop on Serious Games Development & Applications

Univ. of Derby, 8 Jul. 2010

Symbolic grey-scale image

Page 25: International Workshop on Serious Games Development and Applications

Time performance

Standard PC platformCPU: Intel Dual Core E6600 2.4 GhzRam: 2 GB, 800 Mhz8 MB cacheOperative System: Windows 7Language: C++, single thread, single task program

25

1st International Workshop on Serious Games Development & Applications

Univ. of Derby, 8 Jul. 2010

Language: C++, single thread, single task program

Mode Time

With hashtable 1 ms

Without hashtable 3,6 ms

Real-Time behaviour

1.4x Memory footprint increase

Page 26: International Workshop on Serious Games Development and Applications

Subpath length & performance

26

1st International Workshop on Serious Games Development & Applications

Univ. of Derby, 8 Jul. 2010

Page 27: International Workshop on Serious Games Development and Applications

Target applications

RealPath to be incorporated into game level editors of RTS games

With RealPath a designer (even an end-user) can load geographic pictures to build game maps

An RTS game player’s task of collecting resources may become repetitive and boring as soon as he has learnt the position of resources and the existing paths

27

1st International Workshop on Serious Games Development & Applications

Univ. of Derby, 8 Jul. 2010

learnt the position of resources and the existing paths in the map

Also strategies in the same battles fields may become trivial for skilled users

RealPath can improve the game’s longevity by supporting a simple and automatic generation of new game mapsThe mods concept

Page 28: International Workshop on Serious Games Development and Applications

Target applications

Peace keeping mission scenariosThe player has to reach destinations for monitoring (they may be placed automatically on the map) and move conveys minimizing attack risks and damagesDecision strategy training combined with the possibility for a player to contextualize his experience in the real target area.

Civil protection scenario

28

1st International Workshop on Serious Games Development & Applications

Univ. of Derby, 8 Jul. 2010

Civil protection scenarioFirst, the whole road network for an area is computed through several iterations of the RealPath algorithmThen, some roads are blocked with a symbol, simulating the damages of the destructive event� e.g., an earthquake

Also in this case, personnel can realistically train on strategies in a real-world environment.

Page 29: International Workshop on Serious Games Development and Applications

Conclusions

A new solution for automatic definition of paths on aerial/satellite images

Costs reduced for creating new game maps, also supporting UGCHigh-performance parallel implementation� GPUs� Now porting on CUDA

29

1st International Workshop on Serious Games Development & Applications

Univ. of Derby, 8 Jul. 2010

The algorithm has been tested with several real-world images, with good results