Yokho's Adventure

3D OpenGl game with complex game mechanics and graphics

Project Background

The project is a classic (solo) racer game, where the players control the ship along a non-linear path. The target of the game is to finish two laps before the timer hits zero. To achieve this, players can collect different items, some with positive, some with negative effects.
To increase the difficulty of the game, players can decide to switch on “dark mode”. Dark mode also turns on the path lights to help the player, however these lights are only located above some of the power ups.
The game is controlled by the keyboard, this includes the movement of the player, or changing between different cameras and dark mode.

Features

Route

The 3D non-linear path in the game was implemented by Catmull-Rom spline:

By providing the correct texture coordinates for each vertexes, a metal floor is rendered on the path (metal_floor.png) To make sure that later the camera, and the spaceship orientation is correct, the normal vectors were provided, when the path was created. This was especially important at the loop. Lighting was implemented by the Phong model for the directional light, and by Blinn-Phong model for the spotlights (of the spaceships). Besides the main path, several other paths were created for the non-player spaceships. For this purpose, the PathNPC class was created, which reads the vertexes of the path from text files, and generates the path. (Note: these paths are not rendered)

HUD

A basic graphical user interface was implemented that shows:

Camera

Three additional camera view was implemented besides the free view:

To make sure that the ship and the camera is always facing in the right direction, the TNB frame was calculated and used.

Basic Objects

Three basic objects were created:

Lighting

Beside the provided directional light, many spotlights were added to the game.
Dynamic lights were added to every spaceship in the scene. To easily update the position and direction of the lights, a SpotLight class was created and added to the spaceships. The parameters of the light are updated every time when the ships’ position and orientation is updated.
There are about 30 more spotlights in the scene, which are turned on in dark mode. When dark mode is set on, the ambient lighting is set to a lower value on most of the meshes.

Advanced Rendering

Water

The city in the scene is floating on a lake, and the water was rendered by using a vertex and a fragment shader on a height mapped terrain.
The shader was based on “joltz0r”’s (WebGL) algorithm with some modifications such as:

Height mapped terrain - Multi-texturing

The lake in the scene is surrounded by hills, created by using height-mapping. To make the hills look more realistic, multi-textures were applied on the objects, depending on the current height of the pixels of the object in the scene.

Path lights

When the game is switched to dark mode, the path lights textures were overwritten by their fragment shader, giving them a different look and lighting.

Strengths

One of the biggest strength of the game is the rich environment provided by the meshes. The buildings and the flying non-player spaceships create a great atmosphere for the game. The water also looks decent, and because of the variety of the path, the game doesn’t become boring during the two laps.
Dark mode is quite interesting, because it is more difficult to see the pick-up items, and only some of them has a light above them.
The gameplay is interesting, because at higher speed, it is more challenging to move to the sides of the path in time to pick up an item, therefore going faster is not necessarily the best choice.

Weaknesses and Possibilities

The graphics looks nice all together, however some more advanced shading techniques could have been used, such as shadows, which would look very nice in dark mode, or some sort of blurring effect when the player picks up a speed up item. The water could have been better by changing the vertex positions in the vertex shader, and the path could have some sort of fence or wall on the sides. Some animations would also improve the game, for example an animation for the engines of the spaceship, or an effect when an item is picked up.
The gameplay could be improved by re-designing the positions and the number of the pick-up items.

Technologies Used

The game was developed in C++ by using OpenGL 4.0 and the Windows API. The textures were designed in Photoshop and the meshes were edited with Blender.

Interested in hiring me for your project?

Looking for an experienced developer who is interested in games development and keen to learn more about the technology and the industry?