A slightly less simple example might be stairs behind a sealed portcullis in Y. The goal is inaccessible until some number of tasks is completed in some other rooms, call them X1, X2, etc. Suppose the portcullis raises if the character pulls a lever in X. The location of X and Y is not important. Generate them like vaults, just tossing them wherever in the level, as long as they both make it in.
A moderate example: Y contains the stairs down, but they're locked behind a red portcullis. Scattered around the dungeon are rooms X1, X2, and X3. Each of them contains a lever and each room has either a red or blue floor, which is randomly chosen. Pulling the lever toggles the floor color. When the floors of rooms X1, X2, and X3 are all red, the red portcullis raises and the player can access the stairs. Note that solving this puzzle is not as simple as just pulling every lever you come across. (That's not a puzzle; that's a chore).
Plenty of complexity is possible with just levers and colors and portcullises, but that gets old. Let's introduce two new scrolls: vortex glyph and phase glyph. They both cause a glyph to be inscribed on an adjacent tile of your choice (or the tile you're standing on). The phase glyph casts phase door on anything that steps on it. The vortex glyph attracts anything that teleports near it; if you cast phase door while a vortex glyph is active and in range, you'll land exactly on the vortex glyph. Each of these glyphs disappears after a single use.
Here's a more complex example that uses No Teleport items from this post. Suppose we've got our stairs locked behind a blue portcullis in Y, and room X contains a pair of pressure plates. Stepping on a pressure plate causes one half of the floor to blink blue. Note that it just blinks blue in real time. Maybe it stays blue for a quarter of second or something. Each pressure plate is linked to one half of the room's floor. After some trial and error, the player discovers that dropping an item on a plate also causes it to blink the floor blue. Eventually the player decides that it's a good idea to somehow get both halves of the floor blue at the same time. The player inscribes a vortex glyph on plate A, walks over to plate B, and casts phase door. Any NT items in the player's inventory fall on plate B, activating it, and the player simultaneously appears on plate A (because of the vortex glyph), activating it. Bing! Both halves of the floor turn blue and stay that way. The portcullis in Y opens and the puzzle is solved.
Another moderate example, this time using the phase glyph. Y contains the stairs down, but they're behind a locked door with a big, obvious keyhole in it. The key is nowhere to be found, but X contains a mysterious box that has no apparent use. The key is in the box, and the key is an NT item. Inscribe a phase glyph on the box's tile and the box disappears, leaving the key behind. Take the key and unlock the door to the stairs in Y. Puzzle solved.
These puzzles are modular and can be mixed and matched to produce a virtually endless variety of puzzle levels... assuming we come up with a ton of interesting rooms X. I chose the floor/door color mechanic so that we have a way of letting the player know what they're supposed to do and how close they are to doing it. We don't want people just wandering around trying various combinations of levers and plates until they quit in frustration. Players see a chest behind a red grate, they know that red is the official Good Color for that level, and any floor they see they're going to try to turn red somehow.
Let's make things even more complex. A player explores a level, and sees two rooms with levers, one room with a mysterious red door, and one room with stairs behind a blue portcullis. Pulling the levers to turn the floors blue has no effect on the portcullis, but turning the floors red opens the mysterious red door, which turns out to be hiding... another lever! Pulling it toggles that room's floor between red and blue. Of course, we want it blue to access the stairs. So in this example we're using chained puzzles; X1 and X2 unlock Y1, and Y1 itself is a sort of room X for Y2.
So, generating random puzzle levels. We need a bunch of possible rooms X and rooms Y, but we also need templates for combining them. Coming up with templates is mostly a notation problem. I'll express them like this:
[Y: X1, X2]
A puzzle level designed using this template would generate one goal room (Y) and two puzzle rooms (X1 and X2). The goal room gets a random win condition assigned (Red or Blue in the examples above), and in order for the door/chest/portcullis/bridge in Y to activate, that same condition must be achieved in rooms X1 and X2 by the player. Whether all this involves pulling levers or stepping on pressure plates or some other thing is determined by the random selections of rooms X1 and X2. Maybe we should assign difficulties and bias the generator in favor of easier difficulties early in the game.
Another example:
[Y1: X1, X2, Y2]
[Y2: X3, X4]
This is a chained puzzle. Y contains the ultimate goal, which is accessible only by matching its condition to the ones in X1, X2, and Y2. But interacting with the condition of Y2 is only possible if you reach its lever/plate/whatever, which only happens when you match Y2's condition with X3 and X4.
I'll start out with some very simple rooms X and Y. All rooms X start with no floor color, so we don't have to worry about initial conditions screwing up our puzzle. The first lever pull or whatever picks a random color, and further pulls toggle the color between red and blue.
Rooms X:
Red/blue floor, lever in the corner toggles
Red/blue floor, lever in the corner toggles for 10 game turns
Red/blue floor, lever in the corner opens trap door under player leading to pit full of crocodiles. Ha ha. Fake puzzle room!
Red/blue floor, pressure plate toggles color while an object, person, or monster is on the plate
Red/blue floor, two pressure plates. Each blinks one half of the floor red.
Red/blue floor, two pressure plates. Each blinks one half of the floor blue.
(note that these last two might be bad, since they can only be one color. If you have a red door in room Y, an only-blue blinking plate room would make the puzzle impossible. See below for possibly better rooms like this.)
Red/blue floor, two pressure plates, one lever. Each plate blinks one half of the floor red if the lever is in one position, blue if the lever is in another position.
Red/blue floor, two pressure plates to the left, two to the right. One of the left plates blinks the floor blue, one blinks it red. Same with the ones on the right.
Red/blue floor, pressure plate that requires huge amount of pressure to activate. (More than the player will ever be able to apply). Slow, reanimating iron golem generated in the room. Killing it only keeps it down for X game turns, then it gets up and comes after the player again. It refuses to leave the room. The player needs to lure it on the pressure plate.
Red/blue floor, locked closet in one wall. Indestructible box containing NT key on the floor. Lever to toggle floor color in the closet. Player needs to phase the box, get the key, unlock the closet, and use the lever in the closet to turn the floor the appropriate color.
Rooms Y:
Stairs blocked by red/blue door. (Doors block line of sight).
Stairs blocked by red/blue portcullis. (Portcullises don't block line of sight).
Chest blocked by red/blue door.
Chest blocked by red/blue portcullis.
Here's a more complex room Y that doesn't quite work like the ones above:
Code: Select all
#####
#.>.#
#...#
#...####
# 1#
# 2#
# 3#
#......#
##+#####
Maybe the templates themselves could be organized by category. Binary puzzle templates would be like the earlier examples, with a room Y that has a red door so you need to turn all the room X floors red. The stepping stone room Y would not be available to templates in the binary category.
Okay, I need to stop before I write a whole novel on this subject.
Add ideas! Don't feel restricted to the special modular puzzles I've been describing, but keep in mind that a random puzzle generator will quickly become an immensely complex logical problem if we don't keep things fairly modular and consistent. Coming up with a completely different scheme of puzzle besides the red/blue matching would also be very good, especially if you describe how to assemble the pieces randomly into working puzzles.