3D Monster Maze
Spring 2020
I aimed to apply the mathematical concepts I learned during my A Level Mathematics studies to create 3D graphics, intentionally avoiding external resources to personally confront the challenges associated with rendering such graphics. Consequently, I gained valuable insights into the methodologies used in modern software for 3D rendering, which were further enriched through my third-year Graphics module.
Key Features
- 3D Graphics: I had no prior experience with any graphics technology, however, before I conducted research and learned how 3D graphics are accomplished, I aimed to challenge and expand my mathematical knowledge. Utilizing only the mathematics I learned at A level, I successfully projected a 3D world onto a 2D plane. During this process, I encountered several issues related to 3D graphics, such as culling objects that were behind the camera or obscured by other objects, as well as dealing with polygon edges outside the point of view (POV). These challenges underscored the importance of splitting polygons into triangles for efficient culling detection.
- Collisions: To make the maze navigation possible, I implemented collisions between the player and walls. While I could have restricted these collisions to the x and y axes, this approach would only work for walls aligned with those axes. I aimed for a more generalized approach, so instead, I broke down my movement vector in terms of the normal vector of the colliding wall. This prevented movement in the direction of the wall's normal, allowing movement along objects without passing through them upon collision, regardless of their rotation. Additionally, I wanted the ability to create very large mazes. Constantly checking collisions between all walls in such large mazes would be computationally expensive. To address this, I implemented a quad-tree data structure to selectively check collisions only for objects that are close to each other.
- UI & Pausing: I implemented an overlay containing the controls for new users. Pressing Tab pauses the game and provides options to restart, go fullscreen, or return to the main menu. The main menu features a leaderboard where players can view the times it took for previous players to finish the maze.
Challenges, solutions and lessons learnt
My primary challenge revolved around 3D graphics, particularly the complex task of correctly projecting 3D objects onto a 2D plane. This challenge led me to develop my own matrix library, which allowed me to embed the projection process into matrix calculations. Another issue I encountered, was when I projected a polygon with points behind the camera resulting in unrealistic edges. To overcome this, I devised an algorithm to split polygons into new polygons where all points fell within the camera's point of view (POV). Subsequently, through my graphics modules, I learned about all the processes involved in the 3D graphics pipeline. Pursuing this goal has provided me with a much deeper appreciation for the careful considerations involved in the entire pipeline.
Embedded Game
![](../Assets/MonsterMaze1.png)