Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.
Evolving Patch-  based Terrains for  use in Video GamesWilliam Raffe, Fabio Zambetta, Xiaodong Li       RMIT University, M...
Outline               Background                      Procedural Terrain Generation.                      Using EA in Cont...
Procedural Terrain          Generation               The creation of virtual terrain through algorithmic               mea...
Height-map TerrainsGECCO’11, July 14th                                   W. Raffe, F. Zambetta, X. Li  Dublin, Ireland    ...
Height-map TerrainsGECCO’11, July 14th                                   W. Raffe, F. Zambetta, X. Li  Dublin, Ireland    ...
Why use EA?               Iterative evolutionary process allows for maps to be refined over               time.           ...
Patch-based Approach               Extract patches from sample terrains.               Initial population can either be:  ...
Extracting Patches               Program takes 8 sample terrains.               Sample terrains are divided into uniform  ...
Recombining Patches          (Roof-Tiling)        Choose a starting patchGECCO’11, July 14th                              ...
Recombining Patches          (Roof-Tiling)        Choose a starting patch        Choose the next patch and overlap        ...
Recombining Patches          (Roof-Tiling)        Choose a starting patch        Choose the next patch and overlap        ...
Recombining Patches          (Roof-Tiling)        Choose a starting patch        Choose the next patch and overlap        ...
Recombining Patches          (Roof-Tiling)        Choose a starting patch        Choose the next patch and overlap        ...
Recombining Patches          (Roof-Tiling)        Choose a starting patch        Choose the next patch and overlap        ...
Stitching Patches      Patches are overlapped to      ensure a smooth transition      from one patch to the next.      Hei...
Terrain Parameters               Number of Patches:                      Less Patches: Larger patch size. Ensures smooth  ...
Patch and Overlap Size                                        IncreaseNumber of Patches = 4 (2x2)            number ofOver...
EA - Representation               Genotype Representation: Patch Map                      A 2D array of patch ID numbers (...
EA - Crossover               Uniform Crossover:                      One parent chosen as base parent.                    ...
Mutation               Each patch given probability to mutate and               is compared to the Mutation Rate          ...
Interactive Evolution:          Parent Selection               User picks terrains that exhibit the features they         ...
Interactive Evolution:          Parent SelectionGECCO’11, July 14th                                   W. Raffe, F. Zambett...
Interactive Evolution:          Gene Selection               User specifies which patches are immune to               cros...
Interactive Evolution:          Gene SelectionGECCO’11, July 14th                                   W. Raffe, F. Zambetta,...
Why use Gene Selection?               Reduce user fatigue!               In short:                      Protect good patch...
Results: Sample Run (1)               Generation 1:                      Randomly generated.GECCO’11, July 14th           ...
Results: Sample Run (2)               Generation 4:                      Main feature starts to appear.GECCO’11, July 14th...
Results: Sample Run (3)               Generation 6:                      Prominent main feature but a few wrong patches.GE...
Results: Sample Run (4)              Four results from four separate runs                      All with the same user goal...
Results: Game Terrain (1)               Original map from the game Halo (left).               Terrain generated by our sys...
Results: Game Terrain (2)               Variations on the result terrain.                      Small variations can result...
Future Challenges               Move towards automated fitness evaluation.                      Retain some manner of Gene...
Questions?GECCO’11, July 14th                                   W. Raffe, F. Zambetta, X. Li  Dublin, Ireland             ...
Upcoming SlideShare
Loading in …5
×

GECCO 2011

263 views

Published on

Procedural content generation of terrain using evolutionary algorithms.

Published in: Education, Technology
  • Be the first to comment

  • Be the first to like this

GECCO 2011

  1. 1. Evolving Patch- based Terrains for use in Video GamesWilliam Raffe, Fabio Zambetta, Xiaodong Li RMIT University, Melbourne, Australia
  2. 2. Outline Background Procedural Terrain Generation. Using EA in Content Generation. Approach Patch-based Terrain Generation • Extracting patches, re-combining patches, and terrain generation parameters. Evolutionary Algorithm • Genetic representation and operators. • Parent and Gene Selection. Results Sample run. Capabilities in generating terrain for games. Future WorkGECCO’11, July 14th W. Raffe, F. Zambetta, X. Li Dublin, Ireland Evolving Patch-based Terrains RMIT University, Australia
  3. 3. Procedural Terrain Generation The creation of virtual terrain through algorithmic means. Reduces the time and skill to create terrain. Focus on game maps Reduce production costs. Increase replay value. Popular techniques include: Fractals Erosion simulation Noise generators Delaunay and Voronoi diagramsGECCO’11, July 14th W. Raffe, F. Zambetta, X. Li Dublin, Ireland Evolving Patch-based Terrains RMIT University, Australia
  4. 4. Height-map TerrainsGECCO’11, July 14th W. Raffe, F. Zambetta, X. Li Dublin, Ireland Evolving Patch-based Terrains RMIT University, Australia
  5. 5. Height-map TerrainsGECCO’11, July 14th W. Raffe, F. Zambetta, X. Li Dublin, Ireland Evolving Patch-based Terrains RMIT University, Australia
  6. 6. Why use EA? Iterative evolutionary process allows for maps to be refined over time. Feedback from users or fitness functions direct the terrain generation process. More control • Generate-and-test vs Constructive. Evolutionary algorithms successfully used on other types of game content. Euphoria character animation Search-based Procedural Content Generation (SBPCG). EA popular option for SBPCG. Has been used to change game content for each player based on their individual preferences and how they play the game.GECCO’11, July 14th W. Raffe, F. Zambetta, X. Li Dublin, Ireland Evolving Patch-based Terrains RMIT University, Australia
  7. 7. Patch-based Approach Extract patches from sample terrains. Initial population can either be: The sample terrains themselves. OR Constructed of randomly selected patches. Conduct Two-Level interactive evolution. Parent Selection Gene Selection Genetic operators create children by swapping individual patches of the selected parents. Repeat interactive evolution on new generation.GECCO’11, July 14th W. Raffe, F. Zambetta, X. Li Dublin, Ireland Evolving Patch-based Terrains RMIT University, Australia
  8. 8. Extracting Patches Program takes 8 sample terrains. Sample terrains are divided into uniform sized patches. Extra height-map data on all sides of each patch is extracted to allow for overlapping. Each patch is: Stored as a 2D array of height values (i.e. a small height-map). Placed in a global patch database. Given a unique ID that is referenced when constructing new terrains.GECCO’11, July 14th W. Raffe, F. Zambetta, X. Li Dublin, Ireland Evolving Patch-based Terrains RMIT University, Australia
  9. 9. Recombining Patches (Roof-Tiling) Choose a starting patchGECCO’11, July 14th W. Raffe, F. Zambetta, X. Li Dublin, Ireland Evolving Patch-based Terrains RMIT University, Australia
  10. 10. Recombining Patches (Roof-Tiling) Choose a starting patch Choose the next patch and overlap it with the one before it.GECCO’11, July 14th W. Raffe, F. Zambetta, X. Li Dublin, Ireland Evolving Patch-based Terrains RMIT University, Australia
  11. 11. Recombining Patches (Roof-Tiling) Choose a starting patch Choose the next patch and overlap it with the one before it. Keep adding patches until an entire row is complete.GECCO’11, July 14th W. Raffe, F. Zambetta, X. Li Dublin, Ireland Evolving Patch-based Terrains RMIT University, Australia
  12. 12. Recombining Patches (Roof-Tiling) Choose a starting patch Choose the next patch and overlap it with the one before it. Keep adding patches until an entire row is complete. Repeat this to create a second row.GECCO’11, July 14th W. Raffe, F. Zambetta, X. Li Dublin, Ireland Evolving Patch-based Terrains RMIT University, Australia
  13. 13. Recombining Patches (Roof-Tiling) Choose a starting patch Choose the next patch and overlap it with the one before it. Keep adding patches until an entire row is complete. Repeat this to create a second row. Overlap the second row with the first.GECCO’11, July 14th W. Raffe, F. Zambetta, X. Li Dublin, Ireland Evolving Patch-based Terrains RMIT University, Australia
  14. 14. Recombining Patches (Roof-Tiling) Choose a starting patch Choose the next patch and overlap it with the one before it. Keep adding patches until an entire row is complete. Repeat this to create a second row. Overlap the second row with the first. Repeat the process of creating rows and adding them to the row before until a full terrain is made.GECCO’11, July 14th W. Raffe, F. Zambetta, X. Li Dublin, Ireland Evolving Patch-based Terrains RMIT University, Australia
  15. 15. Stitching Patches Patches are overlapped to ensure a smooth transition from one patch to the next. Height values in the overlap region are interpolated between the two patches. The height of a vertex is weighted towards one patch or the other based on how far through the overlap region it is. Cubic Spline Interpolation is used to smooth the entries into the overlap region.GECCO’11, July 14th W. Raffe, F. Zambetta, X. Li Dublin, Ireland Evolving Patch-based Terrains RMIT University, Australia
  16. 16. Terrain Parameters Number of Patches: Less Patches: Larger patch size. Ensures smooth flow in terrain but does not allow for variety. More Patches: Smaller patch size. Allows for control over finer details but higher chance jagged terrain. Overlap size: Large Overlap: Can blend patches together to make rolling terrain but lose feature details in each patch. Small Overlap: Creates hard edges which are good for cliff faces but makes the boarders of each patch more obvious.GECCO’11, July 14th W. Raffe, F. Zambetta, X. Li Dublin, Ireland Evolving Patch-based Terrains RMIT University, Australia
  17. 17. Patch and Overlap Size IncreaseNumber of Patches = 4 (2x2) number ofOverlap Size = 80% patches Number of Patches = 81 (9x9) Reduce Overlap Size Overlap Size = 20%GECCO’11, July 14th W. Raffe, F. Zambetta, X. Li Dublin, Ireland Evolving Patch-based Terrains RMIT University, Australia
  18. 18. EA - Representation Genotype Representation: Patch Map A 2D array of patch ID numbers (a Patch Map). Each patch ID corresponds to a patch in the current dataset of patches (extracted from sample terrains at start-up). Dimensions of array reflect how many patches are used to construct each terrain. 13 5 45 22 15 9 Terrain made up of 9 patches (3x3) 34 18 40GECCO’11, July 14th W. Raffe, F. Zambetta, X. Li Dublin, Ireland Evolving Patch-based Terrains RMIT University, Australia
  19. 19. EA - Crossover Uniform Crossover: One parent chosen as base parent. Each patch given a randomly generated probability to crossover If this value is less than the Crossover Rate parameter, patch is switched for patch in same position on other parent, otherwise the patch is kept where it is. Crossover Rate between 0 and 1: Due to randomly chosen base parent, a rate over 0.5 is equivalent to that under 0.5. We mostly used a crossover rate of 0.5 – patches from both parents have equal chance of being present in each child. Crossover rate of 0.2. First parent (white) is base parent.GECCO’11, July 14th W. Raffe, F. Zambetta, X. Li Dublin, Ireland Evolving Patch-based Terrains RMIT University, Australia
  20. 20. Mutation Each patch given probability to mutate and is compared to the Mutation Rate parameter, same as crossover. If the patch is to be mutated, in is replaced with a randomly chosen patch from the dataset of all existing patches. Mutation Rate between 0 and 1: All of our experiments used a mutation rate between 0.1 or 0.3. <0.1 results in not enough variety in children. >0.3 results in too much difference between parent and child and frequent undesirable mutations.GECCO’11, July 14th W. Raffe, F. Zambetta, X. Li Dublin, Ireland Evolving Patch-based Terrains RMIT University, Australia
  21. 21. Interactive Evolution: Parent Selection User picks terrains that exhibit the features they desire. User chooses 0 – 2 parents. No terrains other than those chosen by the user are considered for breeding. 0 parents: All offspring are randomly generated. 1 parent: All offspring are mutated versions of the parent. 2 parents: All offspring are the result of crossover between parents and individual mutations. Elitist selection: User selected parents each have one child that is an exact copy.GECCO’11, July 14th W. Raffe, F. Zambetta, X. Li Dublin, Ireland Evolving Patch-based Terrains RMIT University, Australia
  22. 22. Interactive Evolution: Parent SelectionGECCO’11, July 14th W. Raffe, F. Zambetta, X. Li Dublin, Ireland Evolving Patch-based Terrains RMIT University, Australia
  23. 23. Interactive Evolution: Gene Selection User specifies which patches are immune to crossover and mutation. All selected patches will not change from the base parent. All unselected patches may experience crossover an mutation as usual. Inverse mutation rate: More patches selected, higher chance of mutation for unselected patches. High chance of mutation when only a few patches unselected.GECCO’11, July 14th W. Raffe, F. Zambetta, X. Li Dublin, Ireland Evolving Patch-based Terrains RMIT University, Australia
  24. 24. Interactive Evolution: Gene SelectionGECCO’11, July 14th W. Raffe, F. Zambetta, X. Li Dublin, Ireland Evolving Patch-based Terrains RMIT University, Australia
  25. 25. Why use Gene Selection? Reduce user fatigue! In short: Protect good patches from mutation. Promote the change of bad patches. Swap out these two patches and keep everything else as is. Difficult when only using Parent Selection.GECCO’11, July 14th W. Raffe, F. Zambetta, X. Li Dublin, Ireland Evolving Patch-based Terrains RMIT University, Australia
  26. 26. Results: Sample Run (1) Generation 1: Randomly generated.GECCO’11, July 14th W. Raffe, F. Zambetta, X. Li Dublin, Ireland Evolving Patch-based Terrains RMIT University, Australia
  27. 27. Results: Sample Run (2) Generation 4: Main feature starts to appear.GECCO’11, July 14th W. Raffe, F. Zambetta, X. Li Dublin, Ireland Evolving Patch-based Terrains RMIT University, Australia
  28. 28. Results: Sample Run (3) Generation 6: Prominent main feature but a few wrong patches.GECCO’11, July 14th W. Raffe, F. Zambetta, X. Li Dublin, Ireland Evolving Patch-based Terrains RMIT University, Australia
  29. 29. Results: Sample Run (4) Four results from four separate runs All with the same user goal 9 generations 7 generations 13 generations 16 generationsGECCO’11, July 14th W. Raffe, F. Zambetta, X. Li Dublin, Ireland Evolving Patch-based Terrains RMIT University, Australia
  30. 30. Results: Game Terrain (1) Original map from the game Halo (left). Terrain generated by our system (right). Generated through multiple runs with different parameter settings The resulting terrain from one run was used as a sample terrain to the next run.GECCO’11, July 14th W. Raffe, F. Zambetta, X. Li Dublin, Ireland Evolving Patch-based Terrains RMIT University, Australia
  31. 31. Results: Game Terrain (2) Variations on the result terrain. Small variations can result in new experiences for the player without needing to learn an entirely new map.GECCO’11, July 14th W. Raffe, F. Zambetta, X. Li Dublin, Ireland Evolving Patch-based Terrains RMIT University, Australia
  32. 32. Future Challenges Move towards automated fitness evaluation. Retain some manner of Gene Selection. Refine type of terrain being generated by focusing on a single game genre. Currently, we generate Virtual Terrain but we want one system to generate complete Game Maps Investigate player profiling to drive the evolutionary process. Allows for possibilities in tailoring game maps to individual players.GECCO’11, July 14th W. Raffe, F. Zambetta, X. Li Dublin, Ireland Evolving Patch-based Terrains RMIT University, Australia
  33. 33. Questions?GECCO’11, July 14th W. Raffe, F. Zambetta, X. Li Dublin, Ireland Evolving Patch-based Terrains RMIT University, Australia

×