Mechanic #093 - Collectible Dungeons - Dungeon Design|
Legend of Zelda done with procedural generation and collectible cards, part 3. In this entry, dungeon decks and how those decks produce playable dungeons is discussed.
A Dungeon Deck is a collection of cards that builds a single dungeon. Unlike Player or Town decks, Dungeon building is not interactive or point based. Instead, the deck requires a certain amount of cards of a specific variety. You can have more. In fact, the way a Dungeon is built, you could easily create a Dungeon Deck that is literally every dungeon card you own. So in a way, Dungeon design is more about what cards are not in the deck rather than what are.
A Note On Dungeon Philosophy|
Dungeons are intended to be something that the player plays against, even if he creates the dungeon deck himself. As such, outside of deck design, the player has no input into the dungeon's creation at all. This is for two reasons. The first is that a game with 100 dungeons would be far too time consuming to micro-manage. And the other is to allow the player to challenge himself. Even knowing what is in a deck should still yield some surprises.
Another important point is that, due to the influence of collectible cards, dungeons are built out of pre-designed building blocks and does not go purely procedural design. For instance, though the dungeon's map could be easily generated randomly, that limits the kind of cards we could create from that - and it would be far less fun to collect formulas. Instead, you collect dungeon layout cards that provide pre-designed floor plans. Not only is it more interesting to collect the "Bird-shaped Dungeon", but it also adds a bit more strategy to deck building.
In fact, one type of card available is a Seed card, which basically just represents a single random seed (from which all random selection will proceed predictably). If you have a deck with the same Seed, it will reliably reproduce the same dungeon repeatedly. This is to allow players a little control in the dungeons they give to others to try out - if they find an experience they enjoyed, they can reliably recreate it for other.
In going with the collectible card aspect of it, there would only be a handful of seed cards with some sort of (arbitrary) theme attached to it, such as the Handy Seed or the Blustery Seed. The idea is that it is more interesting to collect things than numbers, and one could name their dungeon based on the seed plus the floor plan (the Blustery Bird dungeon or the Handy Cavern dungeon). The Seed is optional, so not having one will produce completely random results every iteration.
One final note is on how the dungeon selects which cards it needs. The dungeon creator will select randomly from the pool of all available cards in the deck of a certain type. For instance, if the dungeon needs to place a puzzle in a room, it will grab all 47 puzzle cards available and randomly select one to use (removing the card from the pool for next time).
The minimum requirements for a Dungeon Deck are just enough to provide a mostly random experience. For instance, you may include one dungeon layout (which will always be used) or you could include ten possible dungeon layouts (which will randomly be selected from those ten). Some things require only one card, but in some cases, there will be enough extra required for some randomness. For instance, if the dungeon can have ten puzzles, the minimum required for a deck might be fifteen. And of course, you can increase the size of the deck infinitely, creating ever larger pools and variations. If you put every Dungeon card in the game into a single deck, it should still work.
As mentioned above, each deck may have an optional Seed card, deciding the random decisions made when creating the dungeon. If no Seed is in the deck, it will be completely random. If only one Seed is available, it will always be used. If there is more than one Seed, one will be selected randomly.
Much like Avatar and Town cards, a dungeon is defined by a Dungeon Layout card. It says what the rooms are in the dungeon, and makes special note of the boss room. It does not specify how those rooms are connected. Doors, locked doors, and secret passages are drilled during the first phase of creation. A Layout card also specifies the theme of the dungeon (like Fire Dungeon, Ice Dungeon, Water, etc). I'll talk about themes in a second.
Using the layout, an algorithm drills connections between all the rooms. Remember [#004 - Environment Tree]? That's right. Keeping a tree of the room connections is how we will intelligently place our secrets, puzzles, locked doors, and keys. Essentially, it breaks the environment up to the point where we know whether certain sections are unreachable or not, so we can effectively lock doors and section off secret areas. Then, the key rooms are randomly selected from possible candidates, and these now become puzzle rooms.
Puzzle Room Cards are exactly what you think they are. The represent a specific one-room puzzle, such as kill all the enemies in the room, push blocks around, or whatever. Though some cards will likely specify rooms completely, many will have some sort of procedural formula for generating the rest of the room. At the very least, theme appropriate enemies and objects will be selected. Some might randomly create the puzzle solution (like creating a maze), some might randomize aspects of it (push block X or Y), and some might flip the puzzle horizontally to keep things a bit fresh.
Okay, let's talk themes now. In general, Puzzle Room Cards are general purpose and can be used in any theme. For instance, what could be water in one dungeon might be lava in another. What would be a singular block in a generic dungeon might become a nifty looking stalagmite in another. The Puzzle Room Cards ask for specific objects form the Theme. Some cards are theme restricted, meaning that a puzzle room involving pushing blocks of sliding ice may only be used in ice dungeons. Also, some Puzzle Rooms may only work in specific setups (like an icy bridge which only works on rooms with exits on the west and east walls). No applicable cards are simply ignored when it comes time to create the card pool. Minimums for decks do not include specialty cards (ie need at least 15 generic, all purpose puzzle cards, but can add speciality cards on top of that).
To fill up the rest of the non-puzzle rooms, we have two pools Rooms and Enemies. Room cards just represent a single room layout, such as a specific formation of rocks and rivers or something. Like puzzle rooms, they may have some randomization, but they are meant to be generic and easily populated. Room cards are something that are only vaguely interesting to collect since you'll have a bunch of them and volume is important for variety. Like Puzzle Room cards, Room cards can be theme specific or only work under certain layout formations.
Monsters are a little more interesting because what happens is that when the dungeon is first being built, a few Monsters are selected from the pool to populate the dungeon. Rather than having a hundred different types of enemies, you might have six that just keep showing up. When a room needs a specific Monster, it will look at that small list and select from it. Room Cards may contain hints about what kinds of monsters would be benefit the room best (ie, this room has rivers, so swimming monsters would work, as would flying monsters). There should be some all-purpose creatures just to be on the safe side. In fact, I'd say that there should be at least one creature for each use (walking, swimming, flying) so that all the bases are covered.
Similar to rooms, monsters come in both generic and theme specific. In many cases, a monster may have multiple forms that it selects based on the circumstances. For instance, a bat may be an ice bat or a fire bat in those dungeons. Or if you put four or more skeletons into a room, one of them will be upgraded to a skeleton general and carry a shield and a spear instead of a sword or something.
Also, I'd think it'd be cool if you could include monsters in your player deck. As inventory items, you could summon them to fight alongside you in specific rooms of the dungeon. Find some cleric and drop him in a room and he'll heal you as you fight. Gives monsters more of a reason to be collected. Makes you go "ooh baby" when you get the Stone Golem, even when you don't build dungeon decks yourself.
Finally, we have a selection of player cards which will randomly drop from defeated enemies. Whenever an enemy is destroyed, it has a random chance to drop an item selected from the pool of player cards included in the dungeon deck. The type of card (equipment or item) as well as its quality will affect its drop percentage (so you should find a lot more healing potions than bastard swords).
Finally, you have the Boss, which is just a simple plug and play version final enemy. He comes with a room and can be theme restricted. I'd like to do something more interesting with bosses (like set bonuses, such as a Goblin King which is more powerful when the dungeon is filled with goblin enemies) or something, but that can wait.
What About the Hook-Shot?|
Zelda games in particular are famous for each dungeon having a specific tool that you gain halfway through from a mid-boss. This tool is then used to solve the remaining puzzles and defeat the final boss. Then later dungeons will feature puzzles from previous tools. Heck, even getting to later dungeons may require the feather, the hook-shot, the boomerang, or whatever.
That aspect is not part of my design largely because it makes things a little more complicated, though not impossible. Through the Environmental Tree, we should know whether or not a puzzle room is before or after a specific tool is available - then we simply put requirements on the puzzle rooms (ie this puzzle room requires the candle and bow and arrow to complete).
The added complexity comes from a lot of cards which are very specific in their uses. For instance, a fire dungeon puzzle which requires the hook-shot will only be usable if your game has a fire dungeon and it includes one or comes in a sequence after the one is acquired. Already, in order to provide variety to the dungeons, you are probably dealing with dozens, if not hundreds of puzzle rooms and room layouts. Adding in tool-dependent rooms would probably triple that (though, admittedly, provide a more enthralling experience).
The problem with procedural generation is that you kind of need to produce a lot more content than you will ever use. The benefit is that if you create three games worth of content, the player should be able to play twenty games from it. The problem is that if the player only players one game, a lot of that is wasted effort. I'm still thinking about whether or not going the extra mile for tools (which would likewise need to be included in the overworld generation) is worth it.
After you defeat the final boss, you get whatever McGuffin you were looking for. But the real reward is in the final tally. At the end of the dungeon, you are rewarded with cards. These cards are specifically from the dungeon deck you just played (so if you see a particular object in a dungeon you like, replay it until you unlock it). This includes the player cards used as loot.
You are given three cards just for beating the dungeon. You get one additional card if you beat the dungeon without dying. And you get a fifth and final card for beating the dungeon in under X number of minutes (where X is a value based on the number of rooms and puzzles).