SlideShare a Scribd company logo
1 of 35
Download to read offline
Pier Luca Lanzi e Michele Pirovano – Codemotion Milan November 2015
Procedural Content Generation with Unity
Pier Luca Lanzi e Michele Pirovano – Codemotion Milan November 2015
what’s the basic principle?
Pier Luca Lanzi e Michele Pirovano – Codemotion Milan November 2015
f(x) = sin(x)
float y = 0f;
for (float x = 0f; x<6.28f; x+=.01f) {
y = Mathf.Sin(x);
}
Pier Luca Lanzi e Michele Pirovano – Codemotion Milan November 2015
What the ingredients?
domain knowledge
structured randomness
multi-layering
filters, limits & restrictions
specialized algorithms
artificial intelligence
gameplay integration
Pier Luca Lanzi e Michele Pirovano – Codemotion Milan November 2015
Outline
procedural geometry
colors & music
Pier Luca Lanzi e Michele Pirovano – Codemotion Milan November 2015
Procedural Geometry
Pier Luca Lanzi e Michele Pirovano – Codemotion Milan November 2015
Pier Luca Lanzi e Michele Pirovano – Codemotion Milan November 2015
/// specify vertices
Vector3[] vertices = new Vector3[4];
vertices[0] = new Vector3(0.0f, 0.0f, 0.0f);
vertices[1] = new Vector3(0.0f, 0.0f, m_Length);
vertices[2] = new Vector3(m_Width, 0.0f, m_Length);
vertices[3] = new Vector3(m_Width, 0.0f, 0.0f);
/// specify 2 triangles
int[] indices = new int[6];
/// triangle 1
indices[0] = 0;
indices[1] = 1;
indices[2] = 2;
/// triangle 2
indices[3] = 0;
indices[4] = 2;
indices[5] = 3;
/// create the mesh
Mesh mesh = new Mesh();
mesh.vertices = vertices;
mesh.triangles = indices;
mesh.RecalculateBounds();
Pier Luca Lanzi e Michele Pirovano – Codemotion Milan November 2015
/// create the normals
Vector3[] normals = new Vector3[4];
normals[0] = Vector3.up;
normals[1] = Vector3.up;
normals[2] = Vector3.up;
normals[3] = Vector3.up;
mesh.normals = normals;
/// create the UV for the full texture
Vector2[] uv = new Vector2[4];
uv[0] = new Vector2(0.0f, 0.0f);
uv[1] = new Vector2(0.0f, 1.0f);
uv[2] = new Vector2(1.0f, 1.0f);
uv[3] = new Vector2(1.0f, 0.0f);
mesh.uv = uv;
/// create the UV for half texture
Vector2[] uv = new Vector2[4];
uv[0] = new Vector2(0.0f, 0.0f);
uv[1] = new Vector2(0.0f, 1.0f);
uv[2] = new Vector2(0.5f, 1.0f);
uv[3] = new Vector2(0.5f, 0.0f);
mesh.uv = uv;
Pier Luca Lanzi e Michele Pirovano – Codemotion Milan November 2015
public class MeshBuilder
{
public List<Vector3> Vertices;
public List<Vector3> Normals;
public List<Vector2> UVs;
public void AddTriangle(int i0, int i1, int i2);
public Mesh CreateMesh()
}
MeshBuilder meshBuilder = new MeshBuilder();
//Set up the vertices and triangles:
meshBuilder.Vertices.Add(new Vector3(0.0f, 0.0f, 0.0f));
meshBuilder.UVs.Add(new Vector2(0.0f, 0.0f));
meshBuilder.Normals.Add(Vector3.up);
...
meshBuilder.AddTriangle(0, 1, 2);
meshBuilder.AddTriangle(0, 2, 3);
...
Pier Luca Lanzi e Michele Pirovano – Codemotion Milan November 2015
MeshBuilder meshBuilder = new MeshBuilder();
for (int i = 0; i < m_SegmentCount; i++)
{
float z = m_Length * i;
for (int j = 0; j < m_SegmentCount; j++)
{
float x = m_Width * j;
Vector3 offset =
new Vector3(x, Random.Range(0.0f, m_Height), z);
BuildQuad(meshBuilder, offset);
}
}
Pier Luca Lanzi e Michele Pirovano – Codemotion Milan November 2015
12
Pier Luca Lanzi e Michele Pirovano – Codemotion Milan November 2015
Ingredients #1 & #2
Domain Knowledge & Artificial Intelligence
•  Domain Knowledge
§ To generate something you need to know it
§ PCG typically aims at building an artificial level
designer, usually needs domain knowledge
about level design
•  Artificial Intelligence
§ Need algorithms that can work on complex
knowledge and generate plausible content
§ Search-based methods, L-systems, evolutionary
computation, fractals, cellular automata,
agent-based methods, planning, etc.
13
Pier Luca Lanzi e Michele Pirovano – Codemotion Milan November 2015
14
ESEMPIO CON LA CAVE?
ESEMPIO DI DUNGEON?
Pier Luca Lanzi e Michele Pirovano – Codemotion Milan November 2015
Pier Luca Lanzi e Michele Pirovano – Codemotion Milan November 2015
ingredient #3
structured randomness
things look like they have been randomly
generated but it is not completely at random!
Pier Luca Lanzi e Michele Pirovano – Codemotion Milan November 2015
f(x) = sin(x)
Pier Luca Lanzi e Michele Pirovano – Codemotion Milan November 2015
Pier Luca Lanzi e Michele Pirovano – Codemotion Milan November 2015
they both look like “noise”
but one of them feels like it has structure…
it is structured randomness
Pier Luca Lanzi e Michele Pirovano – Codemotion Milan November 2015
Pier Luca Lanzi e Michele Pirovano – Codemotion Milan November 2015
ingredient #4
multi-layering
typically more layers of procedural
content generation are applied in sequence
Pier Luca Lanzi e Michele Pirovano – Codemotion Milan November 2015
•  Warzone 2100
§ Heights & Cliffs
§ Roads
§ Textures
§ Player Bases
§ Local Features
•  Civilization 4
§ Fractal Heightfield
§ Plate Tectonics
§ Tile Types
§ Rivers and Lakes
§ Map Bonuses
Pier Luca Lanzi e Michele Pirovano – Codemotion Milan November 2015
ingredient #5
Filters, Limits & Restrictions
“In Civ3 I would say we even shipped with a sub-standard resource
placement algorithm where all the iron could be concentrated in just
a few small locations on the map, and for one player there may be
literally no way for them to build swordsmen.” – Soren Johnson
"With Civ4 we instituted randomness with limitations. There
always has to be a minimum distance between each element of
iron, or each element of horses, and that completely solved the
problem.” – Soren Johnson
Pier Luca Lanzi e Michele Pirovano – Codemotion Milan November 2015
ingredient #6
specialized algorithms
placing special items, requires special tricks
this tricks must be encoded in the PCG
Pier Luca Lanzi e Michele Pirovano – Codemotion Milan November 2015
1.  Connect all bases, the resources,
pick three random points and
connect them
2.  Apply a customize A* heuristic
and reuse roads!
3.  Customize A* heuristic with
randomize cost of non-road
grid cells.
Pier Luca Lanzi e Michele Pirovano – Codemotion Milan November 2015
ingredient #7
gameplay integration
Is it fun to play? Is the progression adequate?
Pier Luca Lanzi e Michele Pirovano – Codemotion Milan November 2015
Pier Luca Lanzi e Michele Pirovano – Codemotion Milan November 2015
is this all there is?
Pier Luca Lanzi e Michele Pirovano – Codemotion Milan November 2015
PCG
Is it done online?
Or offline?
Is it necessary content?
Or optional?
Do you use random
seeds or parameter
vectors?
Is it stochastic?
Or deterministic?
Generate and test?
Constructive?
Pier Luca Lanzi e Michele Pirovano – Codemotion Milan November 2015
we can do it, so can you!
Pier Luca Lanzi e Michele Pirovano – Codemotion Milan November 2015http://trackgen.pierlucalanzi.net
Pier Luca Lanzi e Michele Pirovano – Codemotion Milan November 2015
http://www.youtube.com/watch?v=uIUYWzdMXog
Pier Luca Lanzi e Michele Pirovano – Codemotion Milan November 2015http://www.michelepirovano.com/portfolio_swordgenerator.php
Pier Luca Lanzi e Michele Pirovano – Codemotion Milan November 2015http://www.michelepirovano.com/portfolio_swordgenerator.php
Pier Luca Lanzi e Michele Pirovano – Codemotion Milan November 2015
http://www.polimigamecollective.org
http://www.facebook.com/polimigamecollective
http://www.youtube.com/PierLucaLanzi

