+ All Categories
Home > Education > CoSECiVi'14 - Designing competitive bots for a real time strategy game using genetic programming

CoSECiVi'14 - Designing competitive bots for a real time strategy game using genetic programming

Date post: 09-Jun-2015
Category:
Upload: sociedad-espanola-para-las-ciencias-del-videojuego
View: 1,131 times
Download: 3 times
Share this document with a friend
Description:
Trabajo Regular presentado en CoSECiVi'14. Resumen: The design of the Artificial Intelligence (AI) engine for an autonomous agent (bot) in a game is always a difficult task mainly done by an expert human player, who has to transform his/her knowledge into a behavioural engine. This paper presents an approach for conducting this task by means of Genetic Programming (GP) application. This algorithm is applied to design decision trees to be used as bot’s AI in 1 vs 1 battles inside the RTS game Planet Wars. Using this method it is possible to create rule-based systems defining decisions and actions, in an automatic way, completely different from a human designer doing them from scratch. These rules will be optimised along the algorithm run, considering the bot’s performance during evaluation matches. As GP can generate and evolve behavioural rules not taken into account by an expert, the obtained bots could perform better than human-defined ones. Due to the difficulties when applying Computational Intelligence techniques in the videogames scope, such as noise factor in the evaluation functions, three different fitness approaches have been implemented and tested in this work. Two of them try to minimize this factor by considering additional dynamic information about the evaluation matches, rather than just the final result (the winner), as the other function does. In order to prove them, the best obtained agents have been compared with a previous bot, created by an expert player (from scratch) and then optimised by means of Genetic Algorithms. The experiments show that the three used fitness functions generate bots that outperform the optimized human-defined one, being the area-based fitness function the one that produces better results.
Popular Tags:
18
Transcript
Page 1: CoSECiVi'14 - Designing competitive bots for a real time strategy game using genetic programming

DesigningCompetitive

Bots for a RealTime StrategyGame usingGenetic

Programming

A.Fernández-Ares,

P.García-Sánchez,A.M.Mora,

P.A.Castillo, andJ.J.Merelo

Introduction

RTSGeneticProgramingPlanet Wars

GPBot

Decisions &Actions

Fitness Functions

Based in VictoriesBased in SlopeBased in Area

ExperimentalSetup

Results

Conclusions

Future Word

Designing Competitive Bots for a Real Time

Strategy Game using Genetic Programming

A.Fernández-Ares, P.García-Sánchez, A.M.Mora,

P.A.Castillo, and J.J.Merelo

Universidad de Granada

June 24, 2014

Page 2: CoSECiVi'14 - Designing competitive bots for a real time strategy game using genetic programming

DesigningCompetitive

Bots for a RealTime StrategyGame usingGenetic

Programming

A.Fernández-Ares,

P.García-Sánchez,A.M.Mora,

P.A.Castillo, andJ.J.Merelo

Introduction

RTSGeneticProgramingPlanet Wars

GPBot

Decisions &Actions

Fitness Functions

Based in VictoriesBased in SlopeBased in Area

ExperimentalSetup

Results

Conclusions

Future Word

Index

Introduction

RTS

Genetic Programing

Planet Wars

GPBot

Decisions & Actions

Fitness Functions

Based in Victories

Based in Slope

Based in Area

Experimental Setup

Results

Conclusions

Future Word

Page 3: CoSECiVi'14 - Designing competitive bots for a real time strategy game using genetic programming

DesigningCompetitive

Bots for a RealTime StrategyGame usingGenetic

Programming

A.Fernández-Ares,

P.García-Sánchez,A.M.Mora,

P.A.Castillo, andJ.J.Merelo

Introduction

RTSGeneticProgramingPlanet Wars

GPBot

Decisions &Actions

Fitness Functions

Based in VictoriesBased in SlopeBased in Area

ExperimentalSetup

Results

Conclusions

Future Word

IntroductionRTS

Real-Time Strategy games (RTS-games)

are a sub-genre of strategy-based video- games in which the

contenders struggle to control a set of resources, units and

structures that are distributed in a playing arena. A proper

control and a sound strategy and tactics for handling these

units is essential for winning the game, which happens after

the game objective has been ful�lled, normally eliminating all

enemy units, but sometimes also when certain points or

game objectives have been reached.

Page 4: CoSECiVi'14 - Designing competitive bots for a real time strategy game using genetic programming

DesigningCompetitive

Bots for a RealTime StrategyGame usingGenetic

