Prototype Top-Down Shooter
This project started innocently enough as a learning exercise when I downloaded the Unity "Survival Shooter" example project to learn their new GUI system. Upon completion of the demo, I thought, "Man, this needs physics". A substantial amount of work later and I had replaced most of the gameplay elements:
- Cartoony characters with static death animations were replaced with ragdolled models that register location-based damage (limb shots do less damage than body shots, and head shots are kill shots)
- An optional patrol behavior was added: enemy will patrol any number of designated points within a given area, in any desired order, and engage the player when approached. If the player outruns the attacking enemy, the enemy with return to its patrol.
Additionally, the ray-based rifle (tracers illustrated with a solid color line renderer) included with the project was replaced with an arsenal of weapons that expanded on that basic foundation:
- Pistol. Ray-based collision detection. Weak, but accurate. Minimal force applied to enemy on killshot. Uses a quad object for bullet tracers.
- Machine Gun. Ray-based collision detection. Powerful, but not terribly accurate (good for crowds). Moderate amount of force applied to enemy on killshot. Uses a quad object for bullet tracers.
- Laser Weapon. Since the weapon that shipped with the tutorial project was basically already a laser weapon (despite being attached to a model of an AK-47), I decided to take it a step further. This weapon uses a ray-based collision system paired with a line renderer to penetrate ALL enemies in the path of the shot (within range). Fires killshots with perfect accuracy, but no force is applied to enemies.
- Explosive Weapon. Fires a rigid body that explodes on contact with any collider in the scene. Kills everything within the blast radius and applies variable amounts of force to ragdolls. A checkbox on the rocket prefab currently allows for toggling between grenade launcher and rocket launcher.
I really didn't have an end-goal in mind when I started this project. I'm not a strong programmer, so this project was more of a challenge to see what I was capable of figuring out. A neat bonus of all of this work: a good chunk of this code played well with Google Cardboard and found its way into my iOS VR shooter, "Last Resort".