So earlier I blogged about how procedural is so cool and rad, etc, whilst also bemoaning that there’s not enough detailed procedural generators that tie different elements like monster and item placement together. I’m as guilty of this as anyone else, partly because it’s so much quicker to use simple algorithms, but also I guess because people don’t expect any better. Well, let’s have a look about how a good dungeon generator might think through the creation of a level:
1. Huh? What? Oh goodness, I oversleep()ed and now I have to crank out a dungeon level. Well, let me think, should I have a theme? Yes! And what should the theme be? It’s deep in a dungeon and there’s not been a forge level yet, so I’ll make one of those, yes? Active forge? Yes. Will there be a dominant monster type? Yes. Population? Orcs. 60% dominance.
2. Okay, let me think openly about the general shape.. .. .. .. .. My, that’s a lot of noise/BSP tree/cellular whatsits! I’ll shape that up here with some heightmaps / room space allocation / edge smoothing / whatever else. Ah, that looks much nicer now! Any extra decorations to shape I want for now? No, it’s good as is.
3. Hmm, better check it all connects together. Got a lovely floodfill for that… And whilst I’m at it I’ll check there are no lengthy dead ends by adding a heightmap to the floodfill and connecting up some of the maxima. Can’t be having our avid adventurers backtracking all the time, after all…
4. Should I have a river? Nah… Lava? Sure! Let’s spill it in the east side, let it burn down some walls, go under this corridor (now a bridge over lava) and carry on south-west. Island in the lava? Okay, and I’ll place a special item there for adventurous types to fawn after. Enemies in the lava? Sure, I’ll throw some fire drakes in. They have a lovely ranged attack they can use on anyone crossing the bridge.
5. Might put a small vault in the north of the level. Keep things connected as it’s placed. What monster type? I’ll follow the orc theme and choose some orc assassins. Artifact reward? Nah. Large gold pile? Sure. Trapped entrance door? But of course…
6. Since it’s a forge I’ll make a large central room into a forge room, with a forge inside and some relevant materials. And an orc weaponsmith, and some goblin slaves. Nearest room will be stockroom. I’ll make it 40% armour, 30% weapons, 30% consumables. Artifact? Okay, medium grade. And a second low grade too. I should definitely place a guardian here – a nice big troll in fact. Doors to this room are locked – I’ll put the key somewhere else on the level which is definitely accessible from the entrance stairs (ah, floodfill, I love you so).
7. Any other special rooms? An altar in the west will suit. Include some scrolls. And a rabid orc priest. Followers? No, but we’ll give him a pet. Fantastical creature? Sure! We’ll make it a griffon. And I’ll throw in some griffon babies too. Aren’t they cute?!
8. Hmm, there’s a dead-end room in the west. Any chance of a special item for here? Sure, a special potion. In a trapped chest. Guarded by… mages. Path to the dungeon entrance from here is to the north, so I’ll position them in a defensive formation near the door there, with a healer behind them.
9. Now, in the other rooms we’ll place some orcs and a couple of other creatures, with no more than 2 being higher than base level. We’ll give one of them a wolf pet as well. And in one corridor we’ll put an archer – everyone likes archers in corridors, right? And a trap there too, but we’ll let the archer know not to trip over that. And we’ll have the archer carry a nice bow and dagger.
10. All done now! As a final touch I shall christen this level “Corpsefire Forge”. Bon appetit, adventurer!
Looks very involved, yes? Kind of like the thoughts a real designer would go through? But that’s the point really – you want something almost as good as hand-made content, but with on-demand infinite generation and variety. It needs some coding together and a good pool of input values. The coding is not so hard as you might think – everything above has been done before to some degree in open source games, so at a push you could copy paste this generator together. But the hard examples to draw from are a lot more work if you don’t want the same few combinations popping up over an over again. I guess this is partly why big roguelikes are so popular – the larger content pool allows for greater variety in random encounters.
Some day I’ll make a cool generator like this. Honest ;)