Unity Ballistics System

https://github.com/KatieGames/BallisticsCalculator

One of the modules in my second year of university at the University Of Portsmouth is called maths for games. It focuses on implementing a variety of mathematical constructs in game engines such as vectors and quaternions. At the end of the year there was a final assignment for this module to make a project using maths, naturally I decided to go a bit further than I probably shouldve and made a ballistic system for the Unity Engine which I think may be the first of its kind to be used in video games.

Im sorry in advance for how many words there are going to be in this post. Its a really complicated concept and requires a lot of background information and context so im afraid you may want to sit down and take a minute if you plan to read it all.

I am going to not fully explain how all of this system works in this post, however if anyone would want to work with me on implementing it somwhere please reach out to me!

One of the things which has always frustrated me with shooter games is the lack of realism in their firearms. I have had a mild obsession with firearms technology for much of my life and when combined with thousands of hours in FPS games it has resulted in somewhat of a pet peeve for bad penetration models. To me there is nothing more frustrating than when an enemy is behind a 1mm sheet of corrugated steel and your gun wont go through it, but, when you are behind 2 foot thick oak tree, they are able to shoot through it with handgun cartridges.

So I decided to fix this by using real world physics and ballistic modelling, in a way which is fast and efficient enough to actually be practical in a multiplayer game.

Before I explain this project any further I would like to give a special thanks to Charles Schwartz for his help on this project and I would like to reccomend his book Quantitative Ammunition Selection. (This is not an affiliate link its just a good book).

First I think its important to look at how the majority of games currently do ballistics. Games traditionally either do raycast or physically based projectiles. Theyre are pros and cons to both of these (personally I think the best solution is to actually combine both but thats for a future project, my final dissertation perhaps?). For this project I will be using just physically based projectiles with my own system for moving them. The other major thing is how games do ballistic penetration. Some games simply do no penetration, all surfaces are solid (Rust for example). Other games use a system of hard and soft materials where some are entirely bullet proof and others are only shootable through with rifles (Pavlov VR). Finally some games have more realistic ballistic systems like Rainbow Six Siege however even these just use predetermined damage reductions depending on materials.

So what is the benefit of my solution over these examples? With my system bullets actually have energy which is effected dynamically by the materials they are hitting. These energy effects are not just subtracting a fixed number and are actually calculated as the bullet impacts the material to create much more accurate results verifiable by FEA Suites (Ansys Autodyn). This means material thickness, age, and mechanical properties are all taken into consideration. Not just is the material hard or soft.

It is also able to take into account the properties of the bullet. This includes is velocity, nose shape, expansion on impact, drag coefficient, mass. And it even can consider environmental factors such as gravity, wind, air density, and more!

So thats a lot of words but honestly I think the system speaks for itself in a lot of ways, and I dont want to give away all of my secrets. Heres a video demonstrating the system in a Unity scene where you can fire a variety of projectiles at a variety of targets. All of this is done in real time ingame.

In the video you can see me testing a variety of projectiles against a variety of different materials. This system is nice as it really effectively shows the benefits of some cartridges over others. For example 7.62 and .308 being better armour penetrators than 5.56 or 2.23. All projectiles in the video are full metal jacket round nose (fmjrn) to make comparison simpler. The system does support other nose types such as hollow point or wadcutter projectiles.

It also demonstrates how handgun cartridges differ with the 5.7 being better able to penetrate armour as a result of its high speed and low drag, with .45acp struggling due to its large size and lower speed. I also generate wound cavity data and energy delivery information into materials when the bullet hits them however I havent gotten round to visualising it yet. This data would show the 45 acps larger permenant wound cavity and energy delivery compared to the 5.7. Hence why the 45 acp is heralded as having excellent "stopping power".

In the future I will be combining this system with an equally detailed health system to make what might be the most realistic ballistic system ever put into a video game. But you'll have to wait a year for my dissertation to see that.