More Related Content

Viewers also liked

Presentazione Open Day del Politecnico di Milano (2016)
Presentazione Open Day del Politecnico di Milano (2016)Presentazione Open Day del Politecnico di Milano (2016)
Presentazione Open Day del Politecnico di Milano (2016)Pier Luca Lanzi
 
Introduzione alla realizzazione di videogiochi - Fun
Introduzione alla realizzazione di videogiochi - FunIntroduzione alla realizzazione di videogiochi - Fun
Introduzione alla realizzazione di videogiochi - FunPier Luca Lanzi
 
Elements for the Theory of Fun
Elements for the Theory of FunElements for the Theory of Fun
Elements for the Theory of FunPier Luca Lanzi
 
Idea Generation and Conceptualization
Idea Generation and ConceptualizationIdea Generation and Conceptualization
Idea Generation and ConceptualizationPier Luca Lanzi
 
DMTM 2015 - 11 Decision Trees
DMTM 2015 - 11 Decision TreesDMTM 2015 - 11 Decision Trees
DMTM 2015 - 11 Decision TreesPier Luca Lanzi
 
DMTM 2015 - 12 Classification Rules
DMTM 2015 - 12 Classification RulesDMTM 2015 - 12 Classification Rules
DMTM 2015 - 12 Classification RulesPier Luca Lanzi
 
DMTM 2015 - 13 Naive bayes, Nearest Neighbours and Other Methods
DMTM 2015 - 13 Naive bayes, Nearest Neighbours and Other MethodsDMTM 2015 - 13 Naive bayes, Nearest Neighbours and Other Methods
DMTM 2015 - 13 Naive bayes, Nearest Neighbours and Other MethodsPier Luca Lanzi
 
Machine Learning and Data Mining: 12 Classification Rules
Machine Learning and Data Mining: 12 Classification RulesMachine Learning and Data Mining: 12 Classification Rules
Machine Learning and Data Mining: 12 Classification RulesPier Luca Lanzi
 
La Matematica e la fisica da Pong ai giochi tripla A
La Matematica e la fisica da Pong ai giochi tripla ALa Matematica e la fisica da Pong ai giochi tripla A
La Matematica e la fisica da Pong ai giochi tripla APier Luca Lanzi
 
Introduzione alla realizzazione di videogiochi - Elementi di game design
Introduzione alla realizzazione di videogiochi - Elementi di game designIntroduzione alla realizzazione di videogiochi - Elementi di game design
Introduzione alla realizzazione di videogiochi - Elementi di game designPier Luca Lanzi
 
Introduzione alla realizzazione di videogiochi - Presentazione del corso
Introduzione alla realizzazione di videogiochi - Presentazione del corsoIntroduzione alla realizzazione di videogiochi - Presentazione del corso
Introduzione alla realizzazione di videogiochi - Presentazione del corsoPier Luca Lanzi
 
Introduzione alla realizzazione di videogiochi - Meccaniche
Introduzione alla realizzazione di videogiochi - MeccanicheIntroduzione alla realizzazione di videogiochi - Meccaniche
Introduzione alla realizzazione di videogiochi - MeccanichePier Luca Lanzi
 
Introduzione alla realizzazione di videogiochi - Game Engine
Introduzione alla realizzazione di videogiochi - Game EngineIntroduzione alla realizzazione di videogiochi - Game Engine
Introduzione alla realizzazione di videogiochi - Game EnginePier Luca Lanzi
 
Engagement through Gamification
Engagement through GamificationEngagement through Gamification
Engagement through GamificationPier Luca Lanzi
 
Game design to enhance ca webinar final 12 16
Game design to enhance ca webinar final 12 16Game design to enhance ca webinar final 12 16
Game design to enhance ca webinar final 12 16Shane Gallagher
 
MDA Framework with SissyFight 3000
MDA Framework with SissyFight 3000MDA Framework with SissyFight 3000
MDA Framework with SissyFight 3000David Gagnon
 
An introduction to the MDA
An introduction to the MDAAn introduction to the MDA
An introduction to the MDALai Ha
 
MeCCSA 2013 Pub Quiz
MeCCSA 2013 Pub QuizMeCCSA 2013 Pub Quiz
MeCCSA 2013 Pub Quiz_
 

Viewers also liked (20)

Presentazione Open Day del Politecnico di Milano (2016)
Presentazione Open Day del Politecnico di Milano (2016)Presentazione Open Day del Politecnico di Milano (2016)
Presentazione Open Day del Politecnico di Milano (2016)
 
Introduzione alla realizzazione di videogiochi - Fun
Introduzione alla realizzazione di videogiochi - FunIntroduzione alla realizzazione di videogiochi - Fun
Introduzione alla realizzazione di videogiochi - Fun
 
The Design Document
The Design DocumentThe Design Document
The Design Document
 
Elements for the Theory of Fun
Elements for the Theory of FunElements for the Theory of Fun
Elements for the Theory of Fun
 
Idea Generation and Conceptualization
Idea Generation and ConceptualizationIdea Generation and Conceptualization
Idea Generation and Conceptualization
 
DMTM 2015 - 11 Decision Trees
DMTM 2015 - 11 Decision TreesDMTM 2015 - 11 Decision Trees
DMTM 2015 - 11 Decision Trees
 
