top of page
PCG logo.png

Groupsize: 1

Development period: 20 weeks

Grade : 2.2 | 83/100 Points

Developed in Unity

Screenshot_65.png

ABOUT THE PROJECT

For my thesis, I focused on procedural generation of buildings. Initially, I researched an algorithm to easily generate an apartment, but first, I familiarized myself with pseudo-random numbers and programmed a simple skyscraper generator. I have opted for the Backus-Naur Form. The structure of the generator is as follows:


 


The output here would be a building with dimensions 6x5x3, which has random assets and details. Now, one can also randomly assign a number to x, y, and z, and have a completely randomly generated building. The implementation in Unity initially presented a few obstacles, but I was able to overcome them quite quickly. The generator for the apartment works quite simply. Firstly, the size of the apartment is randomly chosen between a minimum of 1 and a maximum of 50 blocks. The corner points are not considered here, as they need to be created anyway to generate a complete building. The apartment created is rectangular, as it is easier to realize than a building with a free form. The grid on which the apartment is generated has three values: X (length), Z (width), and Y (height). The corner points are quite simple, with the following coordinates: X(0) Z(0), X(0) Z(Max), X(Max) Z(0), X(Max) Z(Max).

 

 

 

 

 

 

 

 

 

 

 

 

 

Here, Max stands for the maximum length of the apartment. This allows buildings of any size to be generated without them being incomplete. The blocks between the corner points are then generated based on X | Z(1) and X | Z(Max - 1). This already forms the outer area of the apartment. To generate upwards, one only needs to increase the Y value by 1 to generate the next level. Once the maximum height is reached, the roof is generated. Here, there is also a special case: the center must also be filled. For this, only one of the roof variations can be used, otherwise visual errors occur. To do this, simply fill the area between X | Z(2) and X | Z(Max - 2). However, this is not explicitly mentioned in the script, as these are just the remaining elements that were not recognized by a condition before. Finally, flower boxes and air conditioners are procedurally generated in front of the apartment windows, and thus the simple apartment is already complete. Creating the generator also took two and a half hours.

Screenshot_66.png
Screenshot_67.png

KEY FEATURES

SCRIPT USABLE WITH EVERY ASSETPACK
ADJUSTABLE SIZE, MATERIAL AND ROOF STYLE
SELECT SIDES TO BE RENDERED
CALCULATE DOORS AND FIREESCAPES BASED ON SIZE

bottom of page