A Procedural Balanced Map Generator with Self-Adaptive Complexity for the Real-Time Strategy Game...

18
A Procedural Balanced Map Generator with Self-Adaptive Complexity for the Real-Time Strategy Game Planet Wars Ra´ ul Lara-Cabrera, Carlos Cotta, Antonio J. Fern´ andez-Leiva Dept. Lenguajes y Ciencias de la Computaci´on, University of M´ alaga, SPAIN http://anyself.wordpress.com http://dnemesis.lcc.uma.es

description

Procedural content generation (PCG) is the programmatic generation of game content using a random or pseudo-random process that results in an unpredictable range of possible gameplay spaces. This methodology brings many advantages to game developers, such as reduced memory consumption. This work presents a procedural balanced map generator for a real-time strategy game: Planet Wars. This generator uses an evolutionary strategy for generating and evolving maps and a tournament system for evaluating the quality of these maps in terms of their balance. We have run several experiments obtaining a set of playable and balanced maps.

Transcript of A Procedural Balanced Map Generator with Self-Adaptive Complexity for the Real-Time Strategy Game...

Page 1: A Procedural Balanced Map Generator with Self-Adaptive Complexity for the Real-Time Strategy Game Planet Wars

A Procedural Balanced Map Generator with Self-AdaptiveComplexity for the Real-Time Strategy Game Planet Wars

Raul Lara-Cabrera,Carlos Cotta,

Antonio J. Fernandez-Leiva

Dept. Lenguajes y Ciencias de laComputacion, University of Malaga,

SPAIN

http://anyself.wordpress.comhttp://dnemesis.lcc.uma.es

Page 2: A Procedural Balanced Map Generator with Self-Adaptive Complexity for the Real-Time Strategy Game Planet Wars

Introduction

Procedural Content Generation

� Creating game content automatically, through algorithmic means.

� Maps, levels, dialogues, characters, rule-sets, weapons...

Benefits

� Reduced memory consumption

� Saving in the expense of manually creating game content

� Endless or infinite games

2 / 16

Page 3: A Procedural Balanced Map Generator with Self-Adaptive Complexity for the Real-Time Strategy Game Planet Wars

PCG in the game industry

Borderlands (Gearbox, 2009)

Uses a PCG system to createweapons, enemies and itemswith different properties.

Minecraft (Mojang, 2011)

Sandbox-building game with aninfinite map which is expandeddynamically.

3 / 16

Page 4: A Procedural Balanced Map Generator with Self-Adaptive Complexity for the Real-Time Strategy Game Planet Wars

Planet Wars

� Real-time strategy (RTS) game based on Galcon and used in theGoogle AI Challenge 2010

� Its objective is to take over all the planets on the map or eliminateall of your opponents ships

4 / 16

Page 5: A Procedural Balanced Map Generator with Self-Adaptive Complexity for the Real-Time Strategy Game Planet Wars

Aims and Scope

1st Goal – Content GenerationUse an evolutionary algorithm to design maps for Planet Wars leadingto balanced games.

Balance is used here as a proxy for attractiveness. Balanced games:

� are more interesting for all kind of players

� increase the motivation of players

� increase the duration of the game

2nd Goal – Self-Adaptation

Explore self-adaptation at different levels in this context.

5 / 16

Page 6: A Procedural Balanced Map Generator with Self-Adaptive Complexity for the Real-Time Strategy Game Planet Wars

Maps

� Maps are plain text files

� Each line represents aplanet

� Planet’s attributes:� X and Y position� Size (growth rate)� Initial number of ships� Owner

6 / 16

Page 7: A Procedural Balanced Map Generator with Self-Adaptive Complexity for the Real-Time Strategy Game Planet Wars

Individuals

...

Planet

x (real)y (real)size (integer)number of ships (integer)

x,y mutation steps (real)size, ships mutation steps (real)

Array of planets (variable length)

7 / 16

Page 8: A Procedural Balanced Map Generator with Self-Adaptive Complexity for the Real-Time Strategy Game Planet Wars

Objective function

fitness =

(1

Nm

Nm∑i=1

Ki · tiPi + Si + 1

)2

Nm = number of matches

Ki = percentage of occupied planets

ti = number of turns

Pi =

∑tij=1

∣∣∣P(1)ij − P

(2)ij

∣∣∣ti

, (difference between number of planets)

Si =

∑tij=1

∣∣∣S (1)ij − S

