Is your feature request related to a problem? Please describe.
Recoil values for ammunition are currently arbitrary numbers set against the numbers other ammo uses.
Describe the solution you'd like
Set recoil values equal to the round's muzzle energy. Looking at the current numbers for most ammo items, this won't even need any changes to how we interpret recoil stats.
Additional context
There may be circumstances worth modeling where we should account for other factors like propellant gas energy.
Is it not a mix of muzzle energy and the weight of the weapon? I have no expertise in the area. Just know of the newtonian mechanics, and gun sizes [weight] in game vary.
Weapon weight is factored into the final value of perceived recoil in the firing code. Recoil values specified for ammo are base values before things like that are accounted for.
My bad. Did not realise it was for the ammo specifically. :)
Bows, crossbows and pneumatic rifles should get recoil too. Its not like theyre magic or so special that you dont feel anything when pulling the trigger. The only guns that dont have recoil are, well, Recoilless rifles and launchers, but they work differently.
I am afraid that it might be harder to set recoil for Xbow and such because it shouldnt be attached to ammunition only, but also to weapon.
Let's do some physics. M - weapon mass, V - estimated recoil velocity, m - bullet mass, v - bullet velocity, J - gunpowder energy.
Impulse conservation: m*v + M*V = 0
Energy conservation: 0.5*m*v^2 + 0.5*M*V^2 = J
Consider recoil as adsorbed kinetic energy of a weapon: RecoilE = 0.5*M*V^2
After some handwavy mathematical machinations we get RecoilE = J / (M/m + 1) = J*m/(M+m)
As another conclusion: if you weld an anvil to barett riffle ... there will be no recoil whatsoever.
Recoil problem has more dimensions. Some weapon give all its recoil straight into the shoulder. It has less impact on accuracy, but more impact to your shoulder. Some designs convert part of recoil impulse to vertical rotation.
IIRC recoilless rifles do have recoil, but it is minimal in comparison to what would be expected from the mass of the projectile, due to the venting of exhaust gasses.
Let's do some physics. M - weapon mass, V - estimated recoil velocity, m - bullet mass, v - bullet velocity, J - gunpowder energy.
Impulse conservation:
m*v + M*V = 0
Energy conservation:0.5*m*v^2 + 0.5*M*V^2 = J
Consider recoil as adsorbed kinetic energy of a weapon:RecoilE = 0.5*M*V^2
After some handwavy mathematical machinations we getRecoilE = J / (M/m + 1) = J*m/(M+m)
As another conclusion: if you weld an anvil to barett riffle ... there will be no recoil whatsoever.
Recoil problem has more dimensions. Some weapon give all its recoil straight into the shoulder. It has less impact on accuracy, but more impact to your shoulder. Some designs convert part of recoil impulse to vertical rotation.
Many automatic and semi-automatic guns also use part of the recoil energy to reload itself: extract used-up casing, put next round from the magazine into a chamber, and set action spring on again.
Other automatic and semi-automatic guns use part or the gas energy to self-reload (they have a special pipe welded into the barrel to redirect pressure to a loading mechanism)
And. finally, some guns can have integrated shock absorbing mechanism that can redirect or dissipate recoil during longer time to reduce Its influence to the shooting accuracy. (Yep, recoil stock do that.)
Let's do some physics. M - weapon mass, V - estimated recoil velocity, m - bullet mass, v - bullet velocity, J - gunpowder energy.
Impulse conservation:
m*v + M*V = 0
Energy conservation:0.5*m*v^2 + 0.5*M*V^2 = J
Consider recoil as adsorbed kinetic energy of a weapon:RecoilE = 0.5*M*V^2
After some handwavy mathematical machinations we getRecoilE = J / (M/m + 1) = J*m/(M+m)
As another conclusion: if you weld an anvil to barett riffle ... there will be no recoil whatsoever.
Recoil problem has more dimensions. Some weapon give all its recoil straight into the shoulder. It has less impact on accuracy, but more impact to your shoulder. Some designs convert part of recoil impulse to vertical rotation.
Oh, and I think I need to point that actually projectile are NOT the only source of recoil energy. In firearms recoil also comes from propellant gas release (yep. rocket science!), and mechanical weapons (like crossbows, harpoon guns, spring-piston pneumatic rifles, e.t.c.) can have HUGE recoil coming from moving parts of the weapon during the shot. Actually bullet usually produce LESS recoil that two sources I mentioned above.
So the only weapons that have recoil just from the projectile itself are gaussgun-class and railgun-class weapons, because they both have no propellant gas and no moving parts.
Right now I'm just looking at making recoil numbers consistent. Setting it equal to projectile energy isn't an accurate model but it works with the current interpretation of the values and given that recoil values are only used to modify a percent chance to hit I don't think we'd gain anything by implementing an accurate recoil model. It's probably worth revisiting when we have sum of vectors dispersion.
I took that model to remind that attaching gunmods (increasing weapon mass) should reduce recoil. If you double weapon mass, you practically make recoil half. And this model is quite solid even for a weaponry from real world. For example, a stabilizer for compound bow in real life is just a hunk of metal (with adjustable length) which increases bow mass/momentum. So heavier bow is less influenced by micro tremors from muscles or complex arrow vibrations when you release it.
Game wise this model is absolutely simple to compute. You compute that RecoilE
(for given mass for weapon and bullet and a projectile energy) and multiply it by some recoil_mod
value bound to the weapon itself. This value measures effectiveness of recoil dissipation and impact comfort. It provides a framework to balace/adjust only recoil_mod
value, since RecoilE
can be derived directly from real world data, either direct Joules value from ammunition specs, or from estimation of muzzle velocicy and bullet weight for fictional ammo.
Most helpful comment
Let's do some physics. M - weapon mass, V - estimated recoil velocity, m - bullet mass, v - bullet velocity, J - gunpowder energy.
Impulse conservation:
m*v + M*V = 0
Energy conservation:
0.5*m*v^2 + 0.5*M*V^2 = J
Consider recoil as adsorbed kinetic energy of a weapon:
RecoilE = 0.5*M*V^2
After some handwavy mathematical machinations we get
RecoilE = J / (M/m + 1) = J*m/(M+m)
As another conclusion: if you weld an anvil to barett riffle ... there will be no recoil whatsoever.
Recoil problem has more dimensions. Some weapon give all its recoil straight into the shoulder. It has less impact on accuracy, but more impact to your shoulder. Some designs convert part of recoil impulse to vertical rotation.