Cardboard Labyrinth Final Report

What is Cardboard Labyrinth?

I utilized Google Cardboard technology in order to make a procedurally generated virtual reality garden maze. Because the maze is procedurally generated, it will be unique each time. The goal of the app is to enjoy exploring the maze, while also trying to find the exit in a timely manner.

How do interesting mazes get built?

Here is a flowchart of my algorithm. It is explained below the image.

MazeGeneration

First, all mazes are built symbolically on a cartesian grid as room nodes with connections. Each maze starts as one room (the entrance) at position 0,0. As long as the maze has not reached the minimum number of rooms, a random room will be selected. This room then reports which directions it has available for creating a new room. The maze generator will then pick a direction randomly from that set of directions to create or connect rooms. The process has a random chance of repeating from a new room, and is repeated in a depth-first manner until minimum and maximum constraints are satisfied.

Constraints for determining which directions are available are: There is no connection in that direction, and a room in that direction would not extend beyond bounds of the maze. Not bounding the dimensions of the maze frequently resulted in either long, straight mazes or L-shaped mazes.

Once the rooms have been created, a breadth-first-search is performed, beginning at the entrance room, giving each room a distance from the entrance. The farthest room from the entrance that is also on one of the edges of the maze is chosen as the exit.  A symbolic version of a maze is shown below:

symbolic

The symbolic representation of the maze is then used to create a 3D representation viewable by the user. This is done by assembling rooms based on a set of pieces. There are 4 edges and 4 corners to each room, and numerous variations of models of each. Rooms are built by randomly selecting from each wall piece according to the room’s connections. Corner pieces are then randomly selected such that they match up with selected walls or the lack thereof.

Building the 3D representation of the maze is finished by adding decorations. The entrance and exit rooms are decorated by four marble pillars, and the exit room has an additional particle effect. All other rooms have a random chance to have a decoration, which is selected from a single marble pillar, a marble fountain, three variations of a tall bush, and a bush made into an arch. The decorations give more visual interest to the mazes, and also help users keep their sense of direction.

What about the models?

The decorative models were fairly straight-forward if you are familiar with Blender. The natural models were created as a mesh with a vertex count of 3-4 per meter, with a small random offset and a bit of tweaking afterwards. Smooth face normals were used to reduce the occurrence of sharp edges. The wall and corner pieces were a little more complex. The most important element to making the maze models was ensuring that they line up without gaps. This was done by defining coordinates where each type of model would match up with any of the possible models next to it. This can be done in Blender by manually editing the vertex coordinates. An example of a single corner model, and an entire maze in its 3D representation are below:

corner

3d

This is a top-down view of a maze, complete with decorations. Here you can see that corners always wrap around and make a hallway, but if a wall exists, it will close off the hallway.

Using Cardboard Labyrinth

In-game, the cameras are completely controlled by the Google Cardboard package. Navigation between rooms of the maze is performed by using the Cardboard’s trigger when looking at the next room. The player then moves slowly to the selected room. An example of what a player might see as they approach the exit is below:

in-game.png

Additional Information

The app was created in Unity3D 5.3 using the Google Cardboard package. All 3D assets, except for the model of the fountain, were created in Blender. The fountain model was acquired from TurboSquid. All model textures, normal maps, and displacement maps were found for free on www.rendertextures.com, a site that is no longer available as of this blog post. The skybox texture is part of the free Unity package “Sky5x”. Particle effects were hand-made using Unity’s Shuriken Particle System. The full project can be found on GitHub.

Advertisements
This entry was posted in assignments, Final Project Reports. Bookmark the permalink.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s