The levels in MechDog are generated using two different generators.
Everything you see in this post is work in progress.
Generator 1 - Level Segments
Generator 1 builds the exterior parts of the level. These areas consist of open spaces that introduce new obstacles. The idea here is to create spaces for players to freely engage with new content.
The generator uses a series of designed level segments so it requires a good collection of pre-designed level segments to fuel it.
The generator follows this process:
Choose an obstacle type, starting with easier types first
Generate a level segment that contains the obstacle type
Generate another level segment that uses the same obstacle type, but this time spawn in on top of a platforming segment
As the difficulty increases, this generator starts creating combos of obstacles to increase intensity.
Generator 2 - Trail Run
Generator 2 builds dungeons that utilize the obstacles just used by 'Generator 1'. The player is put to the test by having to deal with the obstacles in a smaller more dangerous space.
The generator follows a series of steps to create a dungeon.
Path Generation
First, it creates a solution that starts from the bottom left and works its way until it hits its right boundary.
Visualized below, the generator starts at the bottom left and then picks from its limited choices which space to move to. The colored blocks represent which directions the path can continue on from that point.
Red = Up, Down
Green = Up, Down, Right
Blue = Right
ROOM GENERATION
The solution path is then replaced with three different types of rooms.
Room with exits on the top and bottom
Room with exits on the left and right
Room with exits on the left, top and bottom
For each room type, there is a collection of room designs that range in difficulty. The generator picks increasingly difficult rooms to vary the dungeon and create a rising challenge. Even with only four different room designs per type, the dungeons that are generated appear unique from each other.
Design
Why Create a Level Generator?
It was a new challenge. Having never created a procedural level generator for a platformer before, I saw this as an opportunity to expand my skills. A level generator also meant that each play experience could potentially feel unique from the last one.
What was learned from making a level generator?
With my approach to level generation, I learned that appearing procedurally generated is very much about hiding the handcrafted portions. I had specific moments that I wanted the player to hit, so I created those moments first and then made sure that the generator had plenty of options to modify the moment.
What Challenges were there in making the generators?
While the advantage of a procedural generator is that it creates something new every time, its proved a challenge to make sure the generator produced a well-paced sequence. My approach to this was to make the generator follow an interest curve. I gave the generator a general guide for when to spawn difficult sections and when to choose easy sections. The hard part of this challenge is that it is difficult to figure out if the approach worked or not.