It's been a long time since I’ve done an update.
I decided to take some time and tackle random level generation, but I didn't want to do the BSP style or random cave. I wanted to take a more modular approach to level generation, meaning that the level would look familiar but would be in a different order when you played again.
I didn't want to spend time creating my own editor and the GMS room editor would do the job perfectly. The room editor is used to create the individual modules as shown below.
The green squares are the connections nodes for each module.
The data for each modules is currently dumped into an INI file when the game starts which is then read back in, the reason for this was partly for debugging and can be easily moved to another storage method.
The first module to be placed is the start module, the next module is selected at random and rotated on the connection node until it is no longer colliding with the start module. After the module has been placed it’s removed from the list so it can’t be selected again, a random a node from the module is selected and new module from the list is picked and rotated until it’s not colliding with any modules.
The process repeats itself until all modules have been removed from the list, you can see the result of the level generation below, using the modules above.
You might also notice that the nodes without connection have been blocked, this is the final process in the level generation and it’s the same process as before but it does not check for collision with other modules.