DMTM 2015 - 12 Classification Rules
DMTM 2015 - 12 Classification RulesDMTM 2015 - 12 Classification Rules
DMTM 2015 - 12 Classification Rules
 
DMTM 2015 - 13 Naive bayes, Nearest Neighbours and Other Methods
DMTM 2015 - 13 Naive bayes, Nearest Neighbours and Other MethodsDMTM 2015 - 13 Naive bayes, Nearest Neighbours and Other Methods
DMTM 2015 - 13 Naive bayes, Nearest Neighbours and Other Methods
 
Machine Learning and Data Mining: 12 Classification Rules
Machine Learning and Data Mining: 12 Classification RulesMachine Learning and Data Mining: 12 Classification Rules
Machine Learning and Data Mining: 12 Classification Rules
 
La Matematica e la fisica da Pong ai giochi tripla A
La Matematica e la fisica da Pong ai giochi tripla ALa Matematica e la fisica da Pong ai giochi tripla A
La Matematica e la fisica da Pong ai giochi tripla A
 
Introduzione alla realizzazione di videogiochi - Elementi di game design
Introduzione alla realizzazione di videogiochi - Elementi di game designIntroduzione alla realizzazione di videogiochi - Elementi di game design
Introduzione alla realizzazione di videogiochi - Elementi di game design
 
Introduzione alla realizzazione di videogiochi - Presentazione del corso
Introduzione alla realizzazione di videogiochi - Presentazione del corsoIntroduzione alla realizzazione di videogiochi - Presentazione del corso
Introduzione alla realizzazione di videogiochi - Presentazione del corso
 
Introduzione alla realizzazione di videogiochi - Meccaniche
Introduzione alla realizzazione di videogiochi - MeccanicheIntroduzione alla realizzazione di videogiochi - Meccaniche
Introduzione alla realizzazione di videogiochi - Meccaniche
 
Introduzione alla realizzazione di videogiochi - Game Engine
Introduzione alla realizzazione di videogiochi - Game EngineIntroduzione alla realizzazione di videogiochi - Game Engine
Introduzione alla realizzazione di videogiochi - Game Engine
 
Engagement through Gamification
Engagement through GamificationEngagement through Gamification
Engagement through Gamification
 
Game design to enhance ca webinar final 12 16
Game design to enhance ca webinar final 12 16Game design to enhance ca webinar final 12 16
Game design to enhance ca webinar final 12 16
 
MDA Framework with SissyFight 3000
MDA Framework with SissyFight 3000MDA Framework with SissyFight 3000
MDA Framework with SissyFight 3000
 
An introduction to the MDA
An introduction to the MDAAn introduction to the MDA
An introduction to the MDA
 
Mda for course design 8-12-15
Mda for course design 8-12-15Mda for course design 8-12-15
Mda for course design 8-12-15
 
MeCCSA 2013 Pub Quiz
MeCCSA 2013 Pub QuizMeCCSA 2013 Pub Quiz
MeCCSA 2013 Pub Quiz
 

Similar to Procedural Content Generation with Unity

An Introduction to Procedural Content Generation
An Introduction to Procedural Content GenerationAn Introduction to Procedural Content Generation
An Introduction to Procedural Content GenerationCodemotion
 
Introduction to Procedural Content Generation - Codemotion 29 Novembre 2014
Introduction to Procedural Content Generation - Codemotion 29 Novembre 2014Introduction to Procedural Content Generation - Codemotion 29 Novembre 2014
Introduction to Procedural Content Generation - Codemotion 29 Novembre 2014Pier Luca Lanzi
 
Pier Luca Lanzi, Michele Pirovano - Procedural Content Generation with Unity
Pier Luca Lanzi, Michele Pirovano - Procedural Content Generation with UnityPier Luca Lanzi, Michele Pirovano - Procedural Content Generation with Unity
Pier Luca Lanzi, Michele Pirovano - Procedural Content Generation with UnityCodemotion
 
An evaluation of SimRank and Personalized PageRank to build a recommender sys...
An evaluation of SimRank and Personalized PageRank to build a recommender sys...An evaluation of SimRank and Personalized PageRank to build a recommender sys...
An evaluation of SimRank and Personalized PageRank to build a recommender sys...Paolo Tomeo
 
How to avoid a web 3.0 babele transclusions and folksonomies in a content-a...
How to avoid a web 3.0 babele   transclusions and folksonomies in a content-a...How to avoid a web 3.0 babele   transclusions and folksonomies in a content-a...
How to avoid a web 3.0 babele transclusions and folksonomies in a content-a...Alessandro Confetti
 
Linked Data in the Arts & Humanities 2 - DARIAH Forum
Linked Data in the Arts & Humanities 2 - DARIAH ForumLinked Data in the Arts & Humanities 2 - DARIAH Forum
Linked Data in the Arts & Humanities 2 - DARIAH ForumMichele Barbera
 
Transformers in Vision: From Zero to Hero
Transformers in Vision: From Zero to HeroTransformers in Vision: From Zero to Hero
Transformers in Vision: From Zero to HeroBill Liu
 
Workshop: Arduino for makers - Strumenti Hardware per la prototipazione elett...
Workshop: Arduino for makers - Strumenti Hardware per la prototipazione elett...Workshop: Arduino for makers - Strumenti Hardware per la prototipazione elett...
Workshop: Arduino for makers - Strumenti Hardware per la prototipazione elett...Luigi Francesco Cerfeda
 
Transformers In Vision From Zero to Hero (DLI).pptx
Transformers In Vision From Zero to Hero (DLI).pptxTransformers In Vision From Zero to Hero (DLI).pptx
Transformers In Vision From Zero to Hero (DLI).pptxDeep Learning Italia
 
The State of OW2. OW2con'15, November 17, Paris.
The State of OW2. OW2con'15, November 17, Paris. The State of OW2. OW2con'15, November 17, Paris.
The State of OW2. OW2con'15, November 17, Paris. OW2
 
How to avoid a web 3.0 babele transclusions and folksonomies in a content-a...
How to avoid a web 3.0 babele   transclusions and folksonomies in a content-a...How to avoid a web 3.0 babele   transclusions and folksonomies in a content-a...
How to avoid a web 3.0 babele transclusions and folksonomies in a content-a...Alessandro Confetti
 
Event Sourcing in an Eventually Consistent World
Event Sourcing in an Eventually Consistent WorldEvent Sourcing in an Eventually Consistent World
Event Sourcing in an Eventually Consistent WorldLorenzo Nicora
 
Antlr part3 getting_started_in_c_sharp
Antlr part3 getting_started_in_c_sharpAntlr part3 getting_started_in_c_sharp
Antlr part3 getting_started_in_c_sharpMorteza Zakeri
 
JavaScript for PHP Developers
JavaScript for PHP DevelopersJavaScript for PHP Developers
JavaScript for PHP Developersfunkatron
 
