i’ve written about what a level of lesbian spider-queens from mars looks like in the game’s language – not the layout of the halls and walls, but the script that dictates which enemies appear, and when, and what timing each level moves to. these level scripts and the rooms’ actual layouts are seperate – a level can take place in one of up to three different rooms. what does a room look like, then, in the game’s code?
let’s use this room as an example – the first room in the dungeons, area three of the game. (you can get to this room from the very beginning of the game by going through a passage hidden in the banner behind the queen’s throne – did you know??) this room has spikes, which periodically extend and retract. when they’re extended, they function as walls, changing the layout of the maze.
why was this room designed like this? since this is always the first room of the dungeon area, and thus the first room with spikes, this room is intended to introduce the player to the more subtle dangers of spikes: not being impaled on spikes as they extend, but spikes’ ability to break the queen’s laser and leave her cut off from a cocooned slave, who may then have time to escape. you can see that when the spikes are retracted, there’s a clear line-of-sight for the queen all the way across all the outer walls of the room. it’s easy to snare a slave on the other side of the room, who is then too far to reel in before the spike closes and cuts off the line.
how does the game store this room, or rather the information about where the every piece of the room goes? in the game code, the room looks like this:
what does all that mean? let’s look at the top part first: a grid of numbers. how does the game translate those numbers into a maze of walls and hallways? every room is lesbian spider-queens is essentially a grid, with walls running along the lines between grid spaces. each space on the grid keeps track of two things: whether there’s a wall along its upper side and whether there’s a wall along its left side. (whether there’s a wall along its right side is the responsibility of the grid space to the right. whether there’s a wall along its bottom side is the responsibility of the space below it.)
if a grid space contains the number 2, that means there’s a wall on its left side. if it’s a number 1, that means there’s a wall on its upper side. and a 3 means there’s both a wall on its upper side and one on its left side. a 0, naturally, means that there’s neither. you can see the leftmost column is 2s all the way down – the left wall of the room, which is an open hallway from top to bottom. the 0 in the bottom row represents the door in the lower left – the bottommost row is actually the grid row BELOW the room. those 1s make up the wall along the lowest edge of the room. it’s the same with the rightmost column.
solid rows of 2s or 1s might not be too hard to visualize as walls, but can you look at the middle of that number grid and make out what the room should actually look like? i can’t. that’s why i had a level editor.
my level editor is actually just game maker. game maker makes arranging pieces in rooms super easy. i just pick a horizontal or vertical wall, left click to place it on the grid, right click to erase it. i’ve programmed each piece of wall so that, when the game maker “game” is run, it opens a text file on my computer, finds its place in the grid, and sticks a number in it: if it’s a horizontal wall, the number 1, if it’s a vertical wall, the number 2. if a vertical wall finds that there’s already a 1 in its grid space, it changes the 1 to a 3.
the red lines represent spikes. they’re just to help me keep track of where the spikes go – they don’t make any changes to the text file. spikes are handled somewhere else.
when i run this game maker game, it gives me a text file containing the exact number grid you’ve already seen, which i then copy and paste into the game code. the downside is that i can’t feed a number grid back into game maker and have it arrange the walls accordingly – the process is one-way. but i can copy and save rooms in game maker, so that they’re available in case i want to change them.
the text file, as i’ve said, doesn’t contain any information about where spikes are located. nor the tiles with the martian slaves chained up on them which go in the room’s walled-in boxes. where does the game keep those?
below the number grid is a series of lines that indicate where the pieces of the room that aren’t walls go. the first two lines correspond to pieces of “decoration” – the chained martian slaves. the first number indicates which decoration tile (there are thirty-five different tiles total) goes in the room, and the second and third numbers indicate which row and column to put them in. (consider the leftmost column and topmost row to be number 0.)
the lines labelled “spike” indicate, of course, where spikes should go. in addition to a row and column, each spike has two additional pieces of information: which direction it points in and what its starting state is – extended or withdrawn (“out” or “hidden”). in this room, the two horizontal spikes begin extended and the two vertical spikes withdrawn. when the horizontal spikes withdraw, the vertical spikes will extend.
and that’s all the information the game needs to build a room. if the list of what enemies appear and when is a script, you can think of this is a blueprint. one of these blueprints combines with one of those scripts to create every single level in lesbian spider-queens of mars.