(2)ij

∣∣∣ti

, (difference between number of ships)

8 / 16

Page 9: A Procedural Balanced Map Generator with Self-Adaptive Complexity for the Real-Time Strategy Game Planet Wars

Objective function

fitness =

(1

Nm

Nm∑i=1

Ki · tiPi + Si + 1

)2

Nm = number of matches

Ki = percentage of occupied planets

ti = number of turns

Pi =

∑tij=1

∣∣∣P(1)ij − P

(2)ij

∣∣∣ti

, (difference between number of planets)

Si =

∑tij=1

∣∣∣S (1)ij − S

(2)ij

∣∣∣ti

, (difference between number of ships)

8 / 16

Page 10: A Procedural Balanced Map Generator with Self-Adaptive Complexity for the Real-Time Strategy Game Planet Wars

Objective function

fitness =

(1

Nm

Nm∑i=1

Ki · tiPi + Si + 1

)2

Nm = number of matches

Ki = percentage of occupied planets

ti = number of turns

Pi =

∑tij=1

∣∣∣P(1)ij − P

(2)ij

∣∣∣ti

, (difference between number of planets)

Si =

∑tij=1

∣∣∣S (1)ij − S

(2)ij

∣∣∣ti

, (difference between number of ships)

8 / 16

Page 11: A Procedural Balanced Map Generator with Self-Adaptive Complexity for the Real-Time Strategy Game Planet Wars

Breeding mechanism

Mutation

� Gaussian perturbation (real)

σ′i = σi · eτ′·N(0,1)+τ ·Ni (0,1)

x ′i = xi + σi · Ni (0, 1)

� Geometrically distributed perturbation (integers)

ς′i = max(1, ςi · eτ ·N(0,1)+τ ′·N(0,1))

ψi = 1 − (ς′i /m)

1 +

√1 +

(ς′im

)2−1

z ′i = zi +

⌊ln(1 − U(0, 1))

ln(1 − ψi )

⌋−⌊ln(1 − U(0, 1))

ln(1 − ψi )

9 / 16

Page 12: A Procedural Balanced Map Generator with Self-Adaptive Complexity for the Real-Time Strategy Game Planet Wars

Breeding mechanism

Recombination

� “cut and splice”

Other parameters

� (µ+ λ) generational scheme with µ = 10 and λ = 100

� Binary tournament selection

10 / 16

Page 13: A Procedural Balanced Map Generator with Self-Adaptive Complexity for the Real-Time Strategy Game Planet Wars

Experiments

� Two experiments (10 executions each):� ES with self-adapting strategy for mutation steps and genome length� ES with self-adapting strategy for mutation steps and fixed genome

length (23 planets)

� 100 generations each execution

� Maximum game length: 400 turns� Evaluation: three bots and three matches on each map

� Google AI Challenge 2010 participants� Ranked in the top 100 out of 4600� Having their source code available

11 / 16

Page 14: A Procedural Balanced Map Generator with Self-Adaptive Complexity for the Real-Time Strategy Game Planet Wars

Results: fitness

0

50000

100000

150000

0 2500 5000 7500 10000evaluations

fitne

ss

12 / 16

Page 15: A Procedural Balanced Map Generator with Self-Adaptive Complexity for the Real-Time Strategy Game Planet Wars

Results: individual size

16

18

20

22

24

26

0 2500 5000 7500 10000evaluations

best

indi

vidu

al s

ize

13 / 16

Page 16: A Procedural Balanced Map Generator with Self-Adaptive Complexity for the Real-Time Strategy Game Planet Wars

Results: maps

14 / 16

Page 17: A Procedural Balanced Map Generator with Self-Adaptive Complexity for the Real-Time Strategy Game Planet Wars

Conclusions

� We have introduced a simple procedural map generator for a RTSgame that is capable of generating balanced maps for two playergames

� The algorithm with self-adapted number of planets has a betterperformance than the algorithm with this value fixed

� High balanced maps tend to have around 17 planets� Future work:

� Interactivity� Pro-activity� Deal with other maps’ features, such as dynamism and aesthetics

15 / 16

Page 18: A Procedural Balanced Map Generator with Self-Adaptive Complexity for the Real-Time Strategy Game Planet Wars

Thanks for your attention!

AnySelf Project

Please find us in Facebook

http://facebook.com/AnySelfProject

and in Twitter

@anyselfproject

16 / 16