A small experiment with tactile gunplay in VR, powered by modular systems I had previously written.
This project started with its controller. Most VR controllers have a trigger, but two 2D inputs for the thumb is not so common, so I wanted to make use of it.
I wanted to use swiping down to simulate pulling back the hammer. Jerking the entire controller left dislodges the cylinder, jerking up while the cylinder is out unloads it, and jerking right puts it back. Flicking the thumbstick would simulate loading bullets, and flicking in different directions would load different types of bullets. These later mechanics depart further from reality, but were fun to build and play with.
To make things more interesting, the last shot before reloading has special effects. Even if the player decides to load only one bullet, it counts as the last shot and gets special effects, but loading takes longer and will deal less damage overall.
Empowered fire shot: Explodes, applying a damage-over-time status effect to all enemies in an area. This is implemented as a component that deals damage in fixed increments and destroys itself after a certain period.
Empowered shock shot: Lightning deals damage as it jumps from target to target. Prefers new targets, but can hit the same target multiple times. The lightning is its own object, searching periodically for where to jump to next.
Empowered acid shot: Target takes +50% damage for all future shots. The combat system is event-based, so it’s a component that listens for a DamageEvent and if its owner is the target, it adds 0.5x base damage to the final damage.
Lastly, these behaviors are modular components. The ShotCore script handles the initial hit detection, and everything listed here is a ShotEffect building off that.
This is based on the same AI framework as Lanternbound and my flocking experiments. The most significant additions are a state machine with a different steering strategy for each state, and a proper sensor infrastructure from a scrapped project. Enemies will patrol an area until they see the player, at which point they will try to strafe at a fixed distance while avoiding collisions, stopping occasionally to aim and shoot.
Unfinished Plans: Redirection
A couple things I had originally planned didn’t make it into this demo. I wanted to be able to shoot coins and have it ricochet and hit enemies, taking inspiration from Ultrakill. However, I didn’t have time to fix some issues with the normal calculations that cause the redirection to be very inconsistent.
The special effects implemented in this demo only trigger if the shot is empowered, but the unfinished Portal shot would have spawned a portal between the player and the target. However, converting the shader to my render pipeline proved a challenge, and making it work for stereoscopic rendering even more so. This rendered it almost impossible to test.