Mechanic #168 - PGC: Multi-Layout Cards|
|Posted: May 21, 2013|
Keep multiple versions of a procedural chunk to modify and improve how it is used.
I really like the abstraction of using cards to represent procedural content generation. Procedural generation can basically be boiled down to composition (using previously designed elements to create new, complex elements) and design (using rules create new elements towards a specific aesthetic from scratch). Card represent discrete extensions that can be used either as rules or towards composition, and the idea of building a deck and shuffling it easily encompasses the idea of random selection.
While representing your data as a series of cards is beneficial from a logical and logistical point of view, when using computers, we can cheat just a little bit and make the cards represent more than a single discrete element. Instead, it can represent multiple versions of the same card, from which we can select whatever we desire at the time of use.
Fig 168.1 - A card with multiple layouts.
Here is a card which features four different versions of the same basic room. Each variation of the room should be functionally identical, at least in as far as the card is used without the framework of the procedural generation. However, the variations can do things like modify the types and numbers of enemies that are in the room, whether it has a treasure chest, or even have a special, unique version of the room that differs in many different ways.
If this card were physical, it would be impossible to represent such significant variations on a single card, but since I'm talking about computer data, we can ultimately put as many variations as we want on a single card. The important thing to remember is that the variations can not fundamentally change the nature of the card. It's not a boat that can turn into an airplane. It's always a boat, but it can be a bunch of different boats.
Let's say you build a deck of these types of room cards, and you place them by drawing the top card of the deck and attaching it to the dungeon - see [#157 - PGC: Smart Card Layout]. The type of dungeon you are building will decide what default layout will be selected for each card. For instance, if you are building a difficult dungeon, you'll use the HARD layout of each room as the default. Or if you are building a goblin dungeon, the GOBLIN variation layout will be default.
Also shuffled into this dungeon deck is a group of cards that modify the dungeon in some way. When you draw a modifier card, you apply its effects to either the last card placed (if applicable) or a randomly selected room which can be used. These modifier cards don't have to just modify individual rooms. Here are a few examples of modifier cards:
Difficulty Increase - Increase the difficulty of the last room placed (if the default was NORMAL, HARD is now the layout used).
Challenge Room - Use the CHALLENGE layout for the most recent card that has a CHALLENGE version available.
Treasure Room - Use the TREASURE layout of the most recently applicable room (treasure layouts have money and good all over the place to collect).
Elite Monster - Add a roaming, elite monster of this type to the last room added.
Time Limit X - The dungeon now must be completed in X seconds.
Darkness - Add the darkness attribute to the most recent room (requires a torch to see in).
Slower Monsters - Enemies in the most recent room move at half speed.
Equipment Item - A specific piece of equipment for the player to find - added as a treasure chest in the most recently placed room.
Mission - Select MISSION variation of recent room.
You can create puzzle trees, see [#159 - PGC: Puzzle Tree Building], by combining MISSION rooms. Each MISSION variation of a room will request a specific item. When a room turns into a MISSION room, place the required item aside. When you create a new MISSION room, put that item as the reward for the mission and take the new required item aside. At the end of the mission chain, just place that remaining mission item in a random room. Instant puzzle tree.