I have decided I was bored of drawing buildings and wanted a tool that could draw them for me, so I am working on a procedural building generator! This, at the moment, is made up of two halves; one half generates the building structure (including construction stages and the four orientations) based on a simple numerical description of the building's storeys and roofs. The second half procedurally colours the building with the TTD palette. It is all still under heavy development but it's (IMO) quite impressive so I wanted to show off how powerful it could be!
Here is an example building definition:
Code: Select all
storeyheight=6;
windowwidth=3;
windowheight=3;
windowbaseheight=2;
windowspacing=2;
buildingdefinition=newArray(
0, 1, 8, 12, 22, 8,
1, 2, 16, 8, 2, 20,
0, 1, 16, 24, 2, 4,
1, 3, 8, 12, 22, 8,
1, 1, 16, 16, 2, 4,
2, 2, 2, 16, 2, 4,
2, 1, 14, 16, 4, 4,
3, 3, 14, 16, 4, 4
);
auxdefinition=newArray(
1, 0, 1, 1,
0, 0, 0, 0,
0, 1, 1, 1,
0.7, 1, 0, 0,
1, 0, 1, 0,
0, 0, 0, 0,
1, 1, 1, 0,
0.7, 0, 0, 0
);
Code: Select all
s, t, w, d, x, y
s=storey (i.e. 0 (ground), 1 (first), 2 (second), etc.)
t=type (1=walls, 2=flat roof, 3=sloped roof)
w=width (in 3D)
d=depth (in 3D)
x=x location (in 3D)
y=y location (in 3D)
This set of instructions gives the following building: This can be fully "proceduralised" with some random numbers...
Code: Select all
gwa=randomRangeEven(12, 20);
gwb=tilew-gwa-2;
bya=randomRangeEven(0, 8);
byb=randomRangeEven(0, 8);
gda=randomRangeEven(16, 32-bya);
gdb=randomRangeEven(16, 32-byb);
uda=randomRangeEven(8, 14);
udb=randomRangeEven(8, 14);
bxa=0;
bxb=gwa+2;
buildingdefinition=newArray(
0, 1, gwa, gda, bxa, bya,
1, 2, gwa, gda-uda, bxa, bya+uda,
1, 1, gwa, uda, bxa, bya,
2, 1, gwa, uda, bxa, bya,
3, 3, gwa, uda, bxa, bya,
0, 1, gwb, gdb, bxb, byb,
1, 2, gwb, gdb-udb, bxb, byb+udb,
1, 1, gwb, udb, bxb, byb,
2, 3, gwb, udb, bxb, byb
);
auxdefinition=newArray(
1, 1, randomBinary(), 1,
0, 0, 0, 0,
1, randomBinary(), 1, randomBinary(),
1, randomBinary(), randomBinary(), 1,
0.7, randomBinary(), 0, 0,
1, 1, randomBinary(), 1,
0, 0, 0, 0,
1, randomBinary(), randomBinary(), 1,
0.7, randomBinary(), 0, 0
);