This article was supposed to be Part 2, continuing from this article, but I have decided to revisit it completely. Pictures are worth a thousand words, and Part 1 didn’t include any pictures to describe the mess I was trying to explain. So let us begin (again), and move forward amicably.
Prepare to step behind the curtain and take a peek into the magician’s bag of illusions. At the end of the day, that’s all this game is, really – an illusion. Your toon isn’t really racing forward across an infinite grid landscape, there isn’t really a sky out there, and the world does not really go on forever to either side. No, you’re playing in a box, and it’s only the illusion I create that convinces your brain otherwise.
As children, I think most of us constructed a box diorama at some time or another in school. Here’s one depicting dinosaurs, in case you’ve never seen a diorama (no, this isn’t mine):
This is also how Gridrunner Girl’s world is built, minus the ceiling and left/right side walls. I use a single, large polygon for the floor, and another one at the back which serves as the sky, just like in the “dinorama”. See Figure B below:
The red arrows indicate the directions the floor texture is moved. It’s constantly being moved toward the player to simulate the feeling of racing over the ground. In addition, the texture is slid left and right to give the feeling of strafing when the player moves left and right. In 3D graphics, you move textures across the face of polygons by manipulating their UV coordinates. In school, we learned to plot lines and other neat things in the XY coordinate system. This is the same principle, except it’s called UV instead of XY.
The world would be boring without the hero and a bunch of enemies. I’ve already gone into how the Gridrunner Girl character was created and brought into the game, so let’s pick it up from there. See Figure C below:
As you can see, Gridrunner Girl herself is flat as a board, while the enemies are fully 3D. As described in my previous article I linked, Gridrunner Girl is just a 2D animated sprite projected onto a single, flat, 3D polygon. All the enemies in the game are fully 3D meshes. Rocks, columns, and other obstacles in the game are also 3D meshes. All of these objects are moved down the Z axis (towards the player) with their speed matched to the ground texture’s UV coordinate speed. Matching the objects’ speeds to the UV ground speed is important, otherwise things look like they are sliding around, unattached to the world, and it doesn’t “feel” right.
That’s really all there is to it. A simple solution to creating an endless game world. It’s a digital diorama, built on the principles introduced when I was about 8. It’s life in a box.Tweet