We are very excited to announce the release of
Cryptic Cabinet, a new open source mixed reality showcase built in Unity that demonstrates how Presence Platform features can turn any room into a unique gameplay experience. Created by
Magnopus, the showcase demonstrates how to integrate various MR features including
Scene API,
Shared Spatial Anchors,
Colocation,
Passthrough, and
Passthrough Color Mapping. We leverage
Interaction SDK to demonstrate best practices on how to interact with the elements in the scene through various puzzles. The full source code is now available on
GitHub making
Cryptic Cabinet the perfect way for developers to explore the potential of mixed reality on Meta Quest.
Cryptic Cabinet - An MR Escape Room
Mixed reality puzzles that adapt to any room layout
Mixed reality experiences are often better when they interact and blend in with the user’s real world surroundings. But building MR experiences that adapt to every user’s unique space is a challenge for many developers. We developed Cryptic Cabinet to showcase how developers can create an MR experience that is tailored to each player’s room. In Cryptic Cabinet, the experience begins with a mysterious cabinet appearing in the room. When the cabinet opens, the room fills with more cryptic items and the player needs to decipher how to use the items correctly to return the cabinet to its rightful owner.
In order for every user to have a great MR experience, items need to be placed optimally in any room based on the layout provided during the mixed reality space setup. Cryptic Cabinet adapts the position of the puzzles based on the location of the walls, floor, ceiling, and furniture so the experience is customized to the user’s playspace.
Developers should also enable customization by the player after initial positioning. This is an important step as users don’t always set up their room with every real world object fully mapped and users will still need to be able to interact with important objects.
Optimizing for room layout
To optimally position puzzles in any room, a grid system is created that covers the walls, floor and surfaces to create an understanding of the room that is then used to place each object. The app then spawns the objects in order of importance and size:
- Against the wall: We first find a random wall and a random position on the wall where the object will fit. Then we validate that the floor is free. If the floor is occupied we walk the wall until we find a spot, looping through all the potential cells. If no space is found, we go to the next wall and repeat the process.
- On the wall: We find a random wall and look for a random cell on the wall where the object would fit. Some objects have height constraints like the safe, which needs to be at an accessible height. We apply these constraints when finding an appropriate cell.
- On the desk/table only: For objects we want to place on a surface, we find a random surface and a random spot where it will fit. If there are no surfaces set up, we use the floor.
- On the floor: Objects that are specific to the floor will grab the floor grid and find a random cell where the object could be placed.
- Any horizontal surfaces: Finally for objects that can be on the floor or on desks/tables, we place them last following the same logic.
Once a proper position has been found for an object, we set the cells it touches to be blocked. We then update the adjacent cells with the updated distance to the nearest blocked cell. This forms a field of distance that we can use to find open cells that have enough space to place new objects. Once all objects are placed, we use Unity physics system to calculate any overlap and ease objects away from each other. This was achieved using penetration computation over a couple of seconds, and was done to reduce corner cases where some objects would slightly overlap. When all of this is done, the objects are in position and ready for the game to start.
Developers can find more details in the
documentation provided with the open source project.
Intuitive gameplay with either controllers or hands
In order to fully immerse players into the MR experience, it’s important to have life-like interaction with the virtual environment. Using Presence Platform’s Interaction SDK, Cryptic Cabinet integrates natural movements which enable realistic interactions with virtual objects in the scene.
For instance, in one puzzle, the player is able to screw and unscrew a lightbulb by applying the rotation motion on the side of the bulb.
The safe code interaction is delightful because a player can use a single finger to rotate the wheels with a flick as if it was a real dial.
Another example of a natural interaction is placing a key in a keyhole and being able to turn it in place once anchored in the hole. The feeling is of a very natural motion of unlocking the drawer and therefore solving an actual puzzle in the player's real world space.
While hands are great in mixed reality experiences, some users might prefer controllers. Cryptic Cabinet enables both hands and controllers to be used for these natural interactions using the Interaction SDK integration. Developers can find more details on how these interactions were developed by looking at the
documentation provided in the open source project.
Local multiplayer
Mixed reality experiences are often better with friends. Cryptic Cabinet enables both solo or multiplayer modes for solving the escape room. The multiplayer experience is built from a colocated instance of the game and players work together to solve the puzzles. When building a colocated experience, we recommend leveraging the colocation package. Developers can use this package to easily enable shared spatial anchors across multiple users in the same location. This ensures all virtual objects are aligned properly within the room. For more information about the colocation package, check out our
colocation samples.
Start building with Cryptic Cabinet today!
Like many other Quest reference apps and showcases, the full source code for Cryptic Cabinet (including all the assets for the game) is available on GitHub. If you’re interested in building your own MR Escape Room experience or taking best practices from the showcase, please check out the
code and documentation.
We also offer a fully playable version of Cryptic Cabinet in App Lab. Try to solve the mystery of the Cabinet for yourself by
downloading the experience on AppLab.
Cryptic Cabinet is the latest of our mixed reality showcases built using Presence Platform. For other examples of mixed reality gameplay, check out
Phanto and
Discover along with our other samples and showcases in our repository.