Game Dev Magic

Got more of level 5 done this week! The fifth level is one of the more complex ones, so it’s gonna take another week or two unfortunately. One source of the complexity is all the little set-pieces, like this tram scene for example:

You board the tram, and it takes you down an infinitely long tunnel. I thought I’d show how something like that is accomplished — and it’s not by just making a really, really long tunnel. Instead you use a little game dev magic!

The first thing to note is that even though it looks like it, the scene isn’t composed entirely of tiles. In the tile editor, it looks like this.

But where is the tunnel…?!

Most of the tunnel isn’t even part of the world! It’s just designed to look that way with large, repeating textures layered over each other in the background.

So when you’re riding the tram down what appears to be an infinitely long tunnel, you’re actually just standing still while the repeating images zoom past you in the opposite direction, with different layers moving at different speeds to create the illusion of depth.

The same images are used for both the top and bottom of the tunnel.

The tram has to travel a bit from it’s initial position to reach its final resting place in the tunnel though, and the game’s camera has to move to follow the tram. During that time, the backgrounds’ movement is altered based on the movement of the camera, which maintains the illusion of the solid tunnel and its depth. From an absolute perspective, it looks something like this.

There you go! Another little piece of game dev magic ruined — hopefully it doesn’t negatively affect your enjoyment of Bleed 2. I hope you had a good weekend! You’re looking great!