Dungeon Generation: Planning Requirements
Today I'm going to talk a little bit about how I got started on the dungeon generator. The first step in any programming process is establishing your project's requirements. That is where I began as well. Here are some of the capabilities I required of my dungeon generator.
Customizable Dungeons
For a variety of reasons, it's important that this project is able to generate a variety of dungeons, rather than merely one type. So early on, it became one of my goals to craft a generator that would be powerful enough to generate a wide variety of dungeons, but also have the ability to customize that variety, so that the user is guaranteed to have some specific flavor of dungeon at the end. One of my key influences in this regard was Jamis Buck's random dungeon generator.
As you can see from this screen shot, users have a bunch of options to tweak when generating their dungeon, from the size and layout, to the frequency of rooms. Since that generator exists for pen and paper games, that amount of customization is all you really need. I want some control over the visuals too though, so that something like his randomly populated room below could be crafted visually:
Room #3:
- Door (south, 4 from west): stone, locked
- Features
- corpse (monster)
- scroll (nonmagical)
- engraving
- evil symbol
- oven
Visual Appeal
I wanted to ensure my generator would have the ability to similarly populate a dungeon, but I wanted it to be able to do so visually. If the generator randomly determines that there should be some corpses in the room, then I want them to be visually depicted. In the early stages, this goal was a bit ethereal... I wasn't sure what sort of visual style that the dungeons and the objects populating it would need to take. Quite frankly, I'm still not sure. I did know that this meant that I would need to keep my visual presentation separate from my logic. In the early days, I sketched a rough class hierarchy on a piece of scrap paper. It's gone now, but here's roughly what the hierarchy looked like (a bit different from the present day hierarchy):
- Game Engine
- Map Generator
- External Data Loader
- Logic
- Game
- Creatures
- Grid
- Map
- Objective
- Terrain
- Tileset
- Effects
- Cell
- Tile
- Map
- UI
- Map Renderer
- Tile Renderer
That's roughly how I saw things getting organized. If anything, my original plan was too detailed, but it's been reworked a bit since. The important thing to note is that all of the "display" information of the map/tile will be found in the renderer classes, and all of the gameplay related information will be found in the logic based classes. The generator actually crafts a map, which gets passed to the engine, which creates renderers based upon the map. End result: changing art, or even the entire graphic style can be accomplished without touching code on the logic side. Current result: at present, the generator produces dungeons featuring two different tilesets, with identical logic for each.
Some Specifics
The last thing that I really needed to nail in the early stages was the scope of the generator beyond the above. Customizability and a separation of visuals from the logic are important, but they still don't tell us what sort of maps we'll be generating. As I discussed in the last update, I'm looking to craft a pretty powerful generator here. Knowing specifically what I want to be able to do is important for figuring out how to structure code. Here is a bullet point list representing some of the specific requirements I had:
- Capability to generate both interior and exterior maps
- Maps should support manipulation via abilities/items (earthquake spells, for example)
- Doors of all types (locked/unlocked/secret)
- Traps of many varieties
- Dungeon Items that range from purely decorative to tactically important or usable
- Intelligent monster placement such that pseudo narrative is possible
- Possibility for inclusion of non-randomly generated content
- Creatures that can deal with the randomly generated content
Tags: Actionscript, Dungeon Dice, dungeon generator, planning, requirements