Build Your Gun


What if you had a tool or plugin that could make almost any gun imaginable. Then, a game with a lot of varied guns would not be a big problem. That is what my first personal project Build Your Gun is all about.In this project I used a Unity Runtime Editor plugin made by Yasirkula to be able to edit your guns options inside of a build of the project.

Options List

General Options:

Fire rate

The amount of rounds the gun is able to fire in a second. It gives an accurate RPS (Rounds Per Second).


Range

The distance the bullet can go in meters (Unity units) before it gets deleted.


Gravity

Make it so your bullets are affected by gravity.


3D / 2D

Makes your gun shoot bullets in a 3D cone instead of a 2D one. This is because I wanted the tool to work with both a 3D and 2D game.


Damage Options:

Damage

Your gun's base damage.


Crit Chance

The percentage chance that your bullet deals critical damage.


Crit Damage

The percentage increased damage your bullet is going to deal (100 is equal double damage).



Firing modes:

Automatic

Fires only depending on fire rate.


Semi Auto / Burst

Fires depending on two variables: an amount of rounds & time between rounds.


Charge

Charge can be used both as automatic or burst. When you hold the button to fire, a charging meter is filling up. And you only fire when that meter is completely filled.


Bullet Type:

Hitscan

Your bullets hit instantly where you are aiming. Has options for showing lines or not.


Projectile

Your bullets does not instantly hit where you aim. Has options for size and speed.


Accuracy Options:

Accuracy

Your gun's accuracy in percentage. Every time you shoot the bullets has a probability to get any angle in a cone, that size depends on the accuracy value. 100 is equal to a max degree difference of 0 degrees. While 50 is equal to 180 max degree angle difference.


Focused Around Middle

Makes it so the bullet is more likely to get an angle closer to the middle rather than to the edge.


Square Pattern

Make it so that instead of the accuracy forming a circular cone it forms a square pyramid. (Instead of your bullets getting randomized in a circle it’s randomized in a square).


Spread Patterns:

     Fixed Bullet Spread:

Fixed Bullet Amount

The amount of bullets that are going to be shot out at the same time in a predetermined pattern.


Fixed Spread

The degree angle between where the fixed bullet pattern is going to start and end.


Fixed Remove corners

To remove corners from your fixed pattern so that you can fire in shapes of example a cross.

     Random Bullet Spread:

Random Bullet Amount

The amount of bullets that are going to be shot out at the same time with a randomized angle.


Random Spread

The max degree angle between where the random bullet can be fired in.


Focused Around Middle

Makes it so the random bullet is more likely to get an angle closer to the middle rather than to the edge.


Square Pattern

Make it so that instead of the accuracy forming a circular cone it forms a square pyramid. (Instead of your bullets getting randomized in a circle it’s randomized in a square).


Ammunition & Reload options:

     Ammunition:

Magazine Size

Maximum amount of bullets in a magazine.


Infinitive Ammo in Magazine

Make it so your magazine never runs out of bullets (No point in reloading anymore).


Max Ammo

Maximum amount of ammo you can carry.


Infinitive Ammo

Make it so you never run out of bullets (Still needs to reload).

     Reload:

Reload Time

The time in seconds it takes to reload your gun.


Auto Reload

Make it so you reload your gun automatically when it's out of bullets.


Cancellable Reload

Make it so you can interrupt reloads by shooting if you still have bullets in your gun.


Pierce & Bounce:

Pierce Amount

The amount of times a bullet can pierce through objects tagged with pierceable before getting destroyed.


Bounce Amount

The amount of times a bullet can bounce on objects before getting destroyed.


Can bounce on pierceable Option

Make it so your bullets can bounce on pierceable objects when the pierce amount is 0 or all the pieces have been used up. Otherwise the bullet gets destroyed.


Area of effect:

Aoe Size

The size of the aoe effect in meters (Unity units).


Aoe Damage

The damage your aoe is going to deal.


Only Aoe Dmg

Makes it so this gun only can damage targets with Aoe damage.


When to trigger Aoe

For controlling when the aoe should activate. Mostly to give the user bigger freedom when making guns with pierce or bounce functionality. For example only on the last hit, always, only when pierced and only when bounced.


The presentation of this project is under construction

Save & Load

After you have tweaked the guns options and created a gun you want for your game, you can name your gun and press "save". When you want to load it, just fill in the name of your gun and press load. This works both here in game with the Runtime Editor, but also in the normal Unity Editor. You have options for locking your guns, if you don't want the players to be able to go in to their files and change the guns stats.


What I learnedThis project was really fun to work with. It was interesting to see how modular I could go. But I think I got a little carried away with making too many options, and didn't leave much time to make the plugin very user-friendly. I would have liked to be able to test the tool out with others more and get critique on what I named all parameters and such. I wrote tooltips for every parameter so you would understand what all of them meant. But sadly the runtime editor plugin I used didn't have support for that. If I were to continue working on this, I would have made tooltip support for the runtime editor. Made a "gym" where you can play around with a character controller and enemy's with your guns. And make support for changing gun model, adding shooting effects and sounds.This project really challenged my ability to think modularly when creating systems. As well as learning where to draw the line on how modular your system should be. If I were to remake it under the same amount of time, I would have scoped down on some of the gun options and focus more on user experience.But since this basically was the first time I used Unity I'm pleased with the result!


Noa Johansson