top of page

Trick the Gun

In trick the gun the player plays as a cop set in a dystopian future tracking down and killing bad guys, a pretty generic theme admittedly. However, the twist for this game is that the players partner and weapon is a pacifist gun and therefore refuses to shoot at said bad guys. So, the player has to trick their gun into affecting and shooting objects from their environment which will intern be used to kill the bad guys.

For this project due to time constraints, I created a vertical slice of what a level might look like within the full game, all the assets are made by me.

Art Asset Creation

I made all the 3D assets in blender, textured them using HEAVYPAINT and created all the 2D art in adobe illustrator. This took a while and certain props a lot longer than others. Overall, I made quite a few props and textures, I'll showcase them down below.

Programming

There's quite a lot going on for Trick the Gun's programming, so I'll explain a few systems in the project below.

Velocity Damage

Velocity damage is a base script applied to any object that can be affected by the gun and is used to damage the enemies. What velocity damage does as a script is take the parent objects velocity and convert it into a float variable which is multiplied by a damage amount, we'll call this the overall damage. If overall damage reaches above a certain threshold amount the parent object will have a trigger box around the outside which is set active, once this is active the object is able to do damage. Should an enemy enter this box when the trigger is active the overall damage amount will be subtracted from the enemy's health value therefore dealing damage. The overall damage amount however is entirely dependent on the objects velocity so if the velocity is the lowest it can be (provided it also reaches the threshold amount) the damage will be very minimal.

Throwables

The throwables in trick the gun are objects that the player can pick up and throw in the direction they're facing. Once the object is thrown the player can shoot them with the gun to build the objects velocity, if this is lined up correctly the thrown object will hit and damage an enemy. To code this I made a 'pickup' prefab which detects if the player is in a certain zone and whether or not the player is looking at the pickup object, if both are true the player is prompted with a 'pickup object' on screen. the the player inputs a button and 'picks up' the object. This deletes the object from the scene and adds 1 to the players throwables amount in their inventory. the player can then press 'F' to throw this object, this just instantiates one of the 5 throwable objects in front of the player and adds slight velocity to it to create a throwing effect.

Carriables

Carriables work pretty similarly to how the throwables do, if the player is in a certain zone and looking at the object they are prompted to 'pick up'. The difference here is that once 'picked up' the object doesn't add to the players inventory and instead it stays in the world space and follows the player, essentially the player begins to carry the object. This works with collision boxes, if the carried objects collider touches another collider the player will drop it, once the carriable is carried it the collider will be turned into a trigger waiting until it detects entry into another collider. The player can also drop the carriable while being carried and shoot it as soon as it's dropped, this makes it pretty easy to lineup and shoot at enemies.

The Gun

The gun for trick the gun needed to be slightly unconventional compared to most gun mechanics in games, most of it is pretty normal, it uses a reloading system and references a scriptable object to tell how much ammo it has etc. However, what the gun needed was to have something which would add velocity to an object depending on the point of impact, to do this I used unity's Raycasting system. With Raycasting you can detect the point at which a ray hits an object, from here it's pretty simple, in a script the data would be collected as to where the gunshot hits an object then at this point an amount of force would be applied to the object. This force would be affected depending on the mass of the object hit, should the object have a large mass the force would be a lot lower and vice versa.

Sound

The sound development for Trick the Gun was a really fun process. The music was a really simple and reasonably fast process, all I had to do was create a short looping track and construct and Audio system that loops this in engine. I don't think the music is the best it could have been and in retrospect I probably could have spent a little more time improving it. 

Here's the background music that loops in game.

Trick the Gun background music
00:00 / 00:16

The other part of the sound recording was getting dialogue from my friend Ethan, as he was so keen to voice act a gun. We sat down and recorded voice lines for each state the gun can experience. The lines relate to someone just dying, someone just getting hurt, the gun refusing to shoot at someone, being out of ammo and an idle state as well as shooting 'pews' and reload 'kerchunks'. Then by editing the code that recognizes these states I added prompts to play one of the four voice lines at random for each state on time. I've put some of the lines recorded for the game to the right. Some of the lines unfortunately didn't make it into the game as with everything else going on I ran out of time before submission.

No shooting people
00:00 / 00:03
Did you do that on purpose!
00:00 / 00:02
Hide the body
00:00 / 00:03

Level Design

The level design had to tie all of these elements together so when designing the map, I made sure that there was space for all the systems and prefabs. Thankfully most systems played off each other, throwables and carriables are affected by the gun and sounds are called whenever an interaction is made. The map needed to give the player enough space to play around with these features while also still having some kind of setting and understandable narrative play space.

I came up with a factory style small map with big open spaces and smaller more intense parts for the player to get a full feel for the mechanics and gameplay. I planned and made this map in blender; this part of the process was something I would redo should I revisit this project as the whole map is one fbx file which uses a mesh collider in engine. At the time I was rushing about and wasn't too aware of how inefficient this was, next time I would make the map more modular for reuse later or for expansion as well as to help optimize the game. Thankfully as the game is so small there's no real performance issues within the build.

I also wanted to make sure the player had complete control so on top of the factory map I made a sandbox level which simply allows the player to respawn all types of items and enemies to play around with. I think this addition was really handy as it made sure the player was able to experience all the features I made for the game at their own pace and get a real good feel for it.

Play Trick the Gun yourself!

Thanks for taking a look through, if you want to try trick the gun yourself give the itch.io page a lookse below.

Billy Marsh

Thanks for getting down here!

Teenwolf Thumbs Up
Crushed Cans.png
bottom of page