Bluetooth 4.0 and iBeacons in your iOS app - Francesco Novelli - Codemotion M...
Bluetooth 4.0 and iBeacons in your iOS app - Francesco Novelli - Codemotion M...Bluetooth 4.0 and iBeacons in your iOS app - Francesco Novelli - Codemotion M...
Bluetooth 4.0 and iBeacons in your iOS app - Francesco Novelli - Codemotion M...Codemotion
 
NDC London - about IDinLondon
NDC London - about IDinLondonNDC London - about IDinLondon
NDC London - about IDinLondonAdam Bolton
 
FIWARE Accelerator Programme: 80 Milion Euro for Start-Ups and SMEs
FIWARE Accelerator Programme: 80 Milion Euro for Start-Ups and SMEsFIWARE Accelerator Programme: 80 Milion Euro for Start-Ups and SMEs
FIWARE Accelerator Programme: 80 Milion Euro for Start-Ups and SMEsCodemotion
 
Bluetooth 4.0 and iBeacons in your iOS [Codemotion Milan 2014]
Bluetooth 4.0 and iBeacons in your iOS [Codemotion Milan 2014]Bluetooth 4.0 and iBeacons in your iOS [Codemotion Milan 2014]
Bluetooth 4.0 and iBeacons in your iOS [Codemotion Milan 2014]Francesco Novelli
 
3D Computer Graphics with Python
3D Computer Graphics with Python3D Computer Graphics with Python
3D Computer Graphics with PythonMartin Christen
 

Similar to Procedural Content Generation with Unity (20)

An Introduction to Procedural Content Generation
An Introduction to Procedural Content GenerationAn Introduction to Procedural Content Generation
An Introduction to Procedural Content Generation
 
Introduction to Procedural Content Generation - Codemotion 29 Novembre 2014
Introduction to Procedural Content Generation - Codemotion 29 Novembre 2014Introduction to Procedural Content Generation - Codemotion 29 Novembre 2014
Introduction to Procedural Content Generation - Codemotion 29 Novembre 2014
 
Pier Luca Lanzi, Michele Pirovano - Procedural Content Generation with Unity
Pier Luca Lanzi, Michele Pirovano - Procedural Content Generation with UnityPier Luca Lanzi, Michele Pirovano - Procedural Content Generation with Unity
Pier Luca Lanzi, Michele Pirovano - Procedural Content Generation with Unity
 
An evaluation of SimRank and Personalized PageRank to build a recommender sys...
An evaluation of SimRank and Personalized PageRank to build a recommender sys...An evaluation of SimRank and Personalized PageRank to build a recommender sys...
An evaluation of SimRank and Personalized PageRank to build a recommender sys...
 
How to avoid a web 3.0 babele transclusions and folksonomies in a content-a...
How to avoid a web 3.0 babele   transclusions and folksonomies in a content-a...How to avoid a web 3.0 babele   transclusions and folksonomies in a content-a...
How to avoid a web 3.0 babele transclusions and folksonomies in a content-a...
 
Linked Data in the Arts & Humanities 2 - DARIAH Forum
Linked Data in the Arts & Humanities 2 - DARIAH ForumLinked Data in the Arts & Humanities 2 - DARIAH Forum
Linked Data in the Arts & Humanities 2 - DARIAH Forum
 
Transformers in Vision: From Zero to Hero
Transformers in Vision: From Zero to HeroTransformers in Vision: From Zero to Hero
Transformers in Vision: From Zero to Hero
 
Workshop: Arduino for makers - Strumenti Hardware per la prototipazione elett...
Workshop: Arduino for makers - Strumenti Hardware per la prototipazione elett...Workshop: Arduino for makers - Strumenti Hardware per la prototipazione elett...
Workshop: Arduino for makers - Strumenti Hardware per la prototipazione elett...
 
Virtual table tennis
Virtual table tennisVirtual table tennis
Virtual table tennis
 
Transformers In Vision From Zero to Hero (DLI).pptx
Transformers In Vision From Zero to Hero (DLI).pptxTransformers In Vision From Zero to Hero (DLI).pptx
Transformers In Vision From Zero to Hero (DLI).pptx
 
The State of OW2. OW2con'15, November 17, Paris.
The State of OW2. OW2con'15, November 17, Paris. The State of OW2. OW2con'15, November 17, Paris.
The State of OW2. OW2con'15, November 17, Paris.
 
How to avoid a web 3.0 babele transclusions and folksonomies in a content-a...
How to avoid a web 3.0 babele   transclusions and folksonomies in a content-a...How to avoid a web 3.0 babele   transclusions and folksonomies in a content-a...
How to avoid a web 3.0 babele transclusions and folksonomies in a content-a...
 
Event Sourcing in an Eventually Consistent World
Event Sourcing in an Eventually Consistent WorldEvent Sourcing in an Eventually Consistent World
Event Sourcing in an Eventually Consistent World
 
Antlr part3 getting_started_in_c_sharp
Antlr part3 getting_started_in_c_sharpAntlr part3 getting_started_in_c_sharp
Antlr part3 getting_started_in_c_sharp
 
JavaScript for PHP Developers
JavaScript for PHP DevelopersJavaScript for PHP Developers
JavaScript for PHP Developers
 
Bluetooth 4.0 and iBeacons in your iOS app - Francesco Novelli - Codemotion M...
Bluetooth 4.0 and iBeacons in your iOS app - Francesco Novelli - Codemotion M...Bluetooth 4.0 and iBeacons in your iOS app - Francesco Novelli - Codemotion M...
Bluetooth 4.0 and iBeacons in your iOS app - Francesco Novelli - Codemotion M...
 
NDC London - about IDinLondon
NDC London - about IDinLondonNDC London - about IDinLondon
NDC London - about IDinLondon
 
FIWARE Accelerator Programme: 80 Milion Euro for Start-Ups and SMEs
FIWARE Accelerator Programme: 80 Milion Euro for Start-Ups and SMEsFIWARE Accelerator Programme: 80 Milion Euro for Start-Ups and SMEs
FIWARE Accelerator Programme: 80 Milion Euro for Start-Ups and SMEs
 
Bluetooth 4.0 and iBeacons in your iOS [Codemotion Milan 2014]
Bluetooth 4.0 and iBeacons in your iOS [Codemotion Milan 2014]Bluetooth 4.0 and iBeacons in your iOS [Codemotion Milan 2014]
Bluetooth 4.0 and iBeacons in your iOS [Codemotion Milan 2014]
 
3D Computer Graphics with Python
3D Computer Graphics with Python3D Computer Graphics with Python
3D Computer Graphics with Python
 

More from Pier Luca Lanzi

11 Settembre 2021 - Giocare con i Videogiochi
11 Settembre 2021 - Giocare con i Videogiochi11 Settembre 2021 - Giocare con i Videogiochi
11 Settembre 2021 - Giocare con i VideogiochiPier Luca Lanzi
 
Breve Viaggio al Centro dei Videogiochi
Breve Viaggio al Centro dei VideogiochiBreve Viaggio al Centro dei Videogiochi
Breve Viaggio al Centro dei VideogiochiPier Luca Lanzi
 