Programming

A.Fernández-Ares,

P.García-Sánchez,A.M.Mora,

P.A.Castillo, andJ.J.Merelo

Introduction

RTSGeneticProgramingPlanet Wars

GPBot

Decisions &Actions

Fitness Functions

Based in VictoriesBased in SlopeBased in Area

ExperimentalSetup

Results

Conclusions

Future Word

IntroductionGenetic Programing

Genetic Programming (GP)

is a kind of Evolutionary Algorithm (EA) , that is, a

probabilistic search and optimization algorithms gleaned from

the model of darwinistic evolution, based on the idea that

in nature structures un- dergo adaptation. EAs work on a

population of possible solutions (individuals) for the target

problem and use a selection method that favours better

solutions and a set of operators that act upon the selected

solutions.

Page 5: CoSECiVi'14 - Designing competitive bots for a real time strategy game using genetic programming

DesigningCompetitive

Bots for a RealTime StrategyGame usingGenetic

Programming

A.Fernández-Ares,

P.García-Sánchez,A.M.Mora,

P.A.Castillo, andJ.J.Merelo

Introduction

RTSGeneticProgramingPlanet Wars

GPBot

Decisions &Actions

Fitness Functions

Based in VictoriesBased in SlopeBased in Area

ExperimentalSetup

Results

Conclusions

Future Word

Planet Wars

Page 6: CoSECiVi'14 - Designing competitive bots for a real time strategy game using genetic programming

DesigningCompetitive

Bots for a RealTime StrategyGame usingGenetic

Programming

A.Fernández-Ares,

P.García-Sánchez,A.M.Mora,

P.A.Castillo, andJ.J.Merelo

Introduction

RTSGeneticProgramingPlanet Wars

GPBot

Decisions &Actions

Fitness Functions

Based in VictoriesBased in SlopeBased in Area

ExperimentalSetup

Results

Conclusions

Future Word

Planet Wars

Page 7: CoSECiVi'14 - Designing competitive bots for a real time strategy game using genetic programming

DesigningCompetitive

Bots for a RealTime StrategyGame usingGenetic

Programming

A.Fernández-Ares,

P.García-Sánchez,A.M.Mora,

P.A.Castillo, andJ.J.Merelo

Introduction

RTSGeneticProgramingPlanet Wars

GPBot

Decisions &Actions

Fitness Functions

Based in VictoriesBased in SlopeBased in Area

ExperimentalSetup

Results

Conclusions

Future Word

GPBot

Evolves a set of rules which a Decision Tree.

During the evolution, every individual in the population (a

tree) must be evaluated. To do so, the tree is set as the

behavioural engine of an agent, which is then placed in a

map against a rival in a Planet Wars match. Depending on

the obtained results, the agent (i.e. the individual) gets a

�tness value, that will be considered in the evolutionary

process as a measure of its validity.

Thus, during the match the tree will be used (by the bot) in

order to select the best strategy at every moment, i.e. for

every planet a target will be selected along with the number

of ships to send from one the other.

Page 8: CoSECiVi'14 - Designing competitive bots for a real time strategy game using genetic programming

DesigningCompetitive

Bots for a RealTime StrategyGame usingGenetic

Programming

A.Fernández-Ares,

P.García-Sánchez,A.M.Mora,

P.A.Castillo, andJ.J.Merelo

Introduction

RTSGeneticProgramingPlanet Wars

GPBot

Decisions &Actions

Fitness Functions

Based in VictoriesBased in SlopeBased in Area

ExperimentalSetup

Results

Conclusions

Future Word

GPBotDecisions & Actions

The used Decision Trees are binary trees of expressions

composed by two di�erent types of nodes:

Decisiona logical expression formed by a variable, a less than

operator ($<$), and a number between 0 and 1. It is the

equivalent to a �primitive� in the �eld of GP.

Actiona leave of the tree (therefore, a �terminal�). Each decision is

the name of the method to call from the planet that executes

the tree. This method indicates to which planet send a

percentage of available ships (from 0 to 1).

Page 9: CoSECiVi'14 - Designing competitive bots for a real time strategy game using genetic programming

DesigningCompetitive

Bots for a RealTime StrategyGame usingGenetic

Programming

A.Fernández-Ares,

P.García-Sánchez,A.M.Mora,

P.A.Castillo, andJ.J.Merelo

Introduction

RTSGeneticProgramingPlanet Wars

GPBot

