Defining a game system for firearms

12 posts

Flag Post

Before we start what will likely be a very long post, let me preface it with this disclaimer: I have never fired a gun in my life. The entirety of my meager knowledge about firearms comes from video games and from reading about guns on the internet. I am not an expert on ballistics by any stretch of the imagination, and I do not claim to be in any way, shape, or form.

Now that it’s out of the way, on to the problem. I have been considering the idea of creating a turn-based strategy game for some time, either as an RTS, or a pseudo real-time tactical combat a la Baldur’s Gate, or even truly turn based like the old X-Com series. I am not lacking for ideas about the settings or the features, but my lack of knowledge about how firearms work is hindering my ability to define a coherent game system. Namely, I would like to define a mathematical model that can take three physical objects (a weapon, a bullet and a shooter) and output quantities that are meaningful to a gamer, such as range, accuracy, or damage. Obviously, the influence of the third element (the shooter) on the results is the most subjective component, but even formally accounting for the first two will require some degree of abstraction, also known as ‘fudging’.

In so doing, I am looking for the expertise of people who know about firearms from a technical standpoint, and possibly have even tackled the problem themselves. I’ve looked up some information about single-shot, repeating and automatic weapons, the topics of recoil, and rifling. But I still have a lot of questions.

First off is the question of the various calibers of ammo. Obviously, the weight, shape, and amount of powder in a cartridge is going to have a lot of influence on how far and how straight a bullet goes. From what I’ve seen so far, quite a few firearms can be chambered in different calibers. But does that mean the same physical weapon can be altered to accept bullets of a different caliber than what was originally intended, and then how easy is it to change the caliber of a weapon, or is it that the manufacturer produces different series of the same weapon using different calibers?

Then I’m particularly interested in verifying something I read on a Russian (I think) website, about how the trajectory of a bullet becomes erratic when its velocity drops below that of sound, at which point it quickly tumbles off-course. It kind of makes sense to me, if only in the ‘last guy who talked is right’ fashion of the ignorant, and if it is true it makes modeling range much easier for me because now I have a fixed (for a given weapon and ammunition) distance at which something qualitative happens to the bullet. It may still be lethal beyond that point but if it can’t reliably hit a target that’s not much help. Anyone who can confirm/disprove the faster than sound argument gets my gratitude. Said gratitude will be undying if you also have equations.

Barrel length: How does the length of the barrel affect the bullet? I haven’t found much of the mechanics. Intuitively, I’m thinking a longer barrel would increase the time and distance during which expanding gases push on the bullet, making it faster. But then once the expansion reaches a certain point the gases should not expand as quickly anyway, so there has to be a point beyond which increasing the length of the barrel further no longer helps. On the other hand, the bullet is scraping against the barrel all the way, so that’s got to slow it down. But longer barrel means more rifling so it should also give it more angular momentum, making it go straighter. I can see how a longer barrel also makes the weapon easier to aim for the shooter, and could reduce recoil.

Recoil. Even for single-shot weapons, recoil is important, as it affects the trajectory of successive shots for automatic weapons, and the delay between aimed shots for single-shot weapons. But again there’s not a lot I could find in terms of numbers. Any help there would be appreciated as well.

I guess that’s enough for a first pass. Thanks for advance for any info you can pass along, links especially.

 
Flag Post

JxJohns said: A longer barrel also can increase the velocity of the bullet by giving the gun powder longer to detonate and the gasses it produces to expand further before the bullet leaves the barrel. This increased velocity “flattens” out the trajectory of the bullet, effectively making it more accurate.

Their is a limit however to the effect a long barrel has on velocity. Eventually, the gasses can expand only so much, and the bullet can only be propelled so fast. At that point, a longer barrel becomes counterproductive.

Modern firearms today use a combination of barrel length, twist rate of the rifling in the barrel, the mass of the bullet itself, as well as the speed in which the various powders burn to create the optimal bullet accuracy.
http://boards.straightdope.com/sdmb/showthread.php?t=179502

