Tunnel Vision -> Game Download

Eric Dazet

CPE 471

For my final project, I created a game where a player has control of a ship and must fly down a makeshift tunnel while avoiding various objects.


As a kid, I remember playing an arcade game where a player would lie down on a bench seat and have to control a ship flying down a tunnel and avoid objects. The game had two levers which allowed the player to rotate the tunnel left and right with the ship remaining stationary. That game is what I tried to recreate within this project.


Initially, the game is paused and the player must hit the space bar for the game to begin.

If desired, the player can press the reset button (r) in order to start out with a different randomized layout of objects. See Implementation for specifics.

At the top of the screen is a heads-up interface that displays the player's hit points, the current score, the current speed, and the current high score;

Score is measured internally by distance travelled down the tunnel. At every score interval of seventy-five, the speed is increased by a quarter, starting with an initial set value of four.

Once the game is started, the player must rotate their ship and rotate the tunnel in order to avoid the objects within the tunnel. At this point, there is no way for the player to stop or move backward aside from resetting the game. Also, when the game is started, music begins to play. The music will loop infinitely, but will be interrupted if a collision is detected or if the game ends.

The player starts out with ten hit points and currently, there is no way to regain hit points.

If the player collides with an object, the entire game briefly flashes red and an explosion sound is played. The player also loses a hit point, which is reflected in the meter.

Once the player loses all ten hit points, a game over screen is displayed and endgame music is played. From there, the player can either exit by pressing the ESC key or restart that game by pressing the R key; the current score and the current speed are reset, but the current high score is preserved until the game is closed.

There are three types of objects, all appearing at different rates.

Lasers: Highest appearance rate
Lasers are represented by criss-crossing cylinders that are always perpendicular to each other.

Force Field: Second highest appearance rate
Force fields are represented by a single rectangle that leaves a gap around the edge of the tunnel, forcing the player's ship to be mostly horizontal in order to avoid it.

Energy Crevice: Lowest appearance rate
Energy Crevices are represented by a two rectangles that leave a gap in middle of the tunnel, forcing the player's ship to be mostly vertical in order to avoid it.

Keyboard Controls

space bar - Start movement forward (begin game).
a - Rotate tunnel left.
d - Rotate tunnel right.
left arrow - Rotate ship left.
right arrow - Rotate ship right.

r - Reset.
c - End game.
ESC - Close window.

1 - Change background music to Star Wars: X-Wing Fighter wav. Source: [9]
2 - Change background music to Star Wars: Cantina Song wav. Source: [10]
left ctrl - Pause game (Not to be used during gameplay).

Ship Rotation.

Tunnel Rotation.


This game was created using OpenGL on Microsoft Visual Studio 12.0, using the following utilities:

GLEW 1.12.0 Library
GLFW 3.1 Library
GLAD OpenGL Loading Library
IrrKlang Audio Library
AntTweakBar GUI Library

The objects to avoid are generated based on a random number and a random angle value; the number determines what kind of object to draw based on preset values and the random angle determines the object's orientation. Pressing the reset button ('r') regenerates all the random numbers used to determine the objects.

Each time the ship passes an object, the objects random values are changed and its position is set back a fixed distance.

The gameplay environment itself was rendered using the Blinn-Phong shading model as well as multiple light sources that are not physically visible to the player. Everything is the game is also rendered with a basic texture shading scheme, utilizing several BMP image files and assorted preset material characteristics.

Influnces and Entertainment

I am a big fan of the Star Wars movie franchise and most of my game uses Star Wars-related elements.

The ship itself is a Star Wars Arc-170 Fighter from the later movies.
The tunnel is a modified Death Star shaft.
Once the game starts, the default music is the sound of an X-Wing fighter.
The default music can be switched to play the Cantina Song from Star Wars: A New Hope. (see Keyboard Controls)
Once the game ends and the user reaches the game over screen, the Imperial March song begins to play. Source: [11]

I do not own any of the Star wars related soundtracks or object files. The links can be found below.


[1] GLEW 1.12.0 Source
[2] GLFW 3.1 Source
[3] IrrKlang Audio Library Source
[4] AntTweakBar GUI Library Source and Tutorials
[5] Star Wars ARC-170 Fighter Source
[6] Death Star 2 Shaft Source
[7] Game Over Texture Source
[8] Collision Explosion Sound Source
[9] X-Wing Fighter Sound Source
[10] Star Wars Cantina Song Source
[11] Imperial March Song Source