Lecture 5 - Procedural Content Generation

22,761 views
23,084 views

Published on

This is the 5th of an 8 lecture series that I presented at University of Strathclyde in 2011/2012 as part of the final year AI course.

In this lecture I outline some approaches that use AI techniques to automate the creation of content within game world. I make specific reference to assets such as rocks and plants, to interaction mechanisms such as weapons and to quest generating systems, in particular Skyrim's Radiant engine.

0 Comments
1 Like
Statistics
Notes
  • Be the first to comment

No Downloads
Views
Total views
22,761
On SlideShare
0
From Embeds
0
Number of Embeds
20,094
Actions
Shares
0
Downloads
66
Comments
0
Likes
1
Embeds 0
No embeds

No notes for slide

Lecture 5 - Procedural Content Generation

  1. 1. Procedural Generation of Game content
  2. 2. Procedural Content Generation • Procedural Content Generation is the process of using techniques based on AI, maths and other disciplines to automatically create game content. • Consider a game set in a city ‣ How many unique buildings are there in a city? ‣ How frequently could you duplicate a building before players noticed? ‣ What about trees?2
  3. 3. Trees • Trees are complicated. ‣ Easy to get wrong ‣ The same tree over and over breaks immersion ‣ Lots of trees in a forest • You could pay an artist to sit and come up with the look of a whole bunch of trees, then model them, put them into levels etc. ‣ Costly, time consuming, bloats game’s size3
  4. 4. Lindenmayer Systems • L-Systems are recursive grammar rewriting frameworks. • Defined as a tuple (A, S, R) ‣ Alphabet of symbols ‣ Starting state ‣ Rules that are used to rewrite the initial state • Great for creating fractal patterns • Iterate n times to get interesting shapes appearing4
  5. 5. Koch Snowflakes • A : variables - { f } constants - {+, -} • S :f - - f - - f • R :f > f + f - - f + f5
  6. 6. Koch Snowflakes • Board work6
  7. 7. Koch Snowflakes • n=0 : f -- f -- f • n=1 : f + f -- f + f -- f + f -- f + f -- f + f -- f + f • n=2 : f + f -- f + f + f + f + f -- f + f -- f + f -- f + f + f + f -- f + f -- f + f -- f + f + f + f + f -- f + f -- f + f -- f + f + f + f -- f + f -- f + f -- f + f + f + f + f -- f + f -- f + f -- f + f + f + f -- f + f7
  8. 8. Koch Snowflakes • Assign meaning to each component of the alphabet • f draw forwards • + turn 60 degrees right • - turn 60 degrees left8
  9. 9. Koch Snowflakes N=09
  10. 10. Koch Snowflakes N=110
  11. 11. Koch Snowflakes N=211
  12. 12. Koch Snowflakes N=312
  13. 13. Koch Snowflakes N=313
  14. 14. L-System Example • A :Variables : {X, F} Constants : {+, -} • S :X • R : {X > F - [ [X] + X ] + F [ + F X ] - X, F > F F} • Meanings : ‣ F draws forward, X is a dummy variable (no real action) ‣ - + left and right 25 degrees ‣ [ begins subtree, ] returns to start of sub tree14
  15. 15. L-System Example15
  16. 16. L-System Example16
  17. 17. Rocks • Rocks have the same problem as trees. • Seeing the same rock over and over has the same issues as trees. • Rocks can also be generated using L-Systems ‣ “SpeedRock: Procedural rocks through grammar and evolution” Dart, Di Rossi and Togelius, Proceedings of the FDG Workshop on Procedural Content Generation, 201117
  18. 18. Evolving L-Systems • It’s possible to take an L-System definition and represent it chromosomally. • From there we can apply all the kinds of tricks. ‣ Clustering ‣ Evolution • We can evolve “art” based on our L-System representation18
  19. 19. The Morph Lab • Part of the ALife suite at http://alife.fusebox.com • Starts from a single dot, player select the “fittest” candidate from a selection of drawn L-Systems. • Chromosome defines size, colour, rewrite rules and number of iterations to rewrite for. • Rapidly create interesting distinct patterns.19
  20. 20. The Morph Lab • Demo20
  21. 21. Weaponry • Procedural generation can be used for a lot more than art. • We can use it to generate the weapons that the player might find in a game. ‣ Not just the models of the weapons ‣ Also the stats and effects21
  22. 22. Borderlands22
  23. 23. Borderlands • Borderlands has over 650,000 weapons in it. ‣ Different stats ‣ Different models ‣ Different names • In many ways, just a simple combinatorics problem ‣ Given a set of different options for these various parameters, how many ways can we combine them? • Beats sitting down and designing each one by hand!23
  24. 24. Galactic Arms Race24
  25. 25. Galactic Arms Race • GAR uses the cgNEAT algorithm to evolve different types of weaponry in the game. • Fitness is based on the amount a weapon is used • Parameters evolved include ‣ Colour ‣ Effects ‣ Trajectory ‣ Bullet lifetime25
  26. 26. Galactic Arms Race26
  27. 27. Galactic Arms Race • Important - none of the behaviour the GAR weapons exhibit is defined by the developer • Completely emergent • Randomised weapons guided by player preference • Interesting effects appear quickly • Balance could be difficult27
  28. 28. Quests • Typically Role Playing Games (RPG) involve “quests” • A mechanic for giving the player tasks and goals. • Two different types ‣ Storyline - part of the narrative of the game ‣ Side-quest - time-wasting stuff that has no impact other than giving the player things to do.28
  29. 29. Skyrim29
  30. 30. Skyrim - Radiant • Skyrim is the debut for Bethesda’s Radiant quest generator. • Various quest-givers across the world are generating quests procedurally. • Not part of the core story arcs. • Can have an effect on the world.30
  31. 31. Example - Thieves Guild • The Thieves Guild is a group that the player can join • Major quest arc related to the group • Range of side quests ‣ Burglary, pickpocket, “shill” jobs • Each type of quest has standard objectives • The location of the objective changes each time, as do the details e.g. what to steal.31
  32. 32. Mechanics • In order to adequately execute this kind of system ‣ Need a rich selection of potential locations ‣ More immersive when we can talk about specific people rather than generic villagers • What does the player get from this diversion? ‣ Reward ‣ Experience and reputation ‣ Perhaps affects the world more broadly32
  33. 33. Levels • It’s possible not only to generate components of the game such as scenery and objective procedurally. • Also entire environments for the player to experience. • Keeps the game fresh • Enhances replayability33
  34. 34. Tiny Wings • iPhone game based around a bird • Touch the screen to fold wings, untouch to flap wings • Landscape features valleys ‣ Slide down the valley to gain speed ‣ Flip up the other side to fly through the air • Aim is to get as far as possible in a given time34
  35. 35. Tiny Wings35
  36. 36. Tiny Wings • Landscape is broken into discrete islands • Each island has a general character ‣ 1st island has gentle rolling hills ‣ 4th island has sharp, deep valleys • The level changes every day, but the overall tone of it doesn’t. • How can this be achieved?36
  37. 37. Parametric Definitions • Landscape in Tiny Wings is effectively defined by a single function for each island. ‣ Sinosoidal function. ‣ (More likely a unification of several sinosoidals) • We can define the function with parameters ‣ The non-parameterised components define the character ‣ The parameters define the specific shape for today’s level37
  38. 38. Parametric Definitions Sin(x) - note the characteristic roll38
  39. 39. Parametric Definitions Contrast with 2sin(2x) - totally different “character”39
  40. 40. Parametric Definitions 2sin(2x) with 2.3sin(1.8x+15)40
  41. 41. Levels • We can specify the level design in Tiny Wings as a parameterised function. • We can update the parameters on a regular basis to alter the experience the player gets. • We can control the way the experience changes by how the parameters are applied.41
  42. 42. Difficulty • Lots of games give players options of what difficulty they want. • There are obvious (naive) ways we can alter difficulty. ‣ Give bad guys more health / make player weapons deal less damage. ‣ More bad guys. ‣ Fewer items, less ammo42
  43. 43. Difficulty • We can also do stuff that’s way more subtle. ‣ Alter timings ‣ Decrease visibility of “signposts” (markers within the level that cue the player - often subconsciously - where to go) ‣ Mess around with the design of the level in more detail43
  44. 44. Difficulty of Levels • We can make the same kind of manipulations to the functions generating a Tiny Wings level dependent on what difficulty the player has selected ‣ Easy level gives the functions a more gentle curve ‣ Hard level gives the functions a harsher minima • Even within the different islands characters, we can generate “easy” versions and “hard” versions.44
  45. 45. Difficulty in a Mario-style game • Consider a game like Mario • Side scrolling ‣ Lots of jumping over obstacles ‣ Gaps to jump between • How can we modify the difficulty of the level?45
  46. 46. Summary • Procedurally Generated Content ‣ In-game assets ‣ Levels ‣ Quests • Introduced concept of difficulty in games • Talked about the difference between obvious and subtle changes in difficulty46
  47. 47. Next Lecture • Talking about how we can use the player models we created last week to understand video games better • Using these models to build better content47

×