Algorithm based Corridor generation

This is a small side project I did in order to create a tool that would generate maze-like levels based on a set of very specific constraints. The constraints were set to what the custom game engine my group at The Games Assembly worked with could handle. The project we were making was a corridor shooter/FPS, our main reference game was the classic DOOM. Our engine at the time could only handle simple collisions and physics, which meant that any turns in the levels had to be at 90 degrees. Because of this we also wanted to avoid inclines or height differences. This tool was made as a way to see if I could use Houdini to full-fill those criteria and automate the task of connecting arenas.


The Algorithm

For the generator I made use of a backtracking algorithm. That way all I needed to to was feed the tool a set of points to use as a game field, then it would automatically generate maze like structures within the specified area.

Ideally this means that arena areas can be connected to the start and endpoints of the maze. Then you could string them along to create (ridiculously) long and mostly random maps. An example of how it works can be seen to the right. The tool will backtrack and work to fill its entire grid if left running long enough. This means you can time the generation values for specific results.

Already on the warpath and trying to automate as much as possible, I got to work on the next tedious task; placing obstacles. This was easy. Every time the algorithm chose a square, I had another system scatter points onto it. These points then got to act as possible placement positions. By using some simple code I instanced out boxes onto the points. The amount of boxes on any level depends on the density of those scattered points. To take it a step further I added the ability to add smaller boxes on some of the big boxes.


The end result is a generator perfect for creating in-between sections. Especially if there is a need for maze-like structures between major level segments. With the apprentice version of Houdini, this is as far as the tool can go, as there is no means to test the result in a game engine. When I have a chance, and access to a proper license I may keep hammering away!