The Maze Game is a 3D maze-navigation game created to demonstrate techniques learned in Introduction to Graphics (CPE 471). The objective of the game is to navigate to a treasure hidden within the confines of the maze walls using point-and-click first-person controls.
The goal of the game is to navigate to a treasure hidden in the maze.
The game uses a first-person camera to create the movement. The direction of the camera is controlled by passive movements of the mouse, and mouse clicks move the player (camera) forward. The space bar also creates forward movement and can be held down to move faster and with less effort.
Toggles a view from above the maze with the roof removed to see the inner workings of it. Toggling back will put the player back where they left off within the maze. This allows the layout of the maze to be seen as a whole and is quite useful for debugging.
Starts the maze back at the starting point
N: New Game
Starts a new game by randomly selecting and loading one of the maze files in the Mazes directory
Ends the game and closes the window
When the final goal is reached, the treasure (a bright orb) will levitate, grow and shrink, and then transport the player to a new maze to complete!
The first thing I did in creating my game was create a method of making and loading mazes. The method that I chose to go with was having static configuration text files that could be parsed to determine the locations of objects and the theme (textures) of the maze.
The MazeLoader class that I created searches text-files like the above for 3 necessary pieces of information in creating the maze: Textures, dimensions, and locations of objects.
The first piece of information is the name of the wall/roof texture and the floor texture, respectively. Next, the number of rows and columns are listed to help parse and use the data later. Finally, and most importantly, the locations of objects within the maze are represented as a 2D grid of ASCII characters, each with a different meaning. X's represent a wall, O's represent a piece of the hall, @'s represent the starting position in the maze, and *'s represent the precious treasure at the end.
I also spent time implementing my own first-person camera in a way to make it simple to create and start a camera from any point within the application. My Camera is given the starting position by the application, and reverse calculates pitch and yaw. This way, every time a new maze is started, all the application is required to do is know where to start, and the Camera will do the rest. The game maps mouse movement to camera rotations, by mapping the movement to 720 degrees. Thus, the camera "follows" the mouse, much like a first-person game would be expected to do.
A maze wouldn't be a maze without collision detection, so this is the next thing I implemented. I just performed a simple check based on location of the camera and the list of walls stored in the data received from the text-file. I created a small box around the camera point, and checked the edges of its bounding box with the edges of each wall. I also do the same for detecting when the camera has entered the end square to trigger the next game.
End Game Animation
When the treasure is reached, a little animation is triggered for the orb. I simply started a timer that systematically causes the orb to grow and shrink as well as move up and down. This makes it appear to levitate before the next game is started!
The lighting of the game is very simple. I have a point light over the treasure used to light the maze. In addition, when rendering everything but the treasure, the intensity of the light color is much less. I did this because I wanted the maze to have an "eery" atmosphere. I also add a small emission light to the orb in the fragment shader to make sure it is always much brighter than its surroundings and to mock a "glow."
With more time to work on the game, my main wish would be to add more to the lighting environment. I'd like to have multiple point lights lining the path, possibly a flickering effect even. I would also like to load objects to create a better treasure, and use lighting and shading to make an actual glowing item. Finally, I would add an object in godmode to designate where in the maze the player resides. This way, the mode is a better reference to where in the maze you are.
I gathered all of my sample textures from TurboSquid. It's a great resource for textures and .obj files
Ian Mitchell (Spring 2013)
I sampled his formatting for the webpage. However, the content is all my own :)
Great tutorial site to get comfortable using c++. I wanted to get practice writing classes in c++, and this site was a valuable tool.