Mechanic #203 - PGC: Keyword Regions|
|Posted: Apr 12, 2014|
Give keyword sets a physical aspect as you lay them out over the map, overlapping one another.
This was one of those eureka moments, where a bunch of ideas came together at the same time, creating a very simple solution to multiple problems - an answer so genius that it seems obvious in retrospect.
Fig 203.1 - [#124 - Card Metroidvania]
I was trying to work out how to create something like this, but I kept running into problems. Most of these problems extended from the fact that I wanted it to be built as you drew cards. Even removing that restriction, stuff like staircases proved to be more difficult than I had anticipated.
The problem was that I was thinking of each zone as a single region, with each floor being implicitly a subregion of it. Implicit assumptions are never a good idea, and it complicated a process that was ultimately very simple. The castle IS a region. And each floor is also a region. As is each room. And a staircase was also a region - one that contained two rooms. And that's when I realized that they weren't mutually exclusive to each other. In fact, they were complementary.
Fig 203.2 - Castle Region
We begin with an empty castle region. It's just a giant rectangular region the delineates the "castle" area from the "not castle" area. In a future entry (possibly the next one), I'll describe a system for laying out these sorts of things, but the point is, we start from the outside and work our way in.
Fig 203.3 - Floor Regions
A castle is broken up into separate floors, so we create long rectangular regions for each floor of the castle. These regions overlap on top of the castle region. This illustration should probably have a few different colors for various floor types, like top floor, ground floor, below ground floor, etc.
Fig 203.4 - Themed Room Regions
We then take each floor and break it up into multiple smaller, themed regions. For instance, the yellow regions could represent "library" rooms. Hallways, dungeons, living quarters, atrium, throne room, barracks, whatever. Each region represents a themed zone. Again, these regions exist alongside of, and on top of, the castle and floor regions.
Fig 203.5 - Staircase Regions
Now we connect various regions vertically through staircase regions. They represent pathways between floors (this phase could be done before the themed regions, if you'd like). Each room in the region actually has additional information, like whether it is a staircase down, staircase up, or staircases both up and down.
Fig 203.6 - Link Regions
Similar to the staircase regions, we link separate regions on a single floor through link regions. It should be noted that these and the staircase regions represent connections between nodes. Using a list of these connective regions, we can generate an [#004 - Environment Tree] of the map. Similarly, we can lock progression between these regions by using "locked" staircase regions, and whatnot.
Fig 203.7 - Many Regions
We now have a castle which is made up of many, many different overlapping regions. Pick any room on the map - let's go with two in, five up. How can we describe this room in terms of regions? (let's say the blue region is a museum zone)
CASTLE + HALLWAY_FLOOR + MUSEUM + STAIRCASE_DOWN + LINK_RIGHT
Does that look familiar? Maybe like [#161 - Keyword Sets]? We can use the overlapping regions as keyword sets to define what rooms can be put there. We know that in this room, we need a room that is a castle room, from a basic hallway floor (not a ground floor or dungeon), that belongs to the museum themed zone, featuring a staircase down and a lockable door leading to the right.
Every single spot on that map has a set of acceptable rooms it can be, defined as the intersection of each set that each region represents. Assuming the resulting sets are not empty, you can pick any cell at random and place a guaranteed workable room in it.
Imagine laying out a Zelda-like map. This room is SNOWY_BIOME, contains a DUNGEON_ENTRANCE, and requires a HOOKSHOT to exit to the left. This is how you do it. This is what [#167 - PGC: Interior Design Rooms] only hinted at. You are defining the game world from the top down, by defining the attributes of the elements you put into it, rather than the elements themselves.
This idea is still very new, and I'm rather excited about it, but I think this is the glue that is going to bring all of the other procedural ideas I've had together.