Last week, I talked a little bit about the basic framework of Vidar’s random puzzle generator, which goes (from top to bottom) map to puzzle to option. Today I want to delve a little bit more into what an option does, because it’s what ultimately creates everything that a player will interact with.
An option contains lists of coordinates for all sorts of things: switches, doors, mirrors, stairs, boulders, pressure plates. When a new game is started, an option for each puzzle is chosen and saved to the save file (so that when you boot up from a save, you don’t end up with new puzzles). Each option then runs through its lists and places all of the mechanics at the correct coordinates.
Depending on the mechanic in question, the option might do different things. One of the easiest is swapping tiles. For example, in an Ice Puzzle, there are rocks that block your path, and direction arrows that force you in a certain direction.
These are created by using this past week’s Friday Script – Hime’s tile-swapping script. Rocks are just coordinates, and so I use the “pos_swap” function I talked about on Friday. Direction arrows are a bit more complicated – they come with a direction. And so I just use a case statement to figure out which of the four direction tiles to place.
The other mechanic that uses tile-swapping is the dark cave puzzle layout itself. I generate holes to make the cave more “maze like”.
Right now, the holes are generated by region. So I use Hime’s “region_swap” function. Unfortunately, because RPG Maker VX Ace has a cap on region #s, this means the dark cave puzzles have a cap as well. In the next few weeks, I hope to migrate to a system that allows for limitless options in the dark cave.