Global Game Jam 19 @ POLIMI - Morning Welcome
Global Game Jam 19 @ POLIMI - Morning WelcomeGlobal Game Jam 19 @ POLIMI - Morning Welcome
Global Game Jam 19 @ POLIMI - Morning WelcomePier Luca Lanzi
 
Data Driven Game Design @ Campus Party 2018
Data Driven Game Design @ Campus Party 2018Data Driven Game Design @ Campus Party 2018
Data Driven Game Design @ Campus Party 2018Pier Luca Lanzi
 
GGJ18 al Politecnico di Milano - Presentazione che precede la presentazione d...
GGJ18 al Politecnico di Milano - Presentazione che precede la presentazione d...GGJ18 al Politecnico di Milano - Presentazione che precede la presentazione d...
GGJ18 al Politecnico di Milano - Presentazione che precede la presentazione d...Pier Luca Lanzi
 
GGJ18 al Politecnico di Milano - Presentazione di apertura
GGJ18 al Politecnico di Milano - Presentazione di aperturaGGJ18 al Politecnico di Milano - Presentazione di apertura
GGJ18 al Politecnico di Milano - Presentazione di aperturaPier Luca Lanzi
 
Presentation for UNITECH event - January 8, 2018
Presentation for UNITECH event - January 8, 2018Presentation for UNITECH event - January 8, 2018
Presentation for UNITECH event - January 8, 2018Pier Luca Lanzi
 
DMTM Lecture 20 Data preparation
DMTM Lecture 20 Data preparationDMTM Lecture 20 Data preparation
DMTM Lecture 20 Data preparationPier Luca Lanzi
 
DMTM Lecture 19 Data exploration
DMTM Lecture 19 Data explorationDMTM Lecture 19 Data exploration
DMTM Lecture 19 Data explorationPier Luca Lanzi
 
DMTM Lecture 18 Graph mining
DMTM Lecture 18 Graph miningDMTM Lecture 18 Graph mining
DMTM Lecture 18 Graph miningPier Luca Lanzi
 
DMTM Lecture 17 Text mining
DMTM Lecture 17 Text miningDMTM Lecture 17 Text mining
DMTM Lecture 17 Text miningPier Luca Lanzi
 
DMTM Lecture 16 Association rules
DMTM Lecture 16 Association rulesDMTM Lecture 16 Association rules
DMTM Lecture 16 Association rulesPier Luca Lanzi
 
DMTM Lecture 15 Clustering evaluation
DMTM Lecture 15 Clustering evaluationDMTM Lecture 15 Clustering evaluation
DMTM Lecture 15 Clustering evaluationPier Luca Lanzi
 
DMTM Lecture 14 Density based clustering
DMTM Lecture 14 Density based clusteringDMTM Lecture 14 Density based clustering
DMTM Lecture 14 Density based clusteringPier Luca Lanzi
 
DMTM Lecture 13 Representative based clustering
DMTM Lecture 13 Representative based clusteringDMTM Lecture 13 Representative based clustering
DMTM Lecture 13 Representative based clusteringPier Luca Lanzi
 
DMTM Lecture 12 Hierarchical clustering
DMTM Lecture 12 Hierarchical clusteringDMTM Lecture 12 Hierarchical clustering
DMTM Lecture 12 Hierarchical clusteringPier Luca Lanzi
 
DMTM Lecture 11 Clustering
DMTM Lecture 11 ClusteringDMTM Lecture 11 Clustering
DMTM Lecture 11 ClusteringPier Luca Lanzi
 
DMTM Lecture 10 Classification ensembles
DMTM Lecture 10 Classification ensemblesDMTM Lecture 10 Classification ensembles
DMTM Lecture 10 Classification ensemblesPier Luca Lanzi
 
DMTM Lecture 09 Other classificationmethods
DMTM Lecture 09 Other classificationmethodsDMTM Lecture 09 Other classificationmethods
DMTM Lecture 09 Other classificationmethodsPier Luca Lanzi
 
DMTM Lecture 08 Classification rules
DMTM Lecture 08 Classification rulesDMTM Lecture 08 Classification rules
DMTM Lecture 08 Classification rulesPier Luca Lanzi
 

More from Pier Luca Lanzi (20)

11 Settembre 2021 - Giocare con i Videogiochi
11 Settembre 2021 - Giocare con i Videogiochi11 Settembre 2021 - Giocare con i Videogiochi
11 Settembre 2021 - Giocare con i Videogiochi
 
Breve Viaggio al Centro dei Videogiochi
Breve Viaggio al Centro dei VideogiochiBreve Viaggio al Centro dei Videogiochi
Breve Viaggio al Centro dei Videogiochi
 
Global Game Jam 19 @ POLIMI - Morning Welcome
Global Game Jam 19 @ POLIMI - Morning WelcomeGlobal Game Jam 19 @ POLIMI - Morning Welcome
Global Game Jam 19 @ POLIMI - Morning Welcome
 
Data Driven Game Design @ Campus Party 2018
Data Driven Game Design @ Campus Party 2018Data Driven Game Design @ Campus Party 2018
Data Driven Game Design @ Campus Party 2018
 
GGJ18 al Politecnico di Milano - Presentazione che precede la presentazione d...
GGJ18 al Politecnico di Milano - Presentazione che precede la presentazione d...GGJ18 al Politecnico di Milano - Presentazione che precede la presentazione d...
GGJ18 al Politecnico di Milano - Presentazione che precede la presentazione d...
 
GGJ18 al Politecnico di Milano - Presentazione di apertura
GGJ18 al Politecnico di Milano - Presentazione di aperturaGGJ18 al Politecnico di Milano - Presentazione di apertura
GGJ18 al Politecnico di Milano - Presentazione di apertura
 
Presentation for UNITECH event - January 8, 2018
Presentation for UNITECH event - January 8, 2018Presentation for UNITECH event - January 8, 2018
Presentation for UNITECH event - January 8, 2018
 
DMTM Lecture 20 Data preparation
DMTM Lecture 20 Data preparationDMTM Lecture 20 Data preparation
DMTM Lecture 20 Data preparation
 
DMTM Lecture 19 Data exploration
DMTM Lecture 19 Data explorationDMTM Lecture 19 Data exploration
DMTM Lecture 19 Data exploration
 
DMTM Lecture 18 Graph mining
DMTM Lecture 18 Graph miningDMTM Lecture 18 Graph mining
DMTM Lecture 18 Graph mining
 
DMTM Lecture 17 Text mining
DMTM Lecture 17 Text miningDMTM Lecture 17 Text mining
DMTM Lecture 17 Text mining
 
DMTM Lecture 16 Association rules
DMTM Lecture 16 Association rulesDMTM Lecture 16 Association rules
DMTM Lecture 16 Association rules
 
DMTM Lecture 15 Clustering evaluation
DMTM Lecture 15 Clustering evaluationDMTM Lecture 15 Clustering evaluation
DMTM Lecture 15 Clustering evaluation
 
DMTM Lecture 14 Density based clustering
DMTM Lecture 14 Density based clusteringDMTM Lecture 14 Density based clustering
DMTM Lecture 14 Density based clustering
 
