Project Update #5: Random generation and Room variations

How have you been? It is time again for another project update. After the update number 4 in which we took a look at the lore behind the game, and the characters that populate it, today we are going back into the mechanics and technical details.

In the project update number two we briefly mentioned how the procedural generation will work in Zoel’s Amazing Castle. However the explanation didn’t go into much detail, since the update was covering a lot of different mechanics. In this update we will be taking an in depth look into the procedural generation and the Room system in Zoel’s Amazing Castle.

Usual disclaimer: Zoel’s Amazing Castle is a game in early development, so any concepts discussed here or content shown may change in the future!

Let’s dive in and take a look.

Procedural generation of the map

The roguelike subgenere of video games is normally defined by two different things: Procedurally generated maps and permanent death. In Zoel’s Amazing Castle we apply this concept into a Platformer while taking some liberties. Like most modern roguelikes, the permanent death is present, but not all progress is lost on Death. Several unlockables are obtained by the player by achieving certain things, such as unlocking new characters or new items are completely permanent, and will remain unlocked after dying.

However, much more interesting than the permanent Death system is the procedural generation of the map. As explained previously there is several layers of procedural generation in Zoel’s Amazing Castle. Similar to other games, we use a room based system, in which predefined rooms are randomly placed in a procedurally generated map, having other random variables apart from this, such as where to place important items like keys or item chests, which doors should be locked, and where does the player and the door for the boss fight will appear.

Map generation example

To achieve this, an internal graph is created after generating the random map which will be used to track the viable paths. The player’s starting position is selected randomly within the graph. Then the runes (the equivalent to keys in this game) are also place randomly within the graph. 3 colored runes spawn in every level, which will let you open color coded doors (you can use them any number of times unlike games such as The Legend of Zelda, but you will have to get them again for the next level), so it is critical that before that closed doors are spawned, we know the paths between the player and the runes, so we avoid putting closed doors in the way of the player. Respecting this for all 3 runes will always result in a solvable level.

The room system

Up until this point, the technique explained for the procedural generation of the map is fairly standard among games that generate randomly the map. Where we deviate more from the formula is in the room system. There is two common approaches for a roguelike platformer that are common solutions in the industry:

Pure procedural generation

The system used by Spelunky is to fully generate the levels in a procedural manner. Specifically, they generate the level using a grid system, but the specifics of how they do it are not important for today’s point.

The advantage of using this system is that the levels generated in a purely procedural way will always feel completely new every time you start the game. It also has problems however, since usually you don’t get the same amount of polish and care than a manually designed level.

This technique has become more and more common nowadays with the increased amount of games utilizing this technique. While a system like this is hard to implement, many new developers resort to this technique because once it is implemented it saves a lot of time on the level design, which leads to the over saturation that we can see today.

Room based generation

This system is used by Rogue Legacy, and it consist of having a predefined set of Rooms which are then placed randomly at the start of the game, generating a new map layout.

The advantage of this system is having levels that feel like they were designed manually, since the individual rooms actually were designed manually, and just placed randomly. The disadvantage presented by this system appears when replaying the game a few times, you quickly start noticing the same rooms repeated over and over, breaking a bit the magic of the new map every play trough.

It seems like I am harshly criticizing these games, but this is not the case. Both Spelunky and Rouge Legacy are amazing games, and you should play them if you haven’t already, but I think when making a new game it is important to look at the techniques used in the past to see the benefits and the downsides, and then at least try to bring something new to the table with that information in mind.

The system used by Zoel’s Amazing Castle

In order to try to get the benefits from both systems, in Zoel’s Amazing Castle we combine the two in a very manual way. This should result in a map that is completely different every time you play, while retaining the level of polish of the Room based generation.

In order to achieve this, we use a system very similar to the traditional Room based generation, but with an added twist. The rooms have specific parts of them that have been withdrawn, and this parts can be replaced by many different variations. Basically, we take a piece of the room, like a puzzle piece, and then that part of the room is selected between several different options. Do that several times per room and it is very easy to reach 100 variations per room. The core mechanic of the room will remain untouched, so it will still have a hand made level of polish.

In these images we can see an example of a portion of a room that has a few variations between instances.

The main disadvantage of this system, is that rooms are much harder to design and require a big amount of time to do so, but at the end of the day, this should combine the advantages of the two systems into one, so it will be worth the extra effort, in order to have an extremely replayable game.

 

Well, that is all for today. I hope you enjoyed this project update. I apologize for throwing off so much technical details into this update, but I feel like games with procedural generation of maps are very common nowadays, and there was a need to explain in detail where we are going with Zoel’s Amazing Castle in order to differentiate us from other games. Thank you for reading the update and I hope you come back next update.

Happy new year!

 

Leave a Reply

Your email address will not be published. Required fields are marked *