Decisions &Actions

Fitness Functions

Based in VictoriesBased in SlopeBased in Area

ExperimentalSetup

Results

Conclusions

Future Word

Fitness FunctionsBased in Victories

In this approach, an individual is better than another if it

wins in a higher number of maps. In case of equality of

victories, then the individual with more turns to be defeated

(i.e. the stronger one) is considered as better. The maximum

�tness in this work is, therefore, 5 victories and 0 turns.

Page 10: CoSECiVi'14 - Designing competitive bots for a real time strategy game using genetic programming

DesigningCompetitive

Bots for a RealTime StrategyGame usingGenetic

Programming

A.Fernández-Ares,

P.García-Sánchez,A.M.Mora,

P.A.Castillo, andJ.J.Merelo

Introduction

RTSGeneticProgramingPlanet Wars

GPBot

Decisions &Actions

Fitness Functions

Based in VictoriesBased in SlopeBased in Area

ExperimentalSetup

Results

Conclusions

Future Word

Fitness FunctionsBased in Slope

In this case, a square regression analysis is computed in order

to transform the cloud of points into a simple line. The line

is represented as y = α× x + β, where α and β are

calculated as shown in Equations 1 and 2, computing a least

squares regression. For every bot in the simulation we

calculate α and (slope). This slope is the �tness of every bot

for that simulation.

α =

∑n

i=1(Xi − Xi )(Yi − Yi )∑n

i=1(Xi − Xi )2

(1)

β = Y − αX (2)

y = 0.0044x - 0.0531y = -0.0007x + 0.145

y = -0.0005x + 0.1116

y = -0.0002x + 0.1532

-0.2

0

0.2

0.4

0.6

0.8

1

1 101 201

Bot's sh

ips div

ided b

y ALL

ship

s in

gam

e (in

that tu

rn)

Turns

Bot A

Bot B

Bot C

Bot D

Lineal (Bot A)

Lineal (Bot B)

Lineal (Bot C)

Lineal (Bot D)

Page 11: CoSECiVi'14 - Designing competitive bots for a real time strategy game using genetic programming

DesigningCompetitive

Bots for a RealTime StrategyGame usingGenetic

Programming

A.Fernández-Ares,

P.García-Sánchez,A.M.Mora,

P.A.Castillo, andJ.J.Merelo

Introduction

RTSGeneticProgramingPlanet Wars

GPBot

Decisions &Actions

Fitness Functions

Based in VictoriesBased in SlopeBased in Area

ExperimentalSetup

Results

Conclusions

Future Word

Fitness FunctionsBased in Area

In this function, the integral of the curve of the bot's live-line

