Week 6 - Generating Windows and Doors

This week I worked on adding windows and doors.

Adding Window and Door Mesh classes

I derived two classes from my Modular Piece class for the doors and winows. The reason I decided to derive classes instead of making a type enum is because I wanted to use unreal's class parameter filtering

Procedural Windows/Door Generation: First Algorithm

Next, I worked on generating the windows and doors layout. The first algorithm I tried attempts to place a window at a 1/3 chance most of the time. If two windows are placed next to each other then a wall is chosen next to make sure there are no possibility of generating 3 windows next to each other, on the other hand if we have two consecutive walls then the chance of having a window next increases to 1/2. I then updated it to have the starting chance as an exposed parameter so I can have more control. When two windows are chosen consecutively, the following choice is a wall. However, when two walls are chosen consecutively, a window is not chosen automatically but the chance of a window increases. In the following video the window chance is 50%.

Procedural Windows/Door Generation: Second Algorithm

Another algoritm I tried used the window chance to determine how many windows a wall should have. It then used a 50% chance to decide if a wall or window should be placed at the next slot assuming the number of walls/windows left to be placed was not exceeded. When there are two windows next to each other then it attempts to choose a wall if possible and similarly for the case where there are two walls next to each other. This doesn't guarantee that there won't be three windows next to each other but it guarantees that the ratio of walls to windows is equal on all the walls which is not true for the first algorithm.

It's hard to decide which algorithm is better. I like the second one becuase it doesn't end up with long windowless walls sometimes and is more stable. However, I might try to sometimes adjust the number of windows slightly to see if it would help the second algoritm be less predictable and repetitive

Next Week

Next week, I will be working on adjusting the windows/doors placements and adding simple flat roof.