Warp Tunnel game


Short description:

The game is done in C++ using OpenGL. It was done as part of the coursework where I had to create a path based 3d game.

The objective of the game is to collect as many coins/talismans to gain points, before you run out of HP from hitting asteroids.

This coursework was heavily inspired by a television series “Doctor who”. Specifically the animated intro the series had in 2009-2010, where the “TARDIS” was flying through the time vortex. I thought it would be cool to recreate a version of that for the path coursework.

Features implemented:

  • Controls:
WASD, T and F buttons. A - Move laterally to the left of the tunnel, D - Move laterally to the right of the tunnel, W - Increase the speed of the TARDIS, S - Decrease the speed of the TARDIS, T - Switch camera to third person view, F - Switch camera to first person view.
  • Camera:
There are two types of cameras: A first person view, where the model of the police box is not shown (the camera is moving left and right when A or D is pressed. And a third person where the camera stays in the centre of the screen and only the model moves sideways. (as well as wobbling backwards and forwards)
  • GUI
Simple HUD, which shows the hit points remaining and the score you have as text in the right hand corner, as well as the fps to see it.
  • Procedural generation:
Perhaps the most important thing in this project. Nearly everything in the game is procedurally generated: the tunnel is not set on a specific path, instead The whole tunnel consists of 6 coordinates on the centre-line, thus 5 segments. police box is flying through the middle one and when it reaches the end of the third passage, the new one is immediately generated infront of the front most section with a slight shift in a random direction. The rest of the sections are shifted by one, so that it seemslike the player has passed that section. (the last segment is discarded). This creates the illusion of a continuous never ending tunnel. Below is the picture of a tunnel from the outside:

Positions of the asteroids, UFOs and coins are also generated procedurally for each new segment the player enters, being generated along the new path trajectory.
  • Collision detection:
A bounding sphere collision detection method was implemented to track the collisions between the player and other objects. 
  • Height mapping:
The asteroids' irregular shape is generated from a sphere with a height map applied to the distance of the point on the sphere's surface from the centre, depending on the corresponding pixel of the grey-scale image (height map). The values range from 0 to 255, where 0 is black and 255 is white. The resulting irregular sphere is then smoothed to not have a very sharp look.
  • Lighting:
There is a couple of lights in the scene: global ambient light, a point light around the player and a spotlight in-front of the player. 
  • Special effects:

There is a fog implemented in the end of the tunnel in-front of the player, to hide the fact that the tunnel is finite. Transparency is implemented to make the stars from the skybox being able to be seen from the inside of the tunnel. There is also a camera shake implemented when the player collides with the asteroid or a UFO. The shake lasts longer the faster the player goes and it is also longer for a collision with a UFO than a collision with the asteroid.

    • Gameplay:
    The faster the player travels the more points he gains from collecting a coin, however he receives more damage from colliding with asteroids and UFOs.


    A full documentation is located here:
    documentation