DMTM Lecture 13 Representative based clustering
DMTM Lecture 13 Representative based clusteringDMTM Lecture 13 Representative based clustering
DMTM Lecture 13 Representative based clustering
 
DMTM Lecture 12 Hierarchical clustering
DMTM Lecture 12 Hierarchical clusteringDMTM Lecture 12 Hierarchical clustering
DMTM Lecture 12 Hierarchical clustering
 
DMTM Lecture 11 Clustering
DMTM Lecture 11 ClusteringDMTM Lecture 11 Clustering
DMTM Lecture 11 Clustering
 
DMTM Lecture 10 Classification ensembles
DMTM Lecture 10 Classification ensemblesDMTM Lecture 10 Classification ensembles
DMTM Lecture 10 Classification ensembles
 
DMTM Lecture 09 Other classificationmethods
DMTM Lecture 09 Other classificationmethodsDMTM Lecture 09 Other classificationmethods
DMTM Lecture 09 Other classificationmethods
 
DMTM Lecture 08 Classification rules
DMTM Lecture 08 Classification rulesDMTM Lecture 08 Classification rules
DMTM Lecture 08 Classification rules
 

Recently uploaded

Millenials and Fillennials (Ethical Challenge and Responses).pptx
Millenials and Fillennials (Ethical Challenge and Responses).pptxMillenials and Fillennials (Ethical Challenge and Responses).pptx
Millenials and Fillennials (Ethical Challenge and Responses).pptxJanEmmanBrigoli
 
ClimART Action | eTwinning Project
ClimART Action    |    eTwinning ProjectClimART Action    |    eTwinning Project
ClimART Action | eTwinning Projectjordimapav
 
HỌC TỐT TIẾNG ANH 11 THEO CHƯƠNG TRÌNH GLOBAL SUCCESS ĐÁP ÁN CHI TIẾT - CẢ NĂ...
HỌC TỐT TIẾNG ANH 11 THEO CHƯƠNG TRÌNH GLOBAL SUCCESS ĐÁP ÁN CHI TIẾT - CẢ NĂ...HỌC TỐT TIẾNG ANH 11 THEO CHƯƠNG TRÌNH GLOBAL SUCCESS ĐÁP ÁN CHI TIẾT - CẢ NĂ...
HỌC TỐT TIẾNG ANH 11 THEO CHƯƠNG TRÌNH GLOBAL SUCCESS ĐÁP ÁN CHI TIẾT - CẢ NĂ...Nguyen Thanh Tu Collection
 
INTRODUCTION TO CATHOLIC CHRISTOLOGY.pptx
INTRODUCTION TO CATHOLIC CHRISTOLOGY.pptxINTRODUCTION TO CATHOLIC CHRISTOLOGY.pptx
INTRODUCTION TO CATHOLIC CHRISTOLOGY.pptxHumphrey A Beña
 
ICS2208 Lecture6 Notes for SL spaces.pdf
ICS2208 Lecture6 Notes for SL spaces.pdfICS2208 Lecture6 Notes for SL spaces.pdf
ICS2208 Lecture6 Notes for SL spaces.pdfVanessa Camilleri
 
Integumentary System SMP B. Pharm Sem I.ppt
Integumentary System SMP B. Pharm Sem I.pptIntegumentary System SMP B. Pharm Sem I.ppt
Integumentary System SMP B. Pharm Sem I.pptshraddhaparab530
 
4.16.24 21st Century Movements for Black Lives.pptx
4.16.24 21st Century Movements for Black Lives.pptx4.16.24 21st Century Movements for Black Lives.pptx
4.16.24 21st Century Movements for Black Lives.pptxmary850239
 
ROLES IN A STAGE PRODUCTION in arts.pptx
ROLES IN A STAGE PRODUCTION in arts.pptxROLES IN A STAGE PRODUCTION in arts.pptx
ROLES IN A STAGE PRODUCTION in arts.pptxVanesaIglesias10
 
Inclusivity Essentials_ Creating Accessible Websites for Nonprofits .pdf
Inclusivity Essentials_ Creating Accessible Websites for Nonprofits .pdfInclusivity Essentials_ Creating Accessible Websites for Nonprofits .pdf
Inclusivity Essentials_ Creating Accessible Websites for Nonprofits .pdfTechSoup
 
ENG 5 Q4 WEEk 1 DAY 1 Restate sentences heard in one’s own words. Use appropr...
ENG 5 Q4 WEEk 1 DAY 1 Restate sentences heard in one’s own words. Use appropr...ENG 5 Q4 WEEk 1 DAY 1 Restate sentences heard in one’s own words. Use appropr...
ENG 5 Q4 WEEk 1 DAY 1 Restate sentences heard in one’s own words. Use appropr...JojoEDelaCruz
 
EMBODO Lesson Plan Grade 9 Law of Sines.docx
EMBODO Lesson Plan Grade 9 Law of Sines.docxEMBODO Lesson Plan Grade 9 Law of Sines.docx
EMBODO Lesson Plan Grade 9 Law of Sines.docxElton John Embodo
 
Transaction Management in Database Management System
Transaction Management in Database Management SystemTransaction Management in Database Management System
Transaction Management in Database Management SystemChristalin Nelson
 
Presentation Activity 2. Unit 3 transv.pptx
Presentation Activity 2. Unit 3 transv.pptxPresentation Activity 2. Unit 3 transv.pptx
Presentation Activity 2. Unit 3 transv.pptxRosabel UA
 
Influencing policy (training slides from Fast Track Impact)
Influencing policy (training slides from Fast Track Impact)Influencing policy (training slides from Fast Track Impact)
Influencing policy (training slides from Fast Track Impact)Mark Reed
 
Daily Lesson Plan in Mathematics Quarter 4
Daily Lesson Plan in Mathematics Quarter 4Daily Lesson Plan in Mathematics Quarter 4
Daily Lesson Plan in Mathematics Quarter 4JOYLYNSAMANIEGO
 
How to Add Barcode on PDF Report in Odoo 17
How to Add Barcode on PDF Report in Odoo 17How to Add Barcode on PDF Report in Odoo 17
How to Add Barcode on PDF Report in Odoo 17Celine George
 

Recently uploaded (20)

Millenials and Fillennials (Ethical Challenge and Responses).pptx
Millenials and Fillennials (Ethical Challenge and Responses).pptxMillenials and Fillennials (Ethical Challenge and Responses).pptx
Millenials and Fillennials (Ethical Challenge and Responses).pptx
 
FINALS_OF_LEFT_ON_C'N_EL_DORADO_2024.pptx
FINALS_OF_LEFT_ON_C'N_EL_DORADO_2024.pptxFINALS_OF_LEFT_ON_C'N_EL_DORADO_2024.pptx
FINALS_OF_LEFT_ON_C'N_EL_DORADO_2024.pptx
 
ClimART Action | eTwinning Project
ClimART Action    |    eTwinning ProjectClimART Action    |    eTwinning Project
ClimART Action | eTwinning Project
 
