tutorial gmo city engine

12
TUTORIAL GMO CITY ENGINE This program is dedicated to design City at urban Scale. It can be adapted specifically to any kind of city. 1. Software Step The program works in 3 main steps : - Analyze of image through color informations (pixel by pixel) and restitution by activities (please note that the original image sould be convert in n zones of color – each color represent 1 activity) nb : please pay attention to the fact that each pixel of one activity zone should have the same value for RGB informations) - Calculation of qualities through rules tables - Calculation of next generation of activities through rules tables GMO City Engine - Tutorial

Upload: girold-stephane

Post on 25-Mar-2016

213 views

Category:

Documents


0 download

DESCRIPTION

Simulation of gentrification growth

TRANSCRIPT

TUTORIAL

GMO CITY ENGINE

This program is dedicated to design City at urban Scale. It can be adapted specifically to any kind of city.

1. Software Step

The program works in 3 main steps :

- Analyze of image through color informations (pixel by pixel) and restitution by activities (please note that the original image sould be convert in n zones of color – each color represent 1 activity)

nb : please pay attention to the fact that each pixel of one activity zone should have the same value for RGB informations)

- Calculation of qualities through rules tables

- Calculation of next generation of activities through rules tables

GMO City Engine - Tutorial

2. Software Functions

2.1 Visualization

At each step of the program, it is possible to have different view of the district :

− by Sound (press “Sound” button)

− by Shadow (press “Sound” button)

GMO City Engine - Tutorial

− by Proximity (press “Sound” button)

− By Global Score (Sound+Shadow+Proximity) (press “Sound” button)

GMO City Engine - Tutorial

− By Density (press “Sound” button)

GMO City Engine - Tutorial

− By Activity (press “Sound” button)

Please note that the colors defined are the same that the colors of the original picture.

It is possible to add or modify cell through the right part of the panel. If you select one type of activity, the program will show the existant cells of this type and then you can affect this type to other cells by click on cell (you can affect only cell by cell).

On the panel, the program give also the number of inhabitants in the district and also the proportion of “

GMO City Engine - Tutorial

2.2 Building

When you press on “Building”, the program will generate next state for cells using defined rules.

2.3 – Public Space

When you press on “PublicSpace”, the program will affect the non affected cell with public spaces through specific rules

2.4 - Export File

When you press on “Export Density” , the program will export a file with Rhino Commands in order to create 3D model of density

Example of Rhino File Exported

_Box -35,-21,0 7 7 1

_Box -35,-28,0 7 7 1

_Box -35,-35,0 7 7 1

_Box -35,-42,0 7 7 1

_Box -35,-595,0 7 7 84

_Box -42,-7,0 7 7 1

_Box -42,-14,0 7 7 1

_Box -42,-21,0 7 7 1

_Box -42,-28,0 7 7 1

_Box -42,-35,0 7 7 1

_Box -42,-42,0 7 7 1

_Box -42,-581,0 7 7 1

_Box -42,-588,0 7 7 1

_Box -42,-595,0 7 7 84

2.5 – Initialize

When you press on “Initialize”, the program will start from beginning with a black Window

GMO City Engine - Tutorial

3. Script functions

void setup : initialization of parameters and definition of rules

void draw : calculation of qualities and drawing of each view

void reinit : reinitialization of all the datas

void mousePressed : allows action on screen in order to change view (modification of initial parameters) or to change cell's activity

void analyse : read the pixels of the original picture to transform into CA

void expansion ; calculate the next generation of cells for bulding cells

void expansion_green : calculate the next generation for public spaces

void expansion_green_last : calculate the last generation of public spaces

void export : exportation for Rhino 3D model

void calcul : calculate the number of inhabitants on the site and also the public space percentage

4. Configuration

In order to adapt the program to any configuration, here are the parameters you have to modify :

3.1 – Declaration via matrix

// Declaration of rulesint[][][] rules;int[][][] world;int nbactivity=12; // number of activities to declareint[][][] Score;int[][] trace;

GMO City Engine - Tutorial

int[][] actcolor;String[] actname;int[][][] Density;

3.1 – Rules of quality calculation

