1.2.2 Bullet Configuration - BrettRyland/BDArmory GitHub Wiki

Bullet Configuration

  • Currently defined in BD_Bullets.cfg
  • Modders can maintain their own configurations as long as names do not collide there should be no issue. Also remember to define a resource for your custom ammunition
Bullet Config
caliber caliber of projectile in mm
bulletVelocity Muzzle velocity in m/s
bulletMass mass in KG
incendiary True/False Incendiary bullets have a very high chance of starting fires on parts they hit
explosive Standard/Shaped/None Explosive warhead type, can choose from standard HE, shaped charge or none.
tntMass Mass of TNT in KG explosive property
apBulletMod Armor penetration depth modifier
bulletDragTypeName Drag Type None, AnalyticEstimate, NumericalIntegration Has No Effect on Trajectory, only Impact Velocity
subProjectileCount number of submunitions, for shotgun type weapons
fuzeType None, Timed, Proximity, Flak, Impact, Delay, Penetrating Determines behavior of explosive rounds. 'None' defaults to Impact. 'Timed' explodes when the round has traveled a preset distance, either distance to target, or the weapon's maxDetonationRange, or if it hits something. 'Proximity' explodes when target enters round's proximity radius; will explode it it hits something. 'Flak' is a combination Timed and Proximity fuze. 'Impact' will explode the instant it hits anything. 'Delay' will explode 0.02 sec after it hits anything. 'Penetrating' will explode when the round penetrates armor of at minimum 2/3rds the thickness of the round's penetration depth
projectileColor color of the projectile/tracer This is the final color of the projectile of fadeColor is true
fadeColor True/False Fades color startColor to projectileColor
startColor color of projectile/tracer Initial color of projectile if fadeColor is true

Ballistic Damage Formulas

We are scaling the output for the kinetic calculation being Joules, thus the 1e-4 multiplier at the end Note that bulletDmgMult is a per part option in ModuleWeapon for per weapon balancing as an option

        double damage = ((0.5f * (mass * Math.Pow(impactVelocity, 2)))
                        * (DMG_MULTIPLIER / 100) * bulletDmgMult
                        * 1e-4f);

Armor Penetration Formulas

Armor penetration is based on the 1987 paper "Energy-efficient penetration and perforation of targets in the hypervelocity regime" by Frank and Zook, specifically the S2 model. While this equation is not a perfect model and it will over/under predict, the model it is based on, the Tate-Alekseevskii model for the penetration of long rods into semi-infinite targets is well regarded. For the purposes of this mod, the level of accuracy offered by this model is sufficient. The equation used is:

        float penetration = ((length - caliber) * (1.0f - Exp((-vFactor *
                bulletVelocity * bulletVelocity) * muParam1)) * muParam2 + caliber *
                muParam3 * Log(1.0f + vFactor * bulletVelocity *
                bulletVelocity)) * apBulletMod;

Where vFactor, muParam1, muParam2 and muParam3 are values dependent on the armor material. These can be calculated as follows:

        float vFactor = Density / (2.0f * (yield * (2.0f / 3.0f + Log((2.0f *
            youngModulus * 1000f) / (3.0f * yield))) * 1000000.0f));

        float mu = Sqrt(Density / (Projectile Density));

        float muParam1 = (1.0f / mu) / (1.0f + mu);

        float muParam2 = (1.0f / mu);

        float muParam3 = (Pow(1.0f / mu, 2) + 1.0f / 3.0f);

Projectile Density is 11340 for non long-rod projectiles, where L/D (length / caliber) < 4 and 19000 for long-rod proctiles. For projectiles of L/D < 4 , the formula used begins to fail which worsens at L/D < 1. While not based on concrete science, in order to ensure that the resultant calculated penetrations make sense in the context of gameplay, for all projectiles with L/D < 1, the penetration is multiplied by L/D. Projectiles at above 1200 m/s will erode away until they have a L/D ratio of 1.2 proportional to (1-Sqrt(armorThickness/penetration), after which they, as well as projectiles below 1200 m/s will lose speed proportional to (1-Sqrt(armorThickness/penetration) as well. While this isn't strictly based on accurate equations, this approximates realistic behavior of projectiles penetrating armor. Hypervelocity projectiles will also lose mass as they travel after they hit something, with this mass loss based on a modified rule of thumb used for shaped charge loss of penetration with standoff:

        float kDist = 1f / (1f + Pow(Distance / (14f**10f*caliber), 2));

This isn't based on any kind of realistic equation or proper reasoning other than gameplay. If you have knowledge about modelling the post-penetration behavior of hypervelocity projectiles the dev team would appreciate your help with improving this behavior. This however does make it so Whipple shields are viable from a gameplay perspective.

Shaped charge warhead penetration is also calculated using the Frank and Zook model, using a velocity of 5000 m/s and a liner of density 11340 kg/m^3. The rule of thumb for the caliber of the shaped charge hypervelocity jet based on the caliber of the charge in "The Hollow Charge Effect" in the Bulletin of the Institution of Mining and Metallurgy. No. 520, March 1950 by W. M. Evans. is used, setting the caliber of the jet to be 20% that of the charge's. From there a proportional relationship between shaped charge explosive mass and jet mass was found for modern shaped charges, giving:

        shapedChargeMass = 0.0555*tntMass

Note that this is a purely empirical relationship developed based on a few modern shaped charge warheads, this means that while modern warheads will more or less have accurate armor penetration values, with typical apBulletMod of around 0.90 - 1.0, older and especially larger warheads will over-perform, requiring apBulletMod values of around 0.20-0.25, and in some cases as low as 0.125-0.15. Penetration falloff with distance is modelled using the rule of thumb mentioned above, based on the paper "A new mathematical model for the relation between stand-off and penetration of shaped charge jets" of the Swedish Defence Research Agency by Wijk:

        float kDist = 1f / (1f + Pow(Distance / (14f*caliber), 2));

The jet formation distance is omitted from the equation for gameplay reasons.

The above equations are subject to change during development and certain aspects of the code have been omitted for brevity. For the exact implementation, please check PooledBullet.cs, ProjectileUtils.cs, ExplosionFX.cs and other such relevant files. Toggling on Weapons or Armor Debug will provide outputs in the debug log detailing these mechanics.

Example Bullet Config

	BULLET
	{
		name = 30x173HEBullet //GAU HE
                caliber = 30
                bulletVelocity = 1109
                bulletMass = 0.3880
                //HE Bullet Values
                explosive = True
                incendiary = False
                tntMass = 0.077 // originally 0.254
                fuzeType = Impact 
                projectileColor = 255, 20, 0, 128
                fadeColor = True
                startColor = 255, 30, 0, 32
                subProjectileCount = 1
                apBulletMod = 0.8
                bulletDragTypeName = AnalyticEstimate				
	}

Ballistic Coefficient

BC is now calculated in code based on mass / caliber of bullet using the following

//A = π x (Ø / 2)^2
bulletDragArea = Mathf.PI * Mathf.Pow(caliber / 2f, 2f);

//Bc = m/Cd * A
bulletBallisticCoefficient = bulletMass / ((bulletDragArea / 1000000f) * 0.295f); // mm^2 to m^2