HỌC TỐT TIẾNG ANH 11 THEO CHƯƠNG TRÌNH GLOBAL SUCCESS ĐÁP ÁN CHI TIẾT - CẢ NĂ...
HỌC TỐT TIẾNG ANH 11 THEO CHƯƠNG TRÌNH GLOBAL SUCCESS ĐÁP ÁN CHI TIẾT - CẢ NĂ...HỌC TỐT TIẾNG ANH 11 THEO CHƯƠNG TRÌNH GLOBAL SUCCESS ĐÁP ÁN CHI TIẾT - CẢ NĂ...
HỌC TỐT TIẾNG ANH 11 THEO CHƯƠNG TRÌNH GLOBAL SUCCESS ĐÁP ÁN CHI TIẾT - CẢ NĂ...
 
INTRODUCTION TO CATHOLIC CHRISTOLOGY.pptx
INTRODUCTION TO CATHOLIC CHRISTOLOGY.pptxINTRODUCTION TO CATHOLIC CHRISTOLOGY.pptx
INTRODUCTION TO CATHOLIC CHRISTOLOGY.pptx
 
YOUVE_GOT_EMAIL_PRELIMS_EL_DORADO_2024.pptx
YOUVE_GOT_EMAIL_PRELIMS_EL_DORADO_2024.pptxYOUVE_GOT_EMAIL_PRELIMS_EL_DORADO_2024.pptx
YOUVE_GOT_EMAIL_PRELIMS_EL_DORADO_2024.pptx
 
ICS2208 Lecture6 Notes for SL spaces.pdf
ICS2208 Lecture6 Notes for SL spaces.pdfICS2208 Lecture6 Notes for SL spaces.pdf
ICS2208 Lecture6 Notes for SL spaces.pdf
 
Paradigm shift in nursing research by RS MEHTA
Paradigm shift in nursing research by RS MEHTAParadigm shift in nursing research by RS MEHTA
Paradigm shift in nursing research by RS MEHTA
 
Integumentary System SMP B. Pharm Sem I.ppt
Integumentary System SMP B. Pharm Sem I.pptIntegumentary System SMP B. Pharm Sem I.ppt
Integumentary System SMP B. Pharm Sem I.ppt
 
4.16.24 21st Century Movements for Black Lives.pptx
4.16.24 21st Century Movements for Black Lives.pptx4.16.24 21st Century Movements for Black Lives.pptx
4.16.24 21st Century Movements for Black Lives.pptx
 
ROLES IN A STAGE PRODUCTION in arts.pptx
ROLES IN A STAGE PRODUCTION in arts.pptxROLES IN A STAGE PRODUCTION in arts.pptx
ROLES IN A STAGE PRODUCTION in arts.pptx
 
Inclusivity Essentials_ Creating Accessible Websites for Nonprofits .pdf
Inclusivity Essentials_ Creating Accessible Websites for Nonprofits .pdfInclusivity Essentials_ Creating Accessible Websites for Nonprofits .pdf
Inclusivity Essentials_ Creating Accessible Websites for Nonprofits .pdf
 
ENG 5 Q4 WEEk 1 DAY 1 Restate sentences heard in one’s own words. Use appropr...
ENG 5 Q4 WEEk 1 DAY 1 Restate sentences heard in one’s own words. Use appropr...ENG 5 Q4 WEEk 1 DAY 1 Restate sentences heard in one’s own words. Use appropr...
ENG 5 Q4 WEEk 1 DAY 1 Restate sentences heard in one’s own words. Use appropr...
 
EMBODO Lesson Plan Grade 9 Law of Sines.docx
EMBODO Lesson Plan Grade 9 Law of Sines.docxEMBODO Lesson Plan Grade 9 Law of Sines.docx
EMBODO Lesson Plan Grade 9 Law of Sines.docx
 
INCLUSIVE EDUCATION PRACTICES FOR TEACHERS AND TRAINERS.pptx
INCLUSIVE EDUCATION PRACTICES FOR TEACHERS AND TRAINERS.pptxINCLUSIVE EDUCATION PRACTICES FOR TEACHERS AND TRAINERS.pptx
INCLUSIVE EDUCATION PRACTICES FOR TEACHERS AND TRAINERS.pptx
 
Transaction Management in Database Management System
Transaction Management in Database Management SystemTransaction Management in Database Management System
Transaction Management in Database Management System
 
Presentation Activity 2. Unit 3 transv.pptx
Presentation Activity 2. Unit 3 transv.pptxPresentation Activity 2. Unit 3 transv.pptx
Presentation Activity 2. Unit 3 transv.pptx
 
Influencing policy (training slides from Fast Track Impact)
Influencing policy (training slides from Fast Track Impact)Influencing policy (training slides from Fast Track Impact)
Influencing policy (training slides from Fast Track Impact)
 
Daily Lesson Plan in Mathematics Quarter 4
Daily Lesson Plan in Mathematics Quarter 4Daily Lesson Plan in Mathematics Quarter 4
Daily Lesson Plan in Mathematics Quarter 4
 
How to Add Barcode on PDF Report in Odoo 17
How to Add Barcode on PDF Report in Odoo 17How to Add Barcode on PDF Report in Odoo 17
How to Add Barcode on PDF Report in Odoo 17
 

