Escape from the maze
FOLLOW ME ON itch.io AND DOWNLOAD THE SOURCE CODE OF THIS PROJECT
You can download the source code of this project in the card from below. You don’t have to pay for it but if you want to support this project and new upcoming projects you can pay the suggested price or name your own price. If this product receives support I will update with more mechanics like multiple levels and a level selector.
A character is trapped inside the maze in which there is only one door to escape. The exit is blocked and to open it you have to find the key, which will appear when you have found a set of objects.
How to play
Move with the WASD keys or the arrow keys and orient the camera with the mouse. Pass over the objects to pick them up.
About the development of this game
The game Escape from the Maze is a first person game made in Unity and consists of finding a series of objects before time runs out. This prototype was a commissioned work.
Initially the project was much simpler than what you can see in the prototype below, since it was a work with clear instructions that emphasized the logic and mechanics of the game rather than the graphical aspect. After delivering the work I continued doing lighting and post-processing experiments, I added a 3D model of a person with animations from Mixamo so that shadows of the player are projected on the walls of the maze. The project is not optimized for the WebGL version so it is likely to run very slow in full screen.
Next we are going to review some information about the inner workings of this game, first of all it is a 3D project developed with the Unity engine.
The 3D models of the scenery are models that I made using Blender and the textures with Substance Painter, this process took about an hour approximately because I already knew exactly what I had to do and I had even done it before.
Given the simplicity of the prototype I used a single Unity scene, so there was no need to worry about transferring information between scenes.
All the GUI elements of the main menu are children of a GameObject that is inside a Canvas, the GUI during the gameplay is also built that way, so when starting the game what is done is to deactivate the GameObject that contains the GUI elements and activate the GameObject that contains the game’s GUI.
The player controls the character using the directional arrows or the WASD keys, the camera is controlled with the mouse. I don’t remember well but it may be the prefabricated “First Person Controller” from Standard Assets.
Objects to find in the labyrinth
The six objects to be found appear in the maze randomly and at a certain distance from each other. To achieve this, an instantiation system was created that takes into account the shape of the parts of the maze and the regions where the objects could appear.
The objects emit a sound whose intensity depends on the player’s distance, the closer the player is to the object the louder the sound will be heard, this is a clue to locate them.
In order to detect that the player picks up the objects, Colliders and the OnTriggerEnter event are used, when picking up an object, it is checked if all the objects have been picked up, if this is true, the key is released.
The key to unlock the exit
The key is like a seventh object that is instantiated using the same system as the previous objects, the difference is that doing so we immediately deactivate the GameObject of the key so that it disappears from the stage, when the player finds all the objects the GameObject of the key appears and a sign in the graphical interface indicating that you have to find the key.
The door to escape from the maze
The door is a 3D model divided into two parts so that it can be opened, and there is a Collider just ahead to check if the player is in front of it.
If the player enters the region in front of the door we check if he has picked up the key, if not the action is ineffective, but if the player has the key the door opens with a rotation animation for each object in the door.