Mazes are among the of oldest types of game elements, going back thousands of years. The ancient Greek story of Icarus flying out the maze built to hold the Minotaur inspired my first paper-based game levels of Dungeons and Dragons decades ago.
While building 3D games, there are a couple of modeling challenges that are in tension. Solving one problem can cause the other problem to occur. Recalls Icarus’ father telling him not to fly to close to the sea or to the sun.
The first challenge is collision detection. Collision detection can be a little tricky in 3D game maze construction. It is important to get the pieces to line up precisely. Too much overlap or too large of gap can allow the player to slip through a crack, even if the player’s collider shouldn’t fit through. Because the player can control their character to intersect the walls from a variety of angles, it is easy to create places where the player will rapidly jitter and then suddenly pop through the crack.
The second challenge with maze construction for 3D games is to avoid have two surfaces in the exactly the same space, resulting in rendering flicker between those surfaces. A difference of 0.01 is enough in X, Y, and/or Z to keep solid walls looking solid.
To help quickly build mazes in Unity3D, there is some great software available in the Unity Asset Store named QMaze, created by Smurov Sergey.
Set-up to get the basic walls in order took me several weeks, but once in place large mazes can be generated in a few seconds. QMaze is a powerful time saver.
Most of the mazes in Ratkey are under 20×20 cells. Anything bigger and the player can get hopelessly lost. Just to see what a crazy big maze might look like, I generated a 50×100 cell maze using QMaze. The images below are a close-up and top-down view.
More information about QMaze is available in the Unity Asset Store at https://www.assetstore.unity3d.com/en/#!/content/30600.