Dungeon Generation: Introducing regions!

For a couple of different reasons, it became a really good idea to break dungeons apart into regions. So I did.

Building a Bigger Dungeon

The first of those reasons is efficiency. By breaking the dungeon apart into regions, and placing rooms via those regions rather than seeking a great spot in the entire dungeon, it becomes a much more streamlined process. Not pictured here (unfortunately), I've successfully generated dungeons roughly 6 times larger than are supported with the build here on the site. Unfortunately, the process is still really unstable for large dungeon sizes. I've got a couple ideas for ways to fix that, but they're all massive pains, and I've decided to push them back for now as honestly, do I even need dungeons that big... ever? I see little advantage to it, honestly.

On to some better news, however...

Old and Busted

Let's talk about some other practical benefits of regions. First, here's a screenshot of a dungeon generated using the basic summoning tower template that I showed off in the last entry.

A Summoning Tower

There's a couple of things I don't like about the way that dungeon looks, that regions enabled me to fix. Let us assume that there is some fundamental difference between the red, blue, and yellow summoning circles, aside from their color. Perhaps the yellow ones represent the easiest rooms. Perhaps there is some sort of elemental theme, with blue being ice elementals and red being fire elementals. It doesn't particularly matter precisely what the difference is, the thing that bothered me is that there wasn't a completely effective way for the dungeon generator to make any decisions about where to place the room based upon it's color, so the dungeons were truly random like the one pictured above. This can certainly be fine at times, but there are definitely times where there is a need for some order to the chaos.

New Hotness

So, after some tinkering with regions, and room definitions, here's a sample of the results:

A regioned Summoning Tower

I defined this dungeon template as a 3 by 3 grid of regions. I told the generator to put yellow rooms only in the corner regions, blue rooms only in the side regions, and red rooms only in the center. This allows me to exert a little bit of structure into the otherwise random room placement. There are all sorts of reasons that this might be a good idea. In this case, perhaps the magical forces run most strongly through the center of the tower, so that is the only place capable of supporting red summoning circles.

This can really tie to some of the pseudo-narrative elements that I touched upon in the last update. Since the code is more aware of the defining factors of a room, and these factors can be used in room placement, it will be relatively trivial to do cool things with this during dungeon population. To craft a (still random) dungeon that is being battled over by two opposing factions, I simple define regions as under control of one or the other (or contested), and place rooms appropriate to each condition in each region, populating them with the appropriate critter type (and, of course, setting their hostility to their enemies).

Perhaps the summoner in control of the tower isn't in control of all of it. Maybe some of his wards were broken, and demons have taken control of part of the tower. Regions would allow me to easily define different art, creatures, and gameplay for the demonically controlled area and for the still-wizard controlled area. This could easily lead to a procedurally generated quest for the player ("Help me regain control of my tower!"/"Aid us in freeing the slaves summoned by the wizard!").

A Sense of Progression

One more example of the benefits of regions. Let us assume that yellow/blue/red are merely relative levels of difficulty. Within a single dungeon environment, there isn't too much variation, in all likelihood, but let's roll with it anyway. With a simple redefinition of the placement of regions/rooms, we could end up with a dungeon like this:

A region-defined summoning tower.

I've drawn arrows indicating the path the player might want to take through this dungeon. Since room placement would occur long before doors, keys, monsters, or in-dungeon quests are generated, all of those things could be informed by the now controlled placement of the rooms. If you look closely at the map, you'll see the player could relatively easily skip the blue section and go straight to the red section. The goal here would be to model this information in a way that the dungeon populater sees a good reason to put a locked door in the player's path there, diverting him over to the blue section to grab the key before advancing towards the "boss".

Which brings me to pseudo-narrative again. Perhaps those colors aren't difficulty related after all. They could instead represent the steps necessary for the procedurally generated quest taking place within this dungeon. Imagine a quest like this:

  • Defeat the underboss
  • Use his key to free the prisoner, who can help weaken the final boss
  • Defeat the final boss

It would be relatively simple to assign each step to a color, and thus send the player through the colors in the appropriate order.

Next Steps

Potentially handle rooms with specific entrance points.

Start on dungeon population.

Share and Enjoy:
  • Digg
  • StumbleUpon
  • del.icio.us
  • Facebook
  • Twitter
  • Google Bookmarks
  • Fark
  • Google Buzz

Tags: , , , , ,

Comments are closed.