Game Idea: Shifting Game Maps

In older games we separated the notion of “logical” or “game” coordinates from “physical” or “pixel” coordinates. Tiles for example were addressed in logical coordinates, and we had coordinate transformations to go between tile and pixel space. There’s also the notion of physical “world” coordinates and “screen” coordinates, with transforms between the two.

I wanted to explore the idea of having logical coordinates that didn’t correspond to tiles or pixels. This game idea is that you are playing the role of a tiny ship inside a giant creature. As you traverse the blood vessels and shoot the white blood cells of the immune system, the creature becomes more agitated. As its heart beats faster, ripples run down the arteries, and the entire creature may start moving about. The game becomes more difficult not because the enemies are tougher, but because the world itself is changing and becoming somewhat disorienting.

The demo shows a randomly generated corridor (blood vessel), along with a yellow circle that represents the player. You can click on any location in the corridor to make the player move there, but you have to turn on the animation before you see any movement.

(diagram showing a moving corridor for a dungeon crawl game)
(This is a screen shot of the Flash demo, because your browser does not show Flash.)

Coordinate System

If you turn on debug mode, you will see the black line which represents the “spine” of the corridor. I chose to use the position along the spine as the primary coordinate, and the distance from the spine as the secondary coordinate. (However, I haven’t implemented the secondary coordinate for this demo.)

As the map moves around, the player moves with it. You can also generate a new corridor and see that the player is still positioned within the corridor (on the spine, since I don’t have the secondary coordinate). In some random maps you can see the points bunching up together, which is a sign the constraints are preventing further rotation. Occasionally this causes the animation to be jerky, as a constraint causes further changes up the corridor.

Corridor Generation

I also played with random corridor generation (random world/map/dungeon generation is one of my interests). With debug information on, you can see that the corridor is many segments. Each segment has an angle that’s randomly offset from the previous segment’s angle. The left (violet) and right (purple) points constrain the angle; they can’t cross back behind the previous segment’s edges. The distance from the spine to the edges is also random.

During the animation, the distance from the spine to each edge varies with a sine wave (the left and right are not in sync), and the change in angle from segment to segment also varies with a sine wave.


The source code is available, but it’s not very well documented, and there are several things I didn’t bother implementing (such as the second coordinate).


I’d love to hear what you think. Leave comments on my blog.[1]

Email me , or tweet @redblobgames, or comment: