

Procedural Level Generation
I made a Procedural Level Generation system. It generates the level based on premade tiles. The system is built with designers in mind, and is made super easy to expend and customize to fit the need of any project. One of the way I made it super easy to use, is that I made every pertinent variable public, like you can see on the right.

How it works
In the big lines of it, It works by placing the tiles of the main path first, counting down after each one. When at 0, it will place the appropriate end tile to cap the path. Afterwards, It will start generating every side branches by doing a similar thing. I have it setup that after 1.5s, all paths must finish up. I have it setup like this so that the side branches are a semi consistent length. So it goes like :
-
Start generating main path.
-
When at 0 tiles left, end the main path.
-
Start generating side branches
-
After X seconds, Finish every path still open.
How each tiles are placed
In this explanation, I will be glossing over some small things that I do, but if you have any question or simply want to know more, please contact me, I will gladly take time to write back or arrange a meeting.
​
Each tile are individual maps, their starts are at the location (X=0.0,Y=0.0,Z=0.0) and the end of the tile is decided by an actor that will also say which way the tile is turning (left, straight or right). The whole generation is done from tile to tile, while referencing the variables in the LevelGenerationController (the actor selected in the gif). Inside every "tile generator" there is 4 steps :
-
Check the different variables like ; the number of tiles left, if it need to correct a turn
-
Check if the selected tile will overlap with anything
-
Spawn the tile if no overlap is found (or spawn a wall)
-
Lower the amount of tiles left

You can see the branch that checks if there is still tiles to place. If it is below or equal to 0 it will try to spawn an "End tile" if not we proceed to an RNG that chooses which way we go next.

To choose which tile to try to place, I use a Data Table. There are 2 variables in it, The level name and the tile's size. I use the tile's size to transform a box collision to it's size and it's location. Right after what happens in this image, there is a branch (if clause) that is attached to a variable that is triggered by any overlap of the box collision.

This image shows the last 2 steps. Firstly on the top half, we have what happened if the box overlapped. A number of tiles is removed and then a wall is spawned. On the bottom half, is what happens if the coast is clear, the tile is spawned in from the current actor location and 1 is removed from the number of tiles left.
​
Again, if you want to know more about my reasoning or just how it works, you are more then invited to write to me (antoine.paquette@gmail.com). I will be happy to talk about it.