In this project I made a maze game where you are a sphere navigating a maze and trying to reach the end to get to the next maze. I acomplished this by procedurally generating a maze and then reperesenting it with objects. I then applied axis alighned bounding boxes to all of the objects. You play as the sphere guided by a 3rd person camera view. The end of the maze is marked by a small blue cube.
In order to provide a large number of diverse mazes, they can be procedurally generated. This is done by generating a 2D array of square objects. Starting from the top left corner you continually pick adjacnt squares. When you visit a square you mark it visted and do not visit it again. Eventually when you run out of moves, you pop previous squares off the stack until a viable move is present. When there are no more legal moves and the stack is empty, the maze is done. I then transfered this to an array of zeros and ones that would reperesent the maze pattern generated. From here I put wall objects at all of the 1s and and seperated them by a factor including the walls width. By only loading one maze at a time procedurally, just one has to be in memory and many mazes can be made with limited space.
Since the player must be able to see a certain portion of the map, a 3rd person camera is required.
When loading objects into the game max and mins are stored for x, y, and z. These are then stored in BoundingBox objects attached to the GameObject. Every frame the sphere's box is checked against all of the others. If a collision is detected the desired move is checked to see if it will remove the collision. If it will it is allowed, if not the move is prevented. When the sphere collides with the end of the maze, the maze is complete.