A simple level-up maze game built only upon the GLFW library (no game engine).
- OpenGL with version > 3
- GLFW Library
- GLM Library
stb_image
LibraryAssimp
- Blender
FreeType
Project developed and tested under CLion. Models are generated from Blender and loaded to OpenGL environment through Assimp
. Texture images partially retrieved from Minecraft packages and are loaded through stb_image
. Fonts are loaded using FreeType
.
With CLion, open this project and set the cmake
toolchain as VS.
Then build and run at ease.
To use Cmake
, make sure to cmake
with VS configurations.
Then build the solution to generate an executable in the bin
folder.
Two controllable characters:
- Adventurer: moving in the maze to find a way out
- UAV: An extra view deployed by the adventurer, which can fly in the sky and phase through walls to help the adventurer find the way out
The player can switch between two characters using keyboard inputs 1 (Adventurer) and 2 (UAV). The characters can restart at the start of the maze using keyboard input R.
Movement:
- W: Forward
- S: Backward
- A: Left
- D: Right
- Space: Fly up (only UAV)
- Left Ctrl: Fly down (only UAV)
With the left Shift held, the characters can move in a faster speed.
View:
- By rotating the mouse or the mouse wheel, the view can be adjusted
Winning State
The player wins the game by reaching the exit of the maze.
In each game level, the adventurer is placed right outside the entrance of the maze. The adventurer is allowed to move freely outside the maze but once he (it?) enters the maze, the clock starts ticking.
The adventurer will be running in the maze then, trying to find the exit. Once the adventurer passes the exit and reaches outside, the corresponding game level is finished. The adventurer can enter r to level up to the next round (if the adventurer has not finish the level, he can also use r to restart the current level).
To win the game with as little time as possible, the player can do the following things which will make getting lost in the maze more fun:
- Asking for the UAV’s assistance
The UAV in the game is actually a “powerful” UFO above the adventurer, that can fly freely in the sky and even phase through walls :) . The player can switch to the UFO’s view by entering keypad 2 and use 1 to switch back to the adventurer’s. The UAV’s view will aid the player with finding a right way out on the full scale.
However, it is kindly reminded that there will be time penalty if the UAV is used too often.
- Mark a wall block
You might want to mark down the path you have taken. The UAV can also mark the wall to point a direction for the adventurer. To mark a wall block, simple aim at it and enter e. If the current wall is the marked one, it will be removed as a mark instead.
- Collect tiny boxes to reduce time consumption
There are three boxes randomly distributed in the maze. Picking any of them will give you a reduce of time (a “bonus”). It will be comforting if you’ve reached a dead end but then managed to find a box with a bonus of 50 seconds (not entirely a waste of time, isn’t it?)
We do not use a game engine, thus some features are hard to implement, such as collision detection and shadowing. After tons of debugging, we reached the effect as follow:
- Collision Detection
The adventurer’s model is basically a ball. It is definitely designed to be blocked by walls. However, we currently use point to plane detection method. Therefore the ball might appear partially in the wall. With certain floating-point value misses on the edges of the wall blocks, the ball might phase through walls (very rarely, but it does happen sometimes). We are still trying to find out why.
- Shadow
We use depth test and shadow texture mapping to implement shadowing from a point light source. This takes us a lot of time and it is difficult to debug a GLFW application… But anyway we made it here. The result is roughly as follow:
- B: bind / unbind the UAV with the adventurer
- …