Takeaways From VR

In the fall semester 2022, myself and three others created a VR sandbox spellcasting game. The premise is that you are a wizard with a pocket full of gems that you can toss around to cast spells. These spells let you fight, destroy objects, navigate around the level in interesting ways, and spawn fun props. This post will outline the lessons I learned from my VR development experience. 
demo_steve.mp4

Perfect Throwing

Our game is about casting spells by throwing small objects. Throwing things is essentially the main mechanic of the whole experience. Historically, throwing is questionable in most VR games. Often times it will feel off, and shoddy throwing physics tends to break immersion. The problem is that underhand throws go way too far, and overhand throws don't go far enough. Here are the default throwing settings in the Unity's XR Interaction Toolkit:
By default, as the player is holding an object and about to throw it, the system will work in the following way:
  1. Every frame, cache the controller's velocity.
  2. When the player releases a button to throw, take an average velocity from the last 0.25 seconds.
  3. Weight this average as defined by ThrowSmoothingCurve (none by default).
  4. Apply this velocity to the released object.
The problem here is that there is no throw smoothing curve. Underhand throws start slow and accelerate, while overhand throws start fast and decelerate. There is no system in place to handle these cases, causing the aforementioned bad throwing physics. The solution is to create a throw smoothing curve which filters out motion that is too fast and exaggerates motion that is not fast enough. After implementing this curve, it will feel much, much better.

Everything is more fun in VR

Seriously, game designers need to capitalize on this. When Connor and I were testing this game, we noticed that it was super fun to do simple things like stack boxes, throw rocks, and to play with the explosion features we provide for the player. We had to pry testers off of the headset after playing for hours on their own volition simply because there are so many things to do in this world. I don't really know why VR is so much more fun than normal gameplay, but I have a theory.Normal controllers only offer a fixed number of inputs due to a fixed number of buttons. VR controls, on the other hand, have the same buttons in addition to the position and rotation of the controllers and headset. Since VR has considerably more input that is provided to the engine, it gives the player the means of interacting far more with the game world. This means that all we have to do is give the player a modular item, like a small, simple box, and they can do any number of things with it:
  • Stack them to make pyramids, then explode them
  • Use them as a platform to reach additional parts of the map
  • Use them as a shield from enemy projectiles

Spell Design

We implemented the decorator pattern, a system of quickly making our spells modifiable, potentially even at runtime. This is a good system to capitalize on the extra fun that comes out of simple VR actions. All we did was set up components for the following features:
  • Explode on impact with some force modifier f
  • Spawn a GameObject on impact
  • Teleport the player on impact
  • Emit light
  • Morph and grow into a bigger object
  • And several more small interaction scripts like destructible objects, damaging enemies etc
From here, we already had over 10 spell candidates for the final game. We originally planned on allowing the player to create or find new spells while the game is running, but we cut this due to scope. We used these decorators to make the following spells:
  • An explosion that shoots the player back like a rocket jump
  • Make f negative to suck in surrounding objects to create an implosion
  • Spawn the aforementioned multi-purpose cubes
  • Spawn and grow ice crystals from surfaces to block off areas, reach new parts of the map, or build a small structure
  • Spawn platforms in the sky for the player to jump across
  • Create a bouncy ball of light to illuminate the darker areas of the map
Seriously, the list goes on and the potential we came across with just a few trivial decorators is astounding. I learned from our designer Connor that it's best to make each spell interact with another. For example, the player can grow ice crystals out of the ground, but they can also destroy them with the explosion spell. This ensures that the game is balanced and that the player's intuition will help them get further into the game. Sandbox games are a great application of VR, and I hope to see more of them in the future.

The Development Team

Steven Annunziato - Team lead, systems & gameplay programmer

Michael Bowen - Dev ops engineer, Oculus hand tracking integration

Connor Evans - Systems design, game feel, level design

John Wright - Environment art, destructive props