|The dungeons are randomly generated for each level|
of Spelunky, making for a unique mix-up of RPG,
Platforming, and Action fun.
The most interesting aspect of Spelunky to me is the random level generation. Anyone can just make a game spit out a random set of blocks and objects to traverse or interact with - the hard thing that Spelunky does is make those sets of blocks both random, but fun and logical to traverse, especially in platforming fashion, where the player has a limited range of movement to work with. For example, even with bombs that the player can use to clear blocks out of the way, Spelunky doesn't ever create rooms that are out of the movable range of the player to traverse. I would like to analyze just how this random level generation process works - here is my attempt at doing so.
As far as I can tell, there are three methods to random level generation, each with their own good aspects and bad aspects.
1. Random levels
This method has a high level of customizability - you can easily make levels that are fun and logical to progress along, and that can contain specific traps or props for each level. However, the down-side of this method is that unless you have an absurdly large amount of levels created in relation to however many the player actually will beat in the game, the player will most likely see repeated levels. Also, this possibility will increase each time the player plays the game again. For example, if you make 80 levels but the Player only plays through 40 and begins to play the game again, he'll probably see a repeated level, which would detract from the replay value (and so, the game won't be able to be called truly 'randomly generated').
2. Random blocks
The second method of using random blocks in the creation of each level, is probably the best and worst method of randomly creating levels. The up-side of this method is that it is almost impossible for two levels to look alike or be repeated. The down-side is that creating rooms that are playable, much less fun to run around in, is next to impossible as well, as you don't know how large or what the shape of each room will be.
3. Random rooms
The third method of creating random levels is most likely the most efficient. In this model, the game designer prepares a set of rooms beforehand that consist of rooms, passages, and bridges of different size, shape, and complexity. The designer can easily place props in strategic positions in the rooms, and can make sure that the rooms themselves are fun to play in. The level is then 'randomly generated'. This is done, not in the sense that the individual blocks are being placed, but the game places the rooms next to each other to connect.
In Spelunky's case, this can be used to the game's advantage, as the game can simply put necessary objects, like bomb or rope crates, in very accessible locations, and put more rare and valuable objects in areas where you must use bombs or ropes to gain access to them.
This method of random level creation is the most customizable and easiest to randomize to help ensure the maximum amount of fun possible.
|Illustration A - As can be seen, simply setting|
down random blocks won't create a playable level.
Random room placement is far better.
As you can see in the second half of illustration A, though, using the random rooms method is far better, as we can tell where the Player should be spawned, and where other rooms can connect. How does this work?
Well, it's actually pretty simple - a level design may be made up of many rooms, but most of the pre-made rooms are similar in design, and so you really only need a few of them. Take a look at Illustration B below. In this illustration, we see a simple dungeon map made up out of several rooms. However, as you can see in the bottom-right corner of the illustration, the room elements are shared - there are only six actual 'rooms' for the whole level.
|Illustration B - Pre-constructed level|
elements can be pieced together at game
runtime to make a random level.
Game elements can also easily be placed
inside of these pre-made rooms.
Come back for the second half of this tutorial when I see about implementing this random level generation idea into a game made with the Blender Game Engine. ~ SolarLune