Upcoming SlideShare
×

# 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.

1 Like
Statistics
Notes
• Full Name
Comment goes here.

Are you sure you want to Yes No
• Be the first to comment

Views
Total views
22,761
On SlideShare
0
From Embeds
0
Number of Embeds
20,094
Actions
Shares
0
66
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. • Deﬁned 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 Snowﬂakes • A : variables - { f } constants - {+, -} • S :f - - f - - f • R :f > f + f - - f + f5
6. 6. Koch Snowﬂakes • Board work6
7. 7. Koch Snowﬂakes • 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 Snowﬂakes • Assign meaning to each component of the alphabet • f draw forwards • + turn 60 degrees right • - turn 60 degrees left8
9. 9. Koch Snowﬂakes N=09
10. 10. Koch Snowﬂakes N=110
11. 11. Koch Snowﬂakes N=211
12. 12. Koch Snowﬂakes N=312
13. 13. Koch Snowﬂakes 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 deﬁnition 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 “ﬁttest” candidate from a selection of drawn L-Systems. • Chromosome deﬁnes 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 ﬁnd 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 deﬁned by the developer • Completely emergent • Randomised weapons guided by player preference • Interesting effects appear quickly • Balance could be difﬁcult27
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 speciﬁc 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 ﬂap wings • Landscape features valleys ‣ Slide down the valley to gain speed ‣ Flip up the other side to ﬂy 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 Deﬁnitions • Landscape in Tiny Wings is effectively deﬁned by a single function for each island. ‣ Sinosoidal function. ‣ (More likely a uniﬁcation of several sinosoidals) • We can deﬁne the function with parameters ‣ The non-parameterised components deﬁne the character ‣ The parameters deﬁne the speciﬁc shape for today’s level37
38. 38. Parametric Deﬁnitions Sin(x) - note the characteristic roll38
39. 39. Parametric Deﬁnitions Contrast with 2sin(2x) - totally different “character”39
40. 40. Parametric Deﬁnitions 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. Difﬁculty • Lots of games give players options of what difﬁculty they want. • There are obvious (naive) ways we can alter difﬁculty. ‣ Give bad guys more health / make player weapons deal less damage. ‣ More bad guys. ‣ Fewer items, less ammo42
43. 43. Difﬁculty • 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. Difﬁculty of Levels • We can make the same kind of manipulations to the functions generating a Tiny Wings level dependent on what difﬁculty 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. Difﬁculty 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 difﬁculty of the level?45
46. 46. Summary • Procedurally Generated Content ‣ In-game assets ‣ Levels ‣ Quests • Introduced concept of difﬁculty in games • Talked about the difference between obvious and subtle changes in difﬁculty46
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