regular structure, good for optimisation (rendering, collision ... optimisation approach, uses a database of pre-selecte
Genetic Terrain Programming Diploma de Estudios Avanzados Miguel Monteiro de Sousa Frade Supervisors: F. Fernandez de Vega Carlos Cotta Cáceres, 10 July 2008
Summary Introduction Artificial
Terrains Related Work Genetic Terrain Programming Conclusions & Future Work List of publications
Introduction (1) Artificial
terrain generation algorithms have an important role in the video games’ dynamics They help keep the user interested in playing by providing new landscapes There are a wide range of techniques for terrain generation
elaborated methods depend highly upon designer’s skills, time and effort simpler methods allow only a narrow variety of terrain types
Introduction (2) All
current techniques try to generate realistic terrains None of the current techniques is focused on generating terrain accordingly to aesthetic feelings Video games are the most common application for artificial terrain generation algorithms, but they are also used in other fields
Artificial Terrains Terrain
Representation Traditional Generation Techniques Evolutionary Generation Techniques
Artificial Terrains Terrain Representation Height
most common method used to represent terrains Advantages
maps
regular structure, good for optimisation (rendering, collision detection and path finding) equivalence to grey scale images, image processing techniques can be used easy to be generated automatically
Disadvantages
unable to represent caves, overhangs, vertical surfaces finite uniform resolution inadequacy to represent terrains on a planetary scale
Artificial Terrains Traditional Generation Techniques (1) Measuring
built using remote sensing techniques produces highly realistic terrains with very little effort, but at the expenses of control
Modeling
the most flexible technique human artist models the terrain morphology using a 3D modeling program (Blender, 3D Studio, ...) unlimited control over the terrain design and features
Artificial Terrains Traditional Generation Techniques (2) Modeling
(cont.)
these techniques imposes high requirements on the designer in terms of time and effort the output is fully dependent on the designer’s skills
Procedural
can be subdivided in three categories
Physical Spectral synthesis Fractals
Artificial Terrains Traditional Generation Techniques (3) Physical
simulate the real phenomena (e.g. erosion) generates highly realistic terrains difficult to control the output requires in-depth knowledge of the physical laws to implement and use them effectively very demanding in terms of processing power
Spectral
synthesis
computes the inverse FFT over random frequency components does not allow much control on the outcome
Artificial Terrains Traditional Generation Techniques (4) Fractals
fast and simple to implement
is the favourite technique by game’s designers
difficult to control the resulting terrain features based on self-similarity
“What should the terrain look like at this scale?” “Just like it did at the larger scale, but smaller” allows infinite zooms
Artificial Terrains Traditional Generation Techniques (5) Fractals
(cont.)
not all terrains present self-similarity
Artificial Terrains Evolutionary Generation Techniques Terrain
terrain silhouette generation phase
a rough 2D map is used for input
terrain height map generation phase
optimisation approach, uses a database of pre-selected height map samples representative of the different terrain types
can not be used for procedural generation
Genetic
generation using genetic algorithms
Terrain Programming
Aesthetic evolutionary design with genetic programming
Related Work GP
has been the most fruitful evolutionary algorithm applied to evolve images interactively Most prominent works
Karl Sims
Tatsuo Unemi
Panspermia, Primordial Dance, Galapagos SBART
Penousal Machado
NEvAr
Genetic Terrain Programming Goals Method GenTP Results
Tool
Genetic Terrain Programming Goals Address
the weaknesses of existing methods Allow the generation of aesthetic terrains Features: 1. Capable of generating diverse features and terrain types, both aesthetic and realistic 2. Extensibility 3. Intuitive to control 4. Automated generation with arbitrary LOD 5. Low requirements of human input
Genetic Terrain Programming Method (1) Aesthetic
Interactive evolution
accordingly to a desired terrain feature or aesthetic appeal Intuitive to control low human input
Extensibility assured by GP terminals and functions Output of Terrain Programmes (TPs)
evolutionary design with GP
mathematical expression Automated generation with arbitrary LOD
Phenotypes are height maps
Genetic Terrain Programming Method (2) GP
Function set
plus2; minus2; multiply2; sin1; cos1; tan1; atan1; myLog1; myPower2; myDivide2; myMod2; mySqrt1; negative1; FFT1; smooth1; gradientX1; gradientY1
Functions
will operate over matrices that represent height maps Use of some image processing functions
Genetic Terrain Programming Method (3) GP
Terminal set
randomness present on all terminals fftGen; gauss; sphere; step; rand; plane
Genetic Terrain Programming Method (4) GP
parameters
Selection and Fitness – Decided by the designer Population – Fixed size 12 individuals; initial depth limit 6; no tree size limits; random initialisation Parameters – If 2 individuals are selected: 90% subtree crossover and 10% mutation; if just one individual is selected: 50% mutation (without crossover) Termination – Decided by the designer Best individual – Decided by the designer
Genetic Terrain Programming Method (5) GP
individual example (tree representation)
Genetic Terrain Programming GenTP Tool (1) Implemented Functional
modules
with GPLAB, toolbox for Matlab
Genetic Terrain Programming GenTP Tool (2)
Genetic Terrain Programming GenTP Tool (3)
Genetic Terrain Programming Results 3
experiments
1. obtaining aesthetic appealing terrains (regardless of their realism) 2. achieve terrains with a specific feature in mind 3. test the perseverance of terrain features across several resolutions and generation time impact
Genetic Terrain Programming Results - aesthetic terrains (1) TP1 = myLog(sin(mySqrt(smooth(fftGen(1.25)))))
Genetic Terrain Programming Results - aesthetic terrains (2) TP2 = myLog(myLog(myLog(myLog(myLog(myLog(fftGen(3.00)))))))
Genetic Terrain Programming Results - aesthetic terrains (3) TP3 = myPower(cos(myDivide(myLog(smooth(fftGen(2.75))), myMod(sin(fftGen(0.50)), myDivide(myLog(smooth(fftGen(2.75))), myMod((sin(fftGen(0.50))), fftGen(2.25))))))
Genetic Terrain Programming Results - aesthetic terrains (4) TP4 = myLog(myLog(myMod(myLog(fftGen(3.75)), myLog(myLog(fftGen(4.25))))))
Genetic Terrain Programming Results - aesthetic terrains (5) TP5 = myDivide(myDivide(myDivide(myDivide(plane(1), fftGen(4.00)),fftGen(4.00)), fftGen(4.00)), fftGen(4.00))
Genetic Terrain Programming Results - aesthetic terrains (6) obtaining
aesthetic appealing terrains (regardless of their realism) ● ● ● ●
30 to 70 generations wide range of terrain types terrains with exotic look terrains generated by each TP are always different, but still present the same features
Genetic Terrain Programming Results - specific feature in mind (1) TP1 = myMod(smooth(smooth(fftGen(0.50))), smooth(plane(5)))
Cliffs
Genetic Terrain Programming Results - specific feature in mind (2) TP2 = myLog(minus(fftGen(2.75), myLog(minus(smooth(fftGen(1.50)), fftGen(2.50)))))
Corals
Genetic Terrain Programming Results - specific feature in mind (3)
Mo un tain s
TP3 = times(sin(fftGen(3.00)), smooth(times(sin(cos(sin(cos(times( fftGen(1.75), fftGen(0.75)))))), fftGen(0.50))))
Genetic Terrain Programming Results - specific feature in mind (4) TP4 = plus(fftGen(2.00), smooth(myMod(gauss(0.75), cos( fftGen(1.00)))))
Volcanoes
Genetic Terrain Programming Results - specific feature in mind (5) TP5 = myLog(myLog(cos(minus(fftGen(2.00), fftGen(3.75)))))
Rivers
Genetic Terrain Programming Results - specific feature in mind (6) terrains ● ● ●
●
with a specific feature in mind
highly dependent on the initial population generations could vary between 10 to > 100 if after a number of generations an interesting result is not obtained, we have preferred to cancel the experiment and begin again, avoiding this way a long run terrains generated by each TP are always different, but still present the same features
Genetic Terrain Programming Results - LOD (1) TP1 = myLog(myLog(myMod(myLog(fftGen(s, 3.75)), myLog(myLog( fftGen(s, 4.25)))))) 50x50
150x150 450x450
Genetic Terrain Programming Results - LOD (2) TP2 = myPower(cos(myDivide(myLog(smooth(fftGen(s, 2.75))), myMod( sin(fftGen(s, 0.50)), myDivide(myLog(smooth(fftGen(s, 2.75))), myMod((sin(fftGen(s, 0.50))), fftGen(s, 2.25))))))
50x50
150x150 450x450
Genetic Terrain Programming Results - LOD (3) TP3 = times(sin(fftGen(s, 3.00)), smooth(times(sin(cos(sin(cos(times( fftGen(s,1.75), fftGen(s,0.75)))))),fftGen(s, 0.50))))
50x50
150x150 450x450
Genetic Terrain Programming Results - LOD (4) TP4 = plus(fftGen(s, 2.00), smooth(myMod(gauss(s, 0.75),cos( fftGen(s,1.00)))))
50x50
150x150 450x450
Genetic Terrain Programming Results - LOD (5) ●
Perseverance of terrain features across several resolutions ● ●
●
modification of the terminals to include size due to terminals’ randomness, consecutive calls of the same TP will always generate a slightly different terrain feature perseverance independent of the chosen resolution
Genetic Terrain Programming Results - LOD (6) Measuring
generation time
4 different TPs selected, from 7 to 17 GP nodes average time of 10 execution of each TP at each grid sizes from 50x50 to 450x450 Pentium Core 2 Duo 1,66 GHz, 2 GB RAM
Genetic Terrain Programming Results - LOD (7)
Genetic Terrain Programming Results - LOD (8) Time
impact
generation time increases at a quadratic pace generation times also increases with the number of GP nodes, which tend to increase with the number of generations Worst test case:
TP2(450x450) = 3,122 seconds each individual population generation time = 3,122x12 = 37,464 10 seconds is about the limit for keeping the user’s attention focused on the dialogue of an application
Genetic Terrain Programming Results - LOD (9) Time ●
lower resolutions ● ●
●
faster times might require more use of the analyse function increasing the overall generation time
a compromise must be made between generation time and ease of visual evaluation ●
●
impact (continuation)
in our set of experiments the best compromise was 100x100
Short generation times will be also advantageous for the future implementation of automated terrain evolution
Conclusion (1) multiple
execution of the same TP will always generate different terrains, but with the same features allows the evolution of real looking terrains and exotic ones (with an alien semblance) TPs can be used as procedural techniques feature perseverance is independent of the chosen resolution
Conclusion (2) low
resolutions can be used during the evolutionary phase without compromising the result
faster computation times
offers
2 levels of control regarding randomness
a TP will always generate terrains with the same features, so they aren't completely random the seed for the random number generator can be kept the same, allowing the same terrain to be regenerated as many times as desired
Conclusion (3) The
GTP technique
requires less effort and time than modeling techniques to create complex terrains the result is not solely dependent on the designer’s skills
Future Work (1) Incorporate
the GTP technique on a video
game Implement the GTP technique as a Blender plugin Create a database of TPs and allow users to classify them and their resulting features Compose a terrain through the use of several TPs, joined on a credibly and smooth way
Future Work (2) Add
more features so that whole scenarios, including vegetation and buildings, can be generated Develop fitness functions to allow the automatic evolution of TPs
List of Publications
Miguel Frade, F. Fernandez de Vega, and Carlos Cotta. Modelling video games’ landscapes by means of genetic terrain programming – a new approach for improving users’ experience. In EvoWorkshops 2008, volume 4974, pages 485-490, Napoli, Italy, 2008. Springer Miguel Frade, F. Fernandez de Vega, and Carlos Cotta. Genetic Terrain Programming - An Aesthetic Approach to Terrain Generation. In Computer Games and Allied Technology 08, pages 1-8, Singapore, 2008. short listed as best paper – selected for possible publication on International Journal for Computer Games Technology ISSN: 1687-7047 Miguel Frade, F. Fernandez de Vega, and Carlos Cotta. GenTP – Uma Ferramenta Interactiva para a Geração Artificial de Terrenos. In 3rd Iberian Conference in Systems and Information Technologies (CISTI 2008), pages 1-12, Ourense, Spain, 2008 (to appear)
Thank you for your attention
?