GenerativeArt–MadewithUnity
1
Welcome!
Problem
What time is it?
2
IS IT?
3
NO!
IT’S LUNCH TIME!
4
GenerativeArt–MadewithUnity
5
A three-course
meal in PCG
Jorge Palacios
AI Programmer, Freelancer
@pctroll
• B.Sc. Computer Science
• Ms. Computer Science candidate
• Author
• Drummer
• Rocket League lover
• Love teaching/sharing
About me
6
Experience
7
Let’s talk about PCG
8
PROCEDURAL CONTENT GENERATION
9
Problem
Why do we need/want PCG?
10
Problem
More hours of play.
Same/less budget
11
Evolving enemies
through
Genetic Algorithm
12
Problem
We’d like to have adaptive
enemies
13
The Solution
Enter Genetic Algorithm
14
Genetic Algorithm
in a nutshell Create initial population (and shuffle
them if necessary)
Evaluate individuals and keep the fittest
Generate new offspring from survivors,
and mutate them a little
15
Genetic Algorithm
in a nutshell
16
Genetic Algorithm
in a nutshell
17
μ λ
1. Initialize population of μ + λ
individuals
2. Shuffle them (optional)
3. Evaluate all individuals with the
evaluation function
4. Sort the population in order of
ascending fitness
5. Remove the worst λ individuals
Genetic Algorithm
6. Replace the λ removed
individuals with copies of the
remaining ones
7. Mutate the λ offspring
8. If the population contains an
individual of sufficient quality, or
max number generation is
reached, stop. Otherwise, go
back to 2
18
Editor explanation and run demo
How do we implement it?
19
Building Dungeons
using BSP
20
Problem
We’d like to have rooms
connected by hallways
21
The Solution
22
BINARY SPACE PARTITIONING
23
Start with
the whole
area and
split it in 2
In the middle or just a
pseudo-random value
Keep
splitting
(if
necessary)
Split areas that are
above minimum
defined size
Connect
cells with
hallways
This could get trickier
than expected
Binary Space Partitioning
(the good parts)
24
Binary Space Partitioning
25
A
B C
D E F G
H I
Editor explanation and run demo
How do we implement it?
26
Assembling new levels
with n-grams
27
Problem
We’d like to imitate a level
designer’s style
28
The Solution
Enter N-gram
29
N-gram for level generation
(or how to create a quattro stagioni)
Serialize your levels into slices
Transform those slices into an abstract
version of letter, syllable, or word
Train the system using a trigram
30
Enjoy your freshly baked level
N-gram for level generation
31
N-gram for level generation
32
N-gram for level generation
33
a b c c c d e f c c g h c c c c c c
- - - - a b c d a a e f a a - - - -
Editor explanation and run demo
How do we implement it?
34
Where do we start?
35
GenerativeArt–MadewithUnity
Thank you!!!
¡Gracias!
36
Code and slides at:
github.com/pctroll/unitela2018
@pctroll jorge@reefaktor.com

A Three-Course Meal in Procedural Content Generation