in void setup() { ….

frameRate(12); background(0); img = loadImage("stuttroadnonlisse.jpg"); // image of the site with colors img1 = loadImage("stuttcadre.png"); // image of the perimeter of the size (png file) sx = 444; // Exact width of the picture img sy = 700;// Exact height of the picture img cellsize=7; // size of a cell in pixel tolerance=10; // color tolerance in RGB value

// 1=Site actname[0]="Our Site"; // name of the activity “0” actcolor[0][0]=240; // Red Value for activity actcolor[0][1]=240; // Green Value for activity actcolor[0][2]=240; // Blue Value for activity

// rules[q][a][t] with q=quality a=activity t=type of value// q=0 => sound ; q=1 => sun ; q=2 => proximity// a=index of activity from 0 to nbactivity // t=0 => radius ; t=1 => value of influence rules[0][0][0]=0; // radius for sound rules[0][0][1]=0; // influence parameter for sound

rules[1][0][0]=0;// radius for sun rules[1][0][1]=0;// influence parameter for sun

rules[2][0][0]=0;// radius for proximity rules[2][0][1]=0;// influence parameter for proximity

// 1=Parc actname[1]="Parc"; actcolor[1][0]=0; actcolor[1][1]=255; actcolor[1][2]=1;

GMO City Engine - Tutorial

rules[0][1][0]=2; rules[0][1][1]=1;

rules[1][1][0]=1; rules[1][1][1]=30;

rules[2][1][0]=5; rules[2][1][1]=5;............. do the same for all the activities

3.2 – Rules of affectation

This rules should be specifically coded for your rules.

in void expansion() { ….

// Creation de bureau, si on est proche bruit, ombre et avec logement a proximite : if ((100-Score[0][x][y] < 10) && (world[x][y][0] == 0) && (neighborsBuildNumber(x,y,1)>=4) && ((neighborsProximity(x, y, 8, 20,100)==100) || (neighborsTypeNumber(x, y, 9, 2)>=5)) && (neighborsProximity(x, y, 8, 2,100)!=100)) {

int rdm=floor(random(0,10)); switch(rdm) { case 0: world[x][y][0] = 12; Density[x][y][0]=1; break; case 1: world[x][y][0] = 12; Density[x][y][0]=1; break; case 2: world[x][y][0] = 12; Density[x][y][0]=1; break; case 3: world[x][y][0] = 6; Density[x][y][0]=1; break; case 4: world[x][y][0] = 7;

GMO City Engine - Tutorial

Density[x][y][0]=1; break; case 5: world[x][y][0] = 7; Density[x][y][0]=1; break; } }

3.3 – Rules of final public space affectation

This rules should be specifically coded for your rules.

void expansion_green() {

for (int x = 0; x < sx; x=x+cellsize) { for (int y = 0; y < sy; y=y+cellsize) { // Creation de square if ((neighborsBuildNumber(x,y,1)>5) && (Score[2][x][y]>=60) && (world[x][y][0] == 33) ) { world[x][y][0] =11; Density[x][y][0]=1; } // Creation de parc if ((neighborsBuildNumber(x,y,1)>=4) && (Score[2][x][y]>=25) && (world[x][y][0] == 33) ) { world[x][y][0] =1; Density[x][y][0]=1; } if ((world[x][y][0] == 33) && (Score[0][x][y]<30) ) { world[x][y][0] =10; Density[x][y][0]=1; } if ((Score[2][x][y]>80) && (neighborsProximity(x, y, 2, 1,100)==100) && (world[x][y][0] ==0)) { world[x][y][0] =10; Density[x][y][0]=1; } if ((world[x][y][0] == 33) ) { world[x][y][0] =10;

GMO City Engine - Tutorial

Density[x][y][0]=1; } } }}

3.4 – Subfunctions use in rules of affectations

• neighborsProximity(int x, int y, int type, int radius, int answer)

check if there is at least one cell of type “type” in the neighborhood of radius “radius” around the cell in the position x/y.If “yes” => answerIn “No” => Oint neighborsProximity(int x, int y, int type, int radius, int answer) { for (int vert = -radius; vert <= radius; vert=vert+1) { for (int hori = -radius; hori <= radius; hori=hori+1) { if ((x+cellsize*hori >= 0) && (x+cellsize*hori <= sx) && (y+cellsize*vert >= 0) && (y+cellsize*vert <= sy)) { if ((hori == 0) && (vert == 0)) { //comment } else { if (world[x+cellsize*hori][y+cellsize*vert][0] == type) { return answer; } } } } } return 0; }

• neighborsTypeNumber(int x, int y, int type, int radius)

calculate the number of cells of type “type” in the neighborhood of radius “radius” around the cell in the position x/y.int neighborsTypeNumber(int x, int y, int type, int radius) { int number=0;

GMO City Engine - Tutorial

for (int vert = -radius; vert <= radius; vert=vert+1) { for (int hori = -radius; hori <= radius; hori=hori+1) { if ((x+cellsize*hori >= 0) && (x+cellsize*hori <= sx) && (y+cellsize*vert >= 0) && (y+cellsize*vert <= sy)) { if ((hori == 0) && (vert == 0)) { //comment } else { if (world[x+cellsize*hori][y+cellsize*vert][0] == type) { number=number+1; } } } } } return number; }

GMO City Engine - Tutorial