Javier Cabero @ Copyright 2024
This is a learning project to get started with Unity and OpenXR. The goal is to find the star in the dungeon. The main technical idea was to do random level generation in Unity and the essential pieces that make a VR game. This helped me understand the scope and effort involved in each of the areas. I've followed Black Whale Studios tutorials on Youtube for the set up and basic game mechanics with the XR Interaction Toolkit. Using ChatGPT for Unity scripts improved a lot my understanding of the framework and writing the MonoBehavior scripts. All assets were free stuff I found in Unity Asset Store.
A gong plays while the background music begins. Darkness fades to the view of the initial dungeon room. Few doors remain open for the player to choose their path. It's possible to see what's in each room ahead, so a player would probably choose the weapon room first before the monster one.
fade-in.mp4
Few settings determine the number of monster, weapon and puzzle rooms.
Originally, the level was made as the player walked through it by expanding 3x3 sections around them though later an algorithm for a fixed level layout generation on startup was added. This improves performance.
A simple combat system was implemented:
- The player can pick up an axe and successfully hit enemies. The axe plays a sound when picked up and the enemies complain about the hit.
- The player can get hit but recovers if undamaged. The screen will turn red on and off for signaling it.
- Enemies can be killed. A death animation is triggered when their health reaches below 0.
- Enemies are implemented with Unity agents and require a NavMesh to navigate. The NavMesh is implemented through an invisible floor that's fixed below the generated dungeon.
pick.weapon.mp4
get-damaged-and-recover.mp4
kill-enemy.mp4
Reaching the stargate is the goal of the game. A victory screen and music will appear when doing so.
victory.mp4
You can test this game by downloading Unity and OpenXR. The configuration I followed can be seen in this video. https://www.youtube.com/watch?v=0rL_YrqG7lU