VR Maze

by Stephen Sladek

May 17, 2018
499 words, 2 min read


Introduction

This virtual reality project is the third in Udacity's VR Developer series, and is the first where the student takes ownership of the project and gets to build it on their own. The player is required to collect a key, traverse the maze, and unlock the door to the building with the treasure chest. There are also coins that can be collected for a bonus score.

This was my first venture into developing VR on a mobile device and this article will tell of the experience I gained in the process.

Getting Started

First off, I needed to set up the environment itself. This was the easy part since Udacity had already supplied 3D models to me. I just had arrange the models to create my own custom maze for the player to traverse. After that was good and done, I placed waypoints throughout path. I ran into some issues with the waypoints though cause I hadn't added the reticule in, which made aiming at where to click more challenging than the mze itself. I increased the size of the waypoints and added twice as many for good measure to make sure the player could more ably select their destination. Since adding the reticule in GVR wasn't necessarily the most intuitive thing, it was actually the last modification to the project, being done in a final clean up sweep. I dropped in the key and scattered in some coins and my environment was looking pretty good.


The temple. Players must open its doors to win.

My biggest struggles spawned from getting the GoogleVR SDK to cooperate. Unfortunately, the curriculum offered through Udacity at the time was in the process of being updated and so much of the solutions they had offered were no longer viable. It took extensive digging through forums and documentation to finally get the VR scene to compile without error. The largest issue was getting the settings sorted out for which platform to compile to. Turns out that if you're building for Android, you probably want some of those destkop-level CPU support options turned off.

After the environment was rendered, and the errors all gone, all that was left was to implement the code! I made some scripts for controlling waypoint movement, coin collecting, and checking if the door could be unlocked by seeing if the key had been collected.

No Pain No Gain

My biggest struggles spawned from getting the GoogleVR SDK to cooperate. Unfortunately, the curriculum offered through Udacity at the time was in the process of being updated and so much of the solutions they had offered were no longer viable. It took extensive digging through forums and documentation to finally get the VR scene to compile without error. The largest issue was getting the settings sorted out for which platform to compile to. Turns out that if you're building for Android, you probably want some of those destkop-level CPU support options turned off.


The garden. There should be a key somewhere...

After the environment was rendered, and the errors all gone, all that was left was to implement the code! I made some scripts for controlling waypoint movement, coin collecting, and checking if the door could be unlocked by seeing if the key had been collected.

Conclusion

The view from the outlook.

It was very satisfying completing this project and seeing it come to life. I let some of my friends try it out afterwards and they were all amazed by how cool it was to be able to spin around in a chair and navigate through this virtual realm. They especially enjoyed the outlook I created that allowed you look throughout the maze to see which direction to venture towards. It was an overall good experience, with the difficulty being challenging enough, but not too overbearing for an introduction to VR development.