Maze Game by Lahiru Perera

CSC 471 Winter 2019

Game Screenshot

Project Overview

My project will take a text file that represents the map using ASCII characters and then render the game with that given layout. The map contains information such as the user spawn point, end target and the hidden traps.

Layout Generation

The map is first read in to the program and saved to a two-dimensional array of a maximum size of 15 by 15. The possible ASCII values for the map are the following:
         0 represents a wall block
         1 represents a pathway block
         2 represents a pathway but one that is on the correct path to the target
         3 represents the spawn point for the player
         4 represents the target tile
         5 represents the hidden mines

Controls

The player can navigate the game by using the WASD for movement and the mouse to move the cameras view. The R key can be used to reset the game and take the player back to the starting tile. The M key can be used to show the user the path to the target as specified in the map text file. Finally, the N key can be used to toggle between an aerial view with the M key used in conjunction.

Collision Detection

The collision detection is performed by using the map that was loaded in during the starting of the game. Since level is generated by cubes of equal size, the players location on the map can be determined by simple equation. Knowing the players position the game will check if the players next movement is valid and if not, it will "bump" the player back into the path.

Lighting

The lighting for the trap and goal meshes are done using the Blinn–Phong shading technique. For the position of the light source the camera position vector is used to add the effect of changing "shadows" as the player walks past or looks around an object. The lighting effect is not applied to the maze wall and floors though this was originally a side goal of my project.



Arieal View Enabled

Arieal View

Game Goal

Goal

Hidden Mines

Hidden Mines

Hint Enabled and Path Shown

Path Enabled