When development of the originally requested functionality for code, packages, and projects has been completed I usually try to think of what the next logical addons, functionality, or extras to create could be to improve and expand on the originally requested content. This is also the case with the VR Maze project. After I finished developing the requested functionality, I saw a lot of potential in an expanded and modular version of some of the framework elements created for that project.
So, I started developing the package I have been calling the PathFinderMaze package. With this package I can create a maze layout using a normal Excel spreadsheet, export that spreadsheet as a text file, import the text file into Unity. From there this package allows me to click a single button to automatically generate an entire ready to play VR maze complete with collectable maze markers, menus, and designated start/end tiles.
This blog post covers the development steps I took while developing this package.
This post will cover the following sections:
- Intro
- Excel Spreadsheet Map
- PathFinder Tile Prefab
- Automatic Maze Builder
- Tile Masks
- Player Location Marker
- Tracking Camera Zone
- Player Tracking Menu
- Player Rig Relocation
- Collectable Markers
Intro
The Pathfinder Maze package was created to streamline the process of dynamically and automatically generating grid based VR mazes from a single text file exported from an Excel document. Using this package the user can create a top down maze plan in an Excel spreadsheet, export it to a text file, and import it into Unity. From there this package will parse the text file and auto build the VR maze. This automatic generation process includes building and placing all maze grid tiles, path tiles, wall tiles, start and end tiles, and up to 5 collectable markers place on small podiums at locations around the maze which can be specified in the Excel spreadsheet.
This package was created as an extension of the original VR Maze Project functionality. To learn about the development of the original VR Maze building blocks that proceeded this package, please click the following link.
Excel Spreadsheet Map
The first step I took in streamlining the process of creating VR mazes was to start at step 1 of the process: planning the layout of the maze. While working on the VR Maze project, the original layout plan for the maze was created as an Excel spreadsheet. So naturally that seemed like the best starting point as it provides a convenient system for planning, organizing, and displaying grid based map plans.
Other than the visual aspect of being able to see the map plan, I needed a system to convey those plans into functionality I would later create in Unity. When I looked into it, I quickly found that Excel has a built in function which allows users to export full spreadsheets as a simple text file. Once I found this functionality, the next step was to fill each cell of the spreadsheet with the information my Unity code would need when building the maze.
I decided that the important tile information needed to build each grid tile for the maze would include the following categories:
Tile ID: Holds the TileID for the tile. This includes the column letter and row number. ex: “A1”
Block Type: Holds the type of block this tile will be. ex: PATH, WALL, MARKER, START, or END
Tile Info: Holds the info text displayed to the tile menu
Direction: Holds the name of the direction the tile menu will face. ex: NORTH, SOUTH, EAST, or WEST
Marker Type: Holds the marker number to be displayed. Only used for tiles with block type MARKER
By placing each of these pieces of info into each spreadsheet cell as text and separating each piece of info by a colon, I could now export the entire spreadsheet to a single text file which my Unity code would import, parse, and interpret as a plan used to build a maze.
PathFinder Tile Prefab
Once I had the text document blueprint for a maze ready, it was time to build the Unity content building blocks needed to turn that blueprint into an actual maze.
The mazes in the original VR Maze Project were hand crafted as solid single models by our teams modeler Alex Fatemi. This meant all of the walls and paths were in set locations. This also meant that changing any element of the maze plan would require building/rebuilding, exporting, importing, and implementing entirely new models each time. Although this process has some upsides to it, it is very time consuming.
So, I decided to streamline the process and make it way more modular. To do this, I needed to create an all-in-one tile prefab capable of being a wall, a path, an empty spot, or a marker tile.
I started with the original grid tiles prefabs used for the VR Maze project and decked them up with all the addons needed for this new modularity.
These addons included a wall block, a pathway block, a tile info menu, a marker pedestal, a copy of each of the 5 marker objects, and code to manage and control all of these elements.
With each of these new elements added, the tile management code I created could easily toggle any of these assets on/off based on the information it received from the maze builder code during the setup of each maze. Now I had a dynamic universal maze tile which was capable of becoming any tile the automatically generated mazes could need.
Automatic Maze Builder
Now that the maze plans and building blocks were ready, it was time to create the code to make the magic happen. Having previously created grid building and management functionality for the VR Maze Project, I already had a foundation to expand on.
I created the automatic maze builder functionality by altering the previous grid building functionality to import, parse, and interpret the data from the maze plans text file. I also created some Editor code which allowed me to click a button in the Unity editor which would run the process of turning the text file into usable info without having to start the program running. This feature makes setup, testing, and alteration of the maze content much easier.
When this editor button is clicked, the text file is processed, the grid tiles are created and places, then the processed text info is sent to each tile. When each tile receives their corresponding data, they then set themselves up accordingly as pathway tiles, wall tiles, marker tiles, etc.
With this functionality in place, I could now generate entire mazes from Excel spreadsheet plans to fully build VR mazes in a matter of minutes.
Tile Masks
Having completed the core modular functionality I had aimed to create with this addon package, it was time to test it and create a few quality of life elements to make the mazes more enjoyable and easier to play.
The first of these quality of life changes was the addition of Tile Masks. In the original VR Maze Project, the user was not able to access the 3rd person camera view functionality which is build into most PuppetJump experiences. This meant that the users were always viewing the maze from a first person perspective. Although useful for certain circumstances, limiting the user to exclusively viewing the maze through first person perspective made navigating the maze much more difficult, confusing, and frustrating.
When I added the 3rd person camera view functionality back into the PathFinder mazes, I quickly realized a huge fallback to this perspective. While in 3rd person view, the user could see the layout of the entire maze. Although this was helpful in getting their bearings within the maze, it removed any of the puzzle or discovery aspects from the maze experience.
To fix this I created the Tile Masks functionality. Tile Masks are black panels which are only visible while in 3rd person camera view. When the user visits a tile for the first time, the tile mask for that tile gets disabled. This allows the user to uncover the maze as they navigate it, letting them find a path (thus the “PathFinder” package name) through the maze.
With this feature implemented, users could see where the boundaries of the maze are, and tiles/paths they had already visited while the unvisited tiles remained obscured. I felt as though this feature added a sense of adventure and discovery to the experience of solving each maze, while also allowing the user to get a sense of where they were and where they had already been within the maze.
Player Location Marker
While testing out the Tile Masks functionality, I quickly realized that while viewing the maze from the 3rd person camera view I often had a hard time identifying which tile my player was currently occupying.
To remedy this issue, I created the Player Location Marker feature. This feature places a large rotating 3D arrow and a smaller 2D arrow icon above the tile the user is currently occupying. This marker is only visible while the user is using the 3rd person camera view and becomes invisible when using first person camera view so as not to be distracting or confusing to the user. This marker also rotates to face the direction that the player is facing. This feature makes it easy to identify where the player is located within the maze and which way they are facing in order to determines which direction they would like to go next when returning to first person camera view.
Tracking Camera Zone
Re-implementing the 3rd person camera view functionality added a lot to the experience of solving the VR mazes. The regular 3rd person camera view zones used by the PuppetJump framework utilize a stationary location for the camera to relocate to when activating the 3rd person camera viewing feature. Although this setup works very well in most environments, I found that it had some drawbacks when used with VR mazes. The angle and position of these preset camera locations often made it very difficult to gather useful information about the maze and often made it confusing to tell which way the user was facing when returning to first person view.
To remedy this issue, I created the tracking camera zone. This feature is comprised of a third person camera zone which follows the player around as they move and turn. That way, when the user activates the third person camera view, the location the camera moves to is always in the same relative location and direction from their player rig. This consistency in perspective changes between first and third camera view made gathering my bearings and navigating the mazes feel much more intuitive.
Player Tracking Menu
The next quality of life feature I felt the package needed was a menu system. So, I created a menu which always follows the player around while disabled. When activated, the menu appears and becomes stationary until the player disables it again.
Player Rig Relocation
After some testing, I was happy with the overall functionality of the new VR mazes and auto building functionality. But while building and testing new mazes, I noticed that in order to improve the modularity of the package, I should add a feature to automatically place the player rig at the correct starting tile for each maze when it gets built. Without this feature, there was a chance that the player could be dropped into any random tile of the maze when starting a newly built maze.
Collectable Markers
At this point I had the auto building functionality running correctly, the navigation ironed out to an intuitive and comfortable level, but the mazes were still missing something: a Goal!
Without a goal, the mazes got sort of boring fast as it was just a series of teleports around a fairly plain environment until arriving at a designated end point. Other than reaching the end tile, there was no incentive to explore at all.
So, I created the Collectable Markers feature. This feature converted the built-in map marker objects and pedestals into collectable object. With the addition of a little code and the creation of a small companion tab added to the menu, I now had a fully functional collectables system.
Now the users would be required to find and collect each of the map marker objects before being able to complete the maze and move on.
Leave a Reply