29 January 2013

Randomizing a Location: Some Thoughts

A friend and I are working on a sort-of roguelike and I've made a randomization-system for creating a procedurally generated cave-system that's different every time one plays. This can be applied to both pen & paper RPGs and games of the video-variety.

Making an easy-to-use randomizer for a dungeon (or any other location that is separated into different rooms/sub-areas) is easy enough. Designing the whole thing so that it creates a certain type of shape or pattern that you wish to have for the game-area to have is the next step: Do you want a maze-like pattern with lots of dead-ends and crossings? Do you want a winding corridor? A sprawling necropolis of repeating chambers?

I wanted to simulate a cave-system that is somewhat natural in its genesis. Most caves are either carved by water (or lava, I guess) or fissures resulting from movements within the earth. While there are labyrinthine caves in nature, most of them are somewhat linear affairs branching off into side-caves every once. I limited my randomization-effort to four directions, as three dimensions and all that make things a bit to complicated. Then I thought up four different types of passage a player may encounter.

The cave-layout starts with an entrance-room (the entrance being a feature, thus not going into any of the four directions. It's probably a hole in the roof). You then roll two D4, one for the direction, and one for the type of passage that leads that way. For the direction, 1 means North, 2 means East, 3 South, and 4 is West - create a room in that direction. For the passage die, 1 means a wide, washed-out passage, 2 is a tight tunnel, 3 is a steeply sloped passageway and 4 means a twisted tunnel. For the new room, I rolled another D4 to fill it with contents from other random-charts, a 3 meaning a room feature and a 4 meaning a room feature and an item for the player to find.

Repeating this twelve times generates a small dungeon. If the direction hits a room that's already there, a new passage is created and said room can now contain more than one feature or item. Every fourth room gets a random monster from another chart. Room 12 contains an exit. Repeating this more often, due to there only being 4 directions in the game, result in more tightly-clustered rooms with lots of passages in-between. For now, I have created some test-levels, which have in between eight and eleven rooms. Once the game reaches a stage that is actually playable, you'll of course be informed here in my blog. Until then, think of more ways to randomize a maze or a cave-system. The possibilities are (almost) endless.

No comments:

Post a Comment