is used for calculating the area that is `covered' by the �tness

cloud of points (see Equation 3). This area is normalized

considering the number of turns, and thus it represents the

average percentage of ships during the battle for each player.

area =

∫t

0%ships(x)dx

t(3)

0

0.1

0.2

0.3

0.4

0.5

0.6

0.7

0.8

0.9

1

1 101 201

Bot's sh

ip d

ivid

ed b

y ALL

ship

s in

gam

e (in

that tu

rn)

Turns

Bot A

Page 12: CoSECiVi'14 - Designing competitive bots for a real time strategy game using genetic programming

DesigningCompetitive

Bots for a RealTime StrategyGame usingGenetic

Programming

A.Fernández-Ares,

P.García-Sánchez,A.M.Mora,

P.A.Castillo, andJ.J.Merelo

Introduction

RTSGeneticProgramingPlanet Wars

GPBot

Decisions &Actions

Fitness Functions

Based in VictoriesBased in SlopeBased in Area

ExperimentalSetup

Results

Conclusions

Future Word

Experimental Setup

Parameter Name Value

Population size 32

Crossover type Sub-tree crossover

Crossover rate 0.5

Mutation 1-node mutation

Mutation step-size 0.25

Selection 2-tournament

Replacement Steady-state

Stop criterion 50 generations

Maximum Tree Depth 7

Runs per con�guration 30

Evaluation Playing versus GeneBot

Maps 76,69,7,11,26

Page 13: CoSECiVi'14 - Designing competitive bots for a real time strategy game using genetic programming

DesigningCompetitive

Bots for a RealTime StrategyGame usingGenetic

Programming

A.Fernández-Ares,

P.García-Sánchez,A.M.Mora,

P.A.Castillo, andJ.J.Merelo

Introduction

RTSGeneticProgramingPlanet Wars

GPBot

Decisions &Actions

Fitness Functions

Based in VictoriesBased in SlopeBased in Area

ExperimentalSetup

Results

Conclusions

Future Word

ResultsAverage results for each approach at end of the runs (20 executions)

Avg best �tness Avg population �tness

Victory 4.761 ± 0.624 4.345 ± 0.78

Slope 2.296 ± 0.486 2.103 ± 0.434

Area 2.838 ± 1.198 2.347 ± 0.949

Page 14: CoSECiVi'14 - Designing competitive bots for a real time strategy game using genetic programming

DesigningCompetitive

Bots for a RealTime StrategyGame usingGenetic

Programming

A.Fernández-Ares,

P.García-Sánchez,A.M.Mora,

P.A.Castillo, andJ.J.Merelo

Introduction

RTSGeneticProgramingPlanet Wars

GPBot

Decisions &Actions

Fitness Functions

Based in VictoriesBased in SlopeBased in Area

ExperimentalSetup

Results

Conclusions

Future Word

ResultsAverage percentaje victories by each approach VS Genebot (9 executions)

02

04

06

080

10

0VICTORY FITNESS

% V

icto

ries

02

04

06

080

10

0

AREA FITNESS

02

04

06

080

10

0

SLOPE FITNESS

Page 15: CoSECiVi'14 - Designing competitive bots for a real time strategy game using genetic programming

DesigningCompetitive

Bots for a RealTime StrategyGame usingGenetic

Programming

A.Fernández-Ares,

P.García-Sánchez,A.M.Mora,

P.A.Castillo, andJ.J.Merelo

Introduction

RTSGeneticProgramingPlanet Wars

GPBot

Decisions &Actions

Fitness Functions

Based in VictoriesBased in SlopeBased in Area

ExperimentalSetup

Results

Conclusions

Future Word

ResultsAverage percentaje victories of best bot by method vs the Rest

02

04

06

080

10

0VICTORY FITNESS

% V

icto

ries

02

04

06

080

10

0

AREA FITNESS

02

04

06

080

10

0

SLOPE FITNESS

Page 16: CoSECiVi'14 - Designing competitive bots for a real time strategy game using genetic programming

DesigningCompetitive

Bots for a RealTime StrategyGame usingGenetic

Programming

A.Fernández-Ares,

P.García-Sánchez,A.M.Mora,

P.A.Castillo, andJ.J.Merelo

Introduction

RTSGeneticProgramingPlanet Wars

GPBot

Decisions &Actions

Fitness Functions

Based in VictoriesBased in SlopeBased in Area

ExperimentalSetup

Results

Conclusions

Future Word

Conclusions

Genetic Programming

can create competitive bots for RTS games.

FitnessStudy the behaviour of di�erent �tness functions, as they can

a�ect directly to the creation of these bots. Three di�erent

�tness functions have been compared to generate bots for

the Planet Wars game.

EnemiesA competitive bot available in the literature (GeneBot) has

been used to evaluate the generated individuals (�ghting

against it) and have been tested versus others generated

individuals.

Page 17: CoSECiVi'14 - Designing competitive bots for a real time strategy game using genetic programming

DesigningCompetitive

Bots for a RealTime StrategyGame usingGenetic

Programming

A.Fernández-Ares,

P.García-Sánchez,A.M.Mora,

P.A.Castillo, andJ.J.Merelo

Introduction

RTSGeneticProgramingPlanet Wars

GPBot

Decisions &Actions

Fitness Functions

Based in VictoriesBased in SlopeBased in Area

ExperimentalSetup

Results

Conclusions

Future Word

Future Word

I Add other rules to the proposed algorithm (for example,

rules to analyse the map).

I More competitive enemies.

I Implemente and teste in more complex RTS games,

such as Starcraft, or even in di�erent videogames like

Unreal TM or Super Mario TM.

I Coevolutionary Genetic Programming

Page 18: CoSECiVi'14 - Designing competitive bots for a real time strategy game using genetic programming

DesigningCompetitive

Bots for a RealTime StrategyGame usingGenetic

Programming

A.Fernández-Ares,

P.García-Sánchez,A.M.Mora,

P.A.Castillo, andJ.J.Merelo

Introduction

RTSGeneticProgramingPlanet Wars

GPBot

Decisions &Actions

Fitness Functions

Based in VictoriesBased in SlopeBased in Area

ExperimentalSetup

Results

Conclusions

Future Word


Recommended