Procedural Content Generation with Unity

  • 1. Pier Luca Lanzi e Michele Pirovano – Codemotion Milan November 2015 Procedural Content Generation with Unity
  • 2. Pier Luca Lanzi e Michele Pirovano – Codemotion Milan November 2015 what’s the basic principle?
  • 3. Pier Luca Lanzi e Michele Pirovano – Codemotion Milan November 2015 f(x) = sin(x) float y = 0f; for (float x = 0f; x<6.28f; x+=.01f) { y = Mathf.Sin(x); }
  • 4. Pier Luca Lanzi e Michele Pirovano – Codemotion Milan November 2015 What the ingredients? domain knowledge structured randomness multi-layering filters, limits & restrictions specialized algorithms artificial intelligence gameplay integration
  • 5. Pier Luca Lanzi e Michele Pirovano – Codemotion Milan November 2015 Outline procedural geometry colors & music
  • 6. Pier Luca Lanzi e Michele Pirovano – Codemotion Milan November 2015 Procedural Geometry
  • 7. Pier Luca Lanzi e Michele Pirovano – Codemotion Milan November 2015
  • 8. Pier Luca Lanzi e Michele Pirovano – Codemotion Milan November 2015 /// specify vertices Vector3[] vertices = new Vector3[4]; vertices[0] = new Vector3(0.0f, 0.0f, 0.0f); vertices[1] = new Vector3(0.0f, 0.0f, m_Length); vertices[2] = new Vector3(m_Width, 0.0f, m_Length); vertices[3] = new Vector3(m_Width, 0.0f, 0.0f); /// specify 2 triangles int[] indices = new int[6]; /// triangle 1 indices[0] = 0; indices[1] = 1; indices[2] = 2; /// triangle 2 indices[3] = 0; indices[4] = 2; indices[5] = 3; /// create the mesh Mesh mesh = new Mesh(); mesh.vertices = vertices; mesh.triangles = indices; mesh.RecalculateBounds();
  • 9. Pier Luca Lanzi e Michele Pirovano – Codemotion Milan November 2015 /// create the normals Vector3[] normals = new Vector3[4]; normals[0] = Vector3.up; normals[1] = Vector3.up; normals[2] = Vector3.up; normals[3] = Vector3.up; mesh.normals = normals; /// create the UV for the full texture Vector2[] uv = new Vector2[4]; uv[0] = new Vector2(0.0f, 0.0f); uv[1] = new Vector2(0.0f, 1.0f); uv[2] = new Vector2(1.0f, 1.0f); uv[3] = new Vector2(1.0f, 0.0f); mesh.uv = uv; /// create the UV for half texture Vector2[] uv = new Vector2[4]; uv[0] = new Vector2(0.0f, 0.0f); uv[1] = new Vector2(0.0f, 1.0f); uv[2] = new Vector2(0.5f, 1.0f); uv[3] = new Vector2(0.5f, 0.0f); mesh.uv = uv;
  • 10. Pier Luca Lanzi e Michele Pirovano – Codemotion Milan November 2015 public class MeshBuilder { public List<Vector3> Vertices; public List<Vector3> Normals; public List<Vector2> UVs; public void AddTriangle(int i0, int i1, int i2); public Mesh CreateMesh() } MeshBuilder meshBuilder = new MeshBuilder(); //Set up the vertices and triangles: meshBuilder.Vertices.Add(new Vector3(0.0f, 0.0f, 0.0f)); meshBuilder.UVs.Add(new Vector2(0.0f, 0.0f)); meshBuilder.Normals.Add(Vector3.up); ... meshBuilder.AddTriangle(0, 1, 2); meshBuilder.AddTriangle(0, 2, 3); ...
  • 11. Pier Luca Lanzi e Michele Pirovano – Codemotion Milan November 2015 MeshBuilder meshBuilder = new MeshBuilder(); for (int i = 0; i < m_SegmentCount; i++) { float z = m_Length * i; for (int j = 0; j < m_SegmentCount; j++) { float x = m_Width * j; Vector3 offset = new Vector3(x, Random.Range(0.0f, m_Height), z); BuildQuad(meshBuilder, offset); } }
  • 12. Pier Luca Lanzi e Michele Pirovano – Codemotion Milan November 2015 12
  • 13. Pier Luca Lanzi e Michele Pirovano – Codemotion Milan November 2015 Ingredients #1 & #2 Domain Knowledge & Artificial Intelligence •  Domain Knowledge § To generate something you need to know it § PCG typically aims at building an artificial level designer, usually needs domain knowledge about level design •  Artificial Intelligence § Need algorithms that can work on complex knowledge and generate plausible content § Search-based methods, L-systems, evolutionary computation, fractals, cellular automata, agent-based methods, planning, etc. 13
  • 14. Pier Luca Lanzi e Michele Pirovano – Codemotion Milan November 2015 14 ESEMPIO CON LA CAVE? ESEMPIO DI DUNGEON?
  • 15. Pier Luca Lanzi e Michele Pirovano – Codemotion Milan November 2015
  • 16. Pier Luca Lanzi e Michele Pirovano – Codemotion Milan November 2015 ingredient #3 structured randomness things look like they have been randomly generated but it is not completely at random!
  • 17. Pier Luca Lanzi e Michele Pirovano – Codemotion Milan November 2015 f(x) = sin(x)
  • 18. Pier Luca Lanzi e Michele Pirovano – Codemotion Milan November 2015
  • 19. Pier Luca Lanzi e Michele Pirovano – Codemotion Milan November 2015 they both look like “noise” but one of them feels like it has structure… it is structured randomness
  • 20. Pier Luca Lanzi e Michele Pirovano – Codemotion Milan November 2015
  • 21. Pier Luca Lanzi e Michele Pirovano – Codemotion Milan November 2015 ingredient #4 multi-layering typically more layers of procedural content generation are applied in sequence
  • 22. Pier Luca Lanzi e Michele Pirovano – Codemotion Milan November 2015 •  Warzone 2100 § Heights & Cliffs § Roads § Textures § Player Bases § Local Features •  Civilization 4 § Fractal Heightfield § Plate Tectonics § Tile Types § Rivers and Lakes § Map Bonuses
  • 23. Pier Luca Lanzi e Michele Pirovano – Codemotion Milan November 2015 ingredient #5 Filters, Limits & Restrictions “In Civ3 I would say we even shipped with a sub-standard resource placement algorithm where all the iron could be concentrated in just a few small locations on the map, and for one player there may be literally no way for them to build swordsmen.” – Soren Johnson "With Civ4 we instituted randomness with limitations. There always has to be a minimum distance between each element of iron, or each element of horses, and that completely solved the problem.” – Soren Johnson
  • 24. Pier Luca Lanzi e Michele Pirovano – Codemotion Milan November 2015 ingredient #6 specialized algorithms placing special items, requires special tricks this tricks must be encoded in the PCG
  • 25. Pier Luca Lanzi e Michele Pirovano – Codemotion Milan November 2015 1.  Connect all bases, the resources, pick three random points and connect them 2.  Apply a customize A* heuristic and reuse roads! 3.  Customize A* heuristic with randomize cost of non-road grid cells.
  • 26. Pier Luca Lanzi e Michele Pirovano – Codemotion Milan November 2015 ingredient #7 gameplay integration Is it fun to play? Is the progression adequate?
  • 27. Pier Luca Lanzi e Michele Pirovano – Codemotion Milan November 2015
  • 28. Pier Luca Lanzi e Michele Pirovano – Codemotion Milan November 2015 is this all there is?
  • 29. Pier Luca Lanzi e Michele Pirovano – Codemotion Milan November 2015 PCG Is it done online? Or offline? Is it necessary content? Or optional? Do you use random seeds or parameter vectors? Is it stochastic? Or deterministic? Generate and test? Constructive?
  • 30. Pier Luca Lanzi e Michele Pirovano – Codemotion Milan November 2015 we can do it, so can you!
  • 31. Pier Luca Lanzi e Michele Pirovano – Codemotion Milan November 2015http://trackgen.pierlucalanzi.net
  • 32. Pier Luca Lanzi e Michele Pirovano – Codemotion Milan November 2015 http://www.youtube.com/watch?v=uIUYWzdMXog
  • 33. Pier Luca Lanzi e Michele Pirovano – Codemotion Milan November 2015http://www.michelepirovano.com/portfolio_swordgenerator.php
  • 34. Pier Luca Lanzi e Michele Pirovano – Codemotion Milan November 2015http://www.michelepirovano.com/portfolio_swordgenerator.php
  • 35. Pier Luca Lanzi e Michele Pirovano – Codemotion Milan November 2015 http://www.polimigamecollective.org http://www.facebook.com/polimigamecollective http://www.youtube.com/PierLucaLanzi