ThePhysiscist: The range equation, R=2v02sinθcosθ/g is not usually used to solve for the angles. However, given R and v0, you could solve for θ. A little manipulation leads to cos4θ-cos2θ+R2g2/(4v04)=0 which is a quadratic equation in cos2θ; there are therefore two solutions for cos2θ and two positive solutions for θ as you have correctly deduced. Note that if R2g2/v04>1 there are no real solutions.
In responce to:I am teaching a high school physics class and we are using the range equation for projectile motion. Why isn’t there two angles that would work each time for this equation? The author only has us solving for one angle but wouldn’t there always be two angles that would work for the same range?
http://askthephysicist.com/classical%20mechanics.html

Might not be exactly what you were looking for, but hope it helps!

 
Flag Post

Thanks for the link. The range equation is for the trajectory of an object launched in a bell curve in the absence of friction, so not really what I’m looking for, but the Physicist page kept me busy reading for a long time. :)

The straight dope was interesting as well, and raises a lot of questions about rifling, gas expansion, and the details of friction at supersonic speeds.

Edit: Update. This page is a treasure trove of information, containing in particular a very convincing graph and argument about why bullets decelerating to around 120% of the speed of sound get erratic trajectories.

At this point I’ve settled on the following as a first model for calculating range, damage and recoil:
m is the bullet mass.
c is bullet’s drag coefficient (which will need to be computed based on the shape and size of the bullet, joy!)
V0 is the muzzle velocity of the bullet.
Vs is the speed of sound, or 120% of it (edge of the transonic regime) or whatever else I decide to use as a cutoff speed ultimately.

So I get the range Xs = m * log(V0/Vs) / c
bullet speed as a function of distance: v(x) = V0 exp(-c * x / m)

I’m not sure whether I should use the bullets momentum p = m * v, or its kinetic energy E = 0.5 * m * v^2 as a basis for damage, but recoil is simply m * V0, the momentum of the gun as the bullet leaves the barrel.

I’m still investigating the influence of the rifling on the trajectory, apparently it has to do with the angular momentum of the bullet keeping its point forward, much like the angular momentum of a bike’s wheels keeps the bike from falling over. But I need to put this effect into numbers if I am to account for it.

Edit to the edit (next time I’m double posting): Oh, and I’m aware that the range formula breaks down for subsonic bullets, which at least some calibers of handguns may very well be. I’ll figure something out then, even though with speed decaying exponentially with distance it may not even be necessary to include range for subsonic weapons.

 
Flag Post

Not sure if this helps, but muzzle brakes are designed to reduce recoil.

 
Flag Post

I’d use KE for damage over momentum.

same Momentum:
0.01kg bullet @ 1,000m/s
1000kg car @ 0.01m/s
which one will cause more damage?

 
Flag Post

@feartehstickman: If I’m getting this right, it would depend what you qualify as “more damage” The smaller bullet would clear right through and probably make the, bleed, while the large one would smack them hard(at extremely close range as gravity would act on the larger mass alot faster than the smaller one) and send them smashing into objects behind them.
If we are talking about a best case scenario then the big one, as the person is standing in front of huge spikes and the gun is directly against them. However the smaller one would be alot more useful, as the range would be very large and so you could easily get a few shots at them.

In the eventuality that you count the “best” weapon as the one who would win in a one on one fight between the two, I would bet money on the smaller weapon, if the arena is not specially made for the larger one to be useful

And so in short, a higher chance of making large damage with the small weapon.

 
Flag Post

Actually Fearteh makes a very good point, and close inspection of the numbers only reinforces it: 10g is the average weight of a .357 caliber bullet, which has a muzzle velocity of around 500m/s, tops. On the other hand, 1000kg is a small weight for a car. A typical sedan is much closer to 2000kg. So the comparison would be:
.357 bullet at point blank range vs. Honda Accord backing into you at 1in/s. You can even attach a spear to the back of the Accord so you’re getting prodded with the same surface area in both cases. I’ll still take the car any day.

But that’s a false comparison. What if we’re using kinetic energy instead? That .357 bullet has 2500 J of kinetic energy, which is the same kinetic energy as a 2.5 ton car hitting you at… 1m/s, ~2 mph. Once again, I would still take the car any day.

