Procedural Generation Demo


What's up everyone! This week I've got a great demo of 1/4 of a district being generated randomly a bunch of times. This is just a taste of what the final districts are going to look like. For those of you who aren't interested in the how, I've dropped the demo below. For the rest of you, I'll give a brief rundown below.

The way 1/4 of a district is created is with an algorithm I threw together that has three major steps. The three steps of the algorithm (which is still being refactored) are:

1) Generate

2) Pathen

3) Instantiate

In the generate step, the algorithm creates a 2D array containing two rows and any number of columns. In this case, I used eight columns. After the array is created, every column flips a 50/50 to see which row in the column will receive a room. That position is then given a "1" to represent that a room is going to be there. Every other spot is given a "0". The resulting array looks like this:

1 0 0 1 1 0 0 0

0 1 1 0 0 1 1 1

The second step, pathen, reiterates through the array and adds directions to the positions in the array to represent where the rooms' entrances will be. It also adds corners, often overriding positions represented by a "0" to make this happen. The resulting array would look something like this:

SW 0  ES EW SW  0  0   0

NE EW NW 0 NE EW EW EW

The last step instantiates the rooms based on the string associated with each position. The result is a copy of this array on the screen that you play on. It's pretty neat.

Get City of Abominations (2021)

Leave a comment

Log in with itch.io to leave a comment.