The difference here is mostly in the duration of the impact. In a collision, how much force one experiences depends on how long the collision lasts. The formula is p = F t, where p is the change in momentum, t is the duration of the collision and F the force experienced over the duration of the collision. Additionally, I’m not looking at simulating car impacts and bullet impacts with the same model, but to develop a credible system to compute the damage done by a 9mm pistol and an AK47 firing 7.62 rounds. Considering I can use the impact velocity to determine the collision time (up to a multiplicative constant parameter) I think I’ll use that.

But thank you for the stimulating discussion, it helped me see the problem in a new light.

Edit: Also, it seems that bullet fragmentation after the impact, as well as yawing and cavitation inside the body are what determines damage in the biological sense. So force calculations are only the tip of the iceberg, and I’m probably going to have to do some serious abstracting when it comes to actual body damage.

 
Flag Post

True the car in a perfect scenario, but keeping in mind that one walks faster than 2mph, simply walking away from the person could stop all effect whatsoever, which is the main reason as to which the huge bullet/car is a bad idea, a bullet can not be dodged by simply that.
Just figured I’d mention, that from a practical standpoint a car at 2mph is useless, or very close to with restraints on the victim to stop them from dodging.

But on a slightly more concentrated response to your original inquiry: I doubt many games actually calculate the fragmentation or cavitation of bullets, nor the trajectory, or the veinces that were touched and such details, which I would not doubt would take quite the bit of processing power once you ave a few enemies on the screen at once shooting many bullets at each other. Would it not be simpler to set a base damage for each gun, or bullet type, with a possibility to have differing damages caused by the piece of the body that was say, say a headshot or some other part?

 
Flag Post

Actually Jerimo, the reason I want to compute damage rather than assign it is twofold.

First, it allows me to take the stats of an actual firearm, such as barrel length, weight, and caliber, as well as the actual stats of the cartridges (total weight, bullet weight, bullet shape and diameter, etc…) and generate all the game info I need. If I wish to extend the player’s options by offering an extra gun in an updated version, the only thing I have to worry about is filling out the physical info and the game will know what to do.

The second reason is customization. What if the player likes a particular rifle but would really like it if it had better range? If they can tinker with barrel length, ammo caliber, rifling, and other parameters they can get their ideal rifle custom-made… for a price. My job would then be to display clearly and accurately the performance of the custom-made gun so they get an idea of what they’re doing without having to learn the Physics behind it. If they understand the compromises they are making in customizing their toy then my job is done, even if they have no clue why each factor influences the result the way it does.

 
Flag Post

Then I shall guess that you will calculate most of it before the actual “battles”?

Glad to see someone whom thinks of the “tinkerer” players, that is something that is quite rare, at least on a very precise scale these days!

 
Flag Post

Not sure how well the analagy went. Anyway, imagine you’re standing still and those items are moving towards you at a constant velocity. You cannot dodge.

The transfer of momentum (I think) is just what knocks you back. They should both knock you back the same amount (if you don’t fall over). (In an ideal world, where the bullet applies force to your whole body, and your body brings both objects to a rest).

As for Kinetic energy, that would result in heat and the transfer of kinetic energy to your body (adding to the knock back of the momentum maybe?). What actually damages you, I don’t know…

 
Flag Post
Originally posted by jerimo:

Then I shall guess that you will calculate most of it before the actual “battles”?

Glad to see someone whom thinks of the “tinkerer” players, that is something that is quite rare, at least on a very precise scale these days!

I would calculate everything on-the-fly,* but would provide a global number to the player so they have an idea of how well or poorly the gun/ammo combination behaves. If you look at ammo in the real world, the manufacturers label them with a number called the ‘ballistic coefficient’, or BC, which is an amalgam of several quantities (bullet size, bullet shape, drag…) It helps people identify ammunition that they except to be aerodynamic (BC >= 1) and helps them evaluate different types of ammo of a linear scale. In practice, BC varies based on the speed of the projectile and the conditions and it’s all really much more complicated than that, but the system serves its purpose of informing the user, while remaining simple and preserving a broadly reliable connection to reality. That’s the kind of perspective I’m thriving for. Easily digested info on display, complex physics under the hood.

As for caring for “tinkerer” players, I offer no deadline as to when this system will be operational!

*: If damage depends on the momentum of the bullet and its speed then it is related to the distance to the target, and has to be calculated on the fly. I could provide a damage value corresponding to the damage at point blank range to the player in the gun selection screen, though.