Cataclysm-dda: Overhaul civilian ammunition appearance rates.

Created on 31 Jan 2020  Â·  11Comments  Â·  Source: CleverRaven/Cataclysm-DDA

Is your feature request related to a problem? Please describe.

Ammunition appears in game in essentially arbitrary ratios, leading to an exaggerated difficulty when finding matching guns and ammunition.
In the opposite direction, particularly rare ammunition is not remotely as rare as it should be.

Describe the solution you'd like

Spawn guns and ammo (but focusing on ammo here) in representative ratios.
Specifically I've done some figuring with some hopefully representative data points and come up with some distributions for the most common ammunition types, and item lists referencing ammunition drops can spawn ammo in those ratios.

EDIT: This is a summary, the full table is below, but it's too unwieldy so I'm putting this summary here.

Calibre | Percent Revenue | Price/rd | Proportion of Rounds Sold
-- | -- | -- | --
.22LR | 0.0512 | 0.038 | 0.20416406493382
9mm | 0.1776 | 0.13 | 0.209353199429958
.223 | 0.12 | 0.2 | 0.094910636269089
.45 | 0.0858 | 0.27 | 0.049387315857842
.40 | 0.0602 | 0.23 | 0.040081682049504
12ga | 0.0434 | 0.25 | 0.026452313112003
7.62 | 0.0417 | 0.19 | 0.034383554038087
.38 | 0.0244 | 0.19 | 0.019415881708033
.308 | 0.05285 | 0.33 | 0.02511926393844
5.56 | 0.0756 | 0.41 | 0.029482088663224
  |   | Remainder → | 0.26725

Another even more simplified tabulation:

Round type | Proportion
-- | --
Tiny | 20%
Pistol | 32%
Intermediate | 16%
Shot | 2.6%
Rifle | 2.5%
Other | 27%

Points of interest

9mm and .22 make up 40% of all civilian ammunition.
.223 is a distant but significant third at 9.5%.
.45 and .40 are an even more distant 4th and 5th, but (along with the rarer .38) bring "medium pistol rounds" up to 30% of civilian ammunition.
12ga is sitting at a rare but not incredibly rare 2.6%
Intermediate rounds (.223, 7.62 and 5.56) sum to a respectable 16%.
Traditional rifle rounds are quite low at just over 2.5%
"and the rest" is 27%, which spread evenly across the 33 remaining ammo types is going to make them incredibly rare ( 0.8% ).

Side note, this is civilian ammunition, not police or armed forces, which will follow a totally different distribution and need their own sources.

Data

Retrieved a (hopefully representative) snapshot of sales stats from https://www.luckygunner.com/labs/2013-ammo-stats/
Retrieved prices per round from the same site.

2012 data

Calibre | Percent Revenue 2012 | Price/rd | Rounds per Dollar Revenue 2012 | Proportion of Rounds Sold 2012 
-- | -- | -- | -- | --
.22LR | 0.0344 | 0.038 | 0.905263157894737 | 0.153910988675132
9mm | 0.1412 | 0.13 | 1.08615384615385 | 0.184665653138481
0.223 | 0.138 | 0.2 | 0.69 | 0.117312387298312
0.45 | 0.0816 | 0.27 | 0.302222222222222 | 0.051383203454333
0.4 | 0.0474 | 0.23 | 0.206086956521739 | 0.035038482406679
12ga | 0.0318 | 0.25 | 0.1272 | 0.021626283571515
7.62 | 0.0434 | 0.19 | 0.228421052631579 | 0.038835679700586
0.38 | 0.0158 | 0.19 | 0.083157894736842 | 0.014138335006204
0.308 | 0.0557 | 0.33 | 0.168787878787879 | 0.028696969576267
5.56 | 0.0962 | 0.41 | 0.234634146341463 | 0.039892017172491
SUM → | 0.6855 | SUM → | 4.03192715529031 | 0.3145
  |   | SCALED → | 5.88173180932211 |  ^ Remainder

2013 data

Calibre | Percent Revenue 2013 | Price/rd | Rounds per Dollar Revenue 2013 | Proportion of Rounds Sold 2013
-- | -- | -- | -- | --
.22LR | 0.068 | 0.038 | 1.78947368421053 | 0.254417141192509
9mm | 0.214 | 0.13 | 1.64615384615385 | 0.234040745721435
0.223 | 0.102 | 0.2 | 0.51 | 0.072508885239865
0.45 | 0.09 | 0.27 | 0.333333333333333 | 0.04739142826135
0.4 | 0.073 | 0.23 | 0.317391304347826 | 0.045124881692329
12ga | 0.055 | 0.25 | 0.22 | 0.031278342652491
7.62 | 0.04 | 0.19 | 0.210526315789474 | 0.029931428375589
0.38 | 0.033 | 0.19 | 0.173684210526316 | 0.024693428409861
0.308 | 0.05 | 0.33 | 0.151515151515152 | 0.021541558300614
5.56 | 0.055 | 0.41 | 0.134146341463415 | 0.019072160153958
SUM → | 0.78 | SUM → | 5.48622418733989 | 0.22
  |   | SCALED → | 7.03362075299986 |  ^ Remainder

Process

All steps repeated for 2012 and 2013 data.
Multiplied proportion of revenue by price per round to get "Rounds per dollar of revenue".
Summed "Rounds per dollar of revenue" figures to get "aggregate rounds per dollar of revenue".
Scaled Aggregate rounds per dollar of revenue by 78% to get "Adjusted rounds per dollar of revenue".
Divided each "Rounds per dollar of revenue" by "adjusted rounds per dollar of revenue" to get "proportion of rounds sold".
Averaged together "proportion of rounds sold" from 2012 and 2013 for each calibre.
Additionally, summed "Proportion of rounds sold" to determine how much of the market is covered, which yields the 31%/22%/26% remainder for "proportion rounds not in the top 10".

Describe alternatives you've considered

All the other options are totally subjective, and I'm not a fan. If anyone finds other qualitative sources for this I'd love to try and incorporate them.
Possibly we can bucket the remaining ammo types into low and high or low/med/high to put a little extra scaling on them instead of just having them evenly represented.

Balance Ammo

Most helpful comment

Current assumption is "post-cataclysm" looting by survivors will be eventually implemented. So things get looted as the game progresses. The amount of guns/ammo missing in the spawngroups would be based on estimates of how much is used up/taken on average by the people directly experiencing the cataclysm.

All 11 comments

This sounds like a good way to approach it, although we should also take care to make ammo spawn in portions that make sense. You wouldn't likely find 3 12 gauge shotgun shells in someones house, you would either find 0 or find his spare box of ammo.

Implementation wise, how would we spawn the ammo types in the mentioned proportions while also making loot feel right? I'm thinking perhaps make sus itemgroups for the common calibers, which have a chance to include a gun and some suitable magazines.

Then one would have all of the groups set to spawn, and set their spawnchance using the data from this post.

What would the assumed "used" or "decay" be? Time has passed, and lots of things would be used up in the time before the survivor gets there.. So this does allow for some balance outside of "loot" (untouched) locations, right?

Current assumption is "post-cataclysm" looting by survivors will be eventually implemented. So things get looted as the game progresses. The amount of guns/ammo missing in the spawngroups would be based on estimates of how much is used up/taken on average by the people directly experiencing the cataclysm.

Civilian ammo is typically packaged in cardboard packs and boxes; or in plastic tray-cases. Could separate between loose round spawns and packaged spawns and guarantee that unlooted commerical packages would be full (no one who looted a place would just take a couple rounds out) while looted packages in homes and other places will have random amounts similar to household chemical spawns.

Yes the number of rounds would be divided by the appearance rate, so in a gun store the boxes wouldn't spawn in these ratios, the rounds would.

My plan for achieving this distribution is to run a test that runs over an overmap or so worth of mapgen and tallies up the number of rounds spawned. Probably the first cut would be to determine a set of ratios for all the rounds based on the above data, then see where that gets us because the chaotic interaction of item groups and mapgen is going to make the final outcome unpredictable. From there it's just a matter of tweaking those numbers until the final spawn rates come out right.

We might also want to think about doing some kind of estimate of how much and what ammo is used during the cataclysm itself. I might imagine not a lot of the .22 ended up being used when shit hit the fan, and the rare collector guns also not seeing much use, but the 9mm and .223 might have seen a lot of use before the end really hit.

After polishing up that top 10 list and looking at some in-game numbers, I REALLY need to have some additional adjustment for the remaining 30-odd calibres of civilian ammunition, because the kind of naive thing to do is to evenly divide the remaining "unreported" proportion of calibres among them, but that's definitely wrong as some of them are probably barely off the bottom of the top 10 list and others are almost unheard of.

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions. Please do not 'bump' or comment on this issue unless you are actively working on it. Stale issues, and stale issues that are closed are still considered.

See http://knowledgeglue.com/what-are-the-most-popular-calibers-in-the-us/ for additional potentially useful data, though it will need to be massaged a bit since it is by units sold, so we need to make assumptions about how many rounds are typical.

Here's the data from knowledgeglue tablulated

Calibre | Units Sold | Round class | Est. Unit size | Estimate number of rounds | Note | Percentage
-- | -- | -- | -- | -- | -- | --
9mm Luger | 5986 | Pistol | 50 | 299300 |   | 0.184713749232417
.223 Civ | 3390 | Rifle | 20 | 67800 |  Split back out | 0.041842940855188
5.56 NATO | 1695 | Rifle | 20 | 33900 |  Split back out | 0.020921470427594
45 ACP | 4212 | Pistol | 50 | 210600 |   | 0.129972320709479
12 Gauge (birdshot) | 3540 | Shotgun | 25 | 88500 | Assuming these are birdshot | 0.05461799801894
22 Long Rifle | 3402 | 0.22LR | 100 | 340200 |   | 0.209955287299927
40 S&W | 2126 | Pistol | 50 | 106300 |   | 0.065603312874727
380 ACP | 1550 | Pistol | 50 | 77500 |   | 0.047829320299072
308/7.62 NATO | 1546 | Rifle | 20 | 30920 |   | 0.01908235591803
7.62x39 | 1340 | Rifle | 20 | 26800 |   | 0.016539687535679
357 Magnum | 1114 | Pistol | 50 | 55700 |   | 0.034375395363333
38 S&W Special | 851 | Pistol | 50 | 42550 |   | 0.026259839725491
40 cal | 718 | Rifle | 20 | 14360 | Black Powder?  | 0.008862310187028
30-06 | 691 | Rifle | 20 | 13820 |   | 0.008529047826235
20 Gauge | 517 | Shotgun | 25 | 12925 | Assuming Birdshot | 0.007976696320845
44 Magnum | 490 | Pistol | 50 | 24500 |   | 0.015120236739707
30-30 | 334 | Rifle | 20 | 6680 |   | 0.00412257883352
7.62x54R | 332 | Rifle | 20 | 6640 |   | 0.004097892732721
50 Black Powder | 299 | Rifle | 20 | 5980 |   | 0.003690572069528
270 Winchester | 265 | Rifle | 20 | 5300 |   | 0.003270908355937
45 Long Colt | 253 | Pistol | 50 | 12650 |   | 0.007806979377849
243 Winchester | 214 | Rifle | 20 | 4280 |   | 0.002641412785549
7mm Remington Magnum | 214 | Rifle | 20 | 4280 |   | 0.002641412785549
12 Gauge (buckshot and slugs) | 205 | Shotgun | 5 | 1025 | Assuming these are buck/slugs | 0.000632581332988
300 Blackout | 197 | Rifle | 20 | 3940 |   | 0.002431580928753
17 HMR | 183 | Rifle | 100 | 18300 |   | 0.011293891115781
22 WMR | 181 | Rifle | 20 | 3620 |   | 0.002234092122357
410 | 169 | Shotgun | 25 | 4225 | Assuming Birdshot | 0.002607469396949
22 Magnum | 158 | Pistol | 100 | 15800 |   | 0.009751009815811
8mm Mauser | 152 | Rifle | 20 | 3040 |   | 0.001876143660764
300 Winchester Magnum | 149 | Rifle | 20 | 2980 |   | 0.001839114509564
16 Gauge | 136 | Shotgun | 25 | 3400 | Assuming Birdshot | 0.002098318567959
5.45x39mm | 122 | Rifle | 20 | 2440 |   | 0.001505852148771
32 ACP | 113 | Pistol | 50 | 5650 |   | 0.003486911737932
25 ACP | 107 | Pistol | 50 | 5350 |   | 0.003301765981936
357 SIG | 105 | Pistol | 50 | 5250 |   | 0.003240050729937
38 S&W | 90 | Pistol | 50 | 4500 |   | 0.002777186339946
4570 Government | 84 | Rifle | 20 | 1680 |   | 0.00103681623358
50 BMG | 78 | Rifle | 10 | 780 | Assuming Civilian boxes | 0.000481378965591
30 Carbine | 77 | Rifle | 20 | 1540 |   | 0.000950414880782
9mm Makarov | 77 | Pistol | 50 | 3850 |   | 0.002376037201954
303 British | 72 | Rifle | 20 | 1440 |   | 0.000888699628783
7.62x51mm NATO | 68 | Rifle | 20 | 1360 |   | 0.000839327427184
338 Lapua | 64 | Rifle | 20 | 1280 |   | 0.000789955225585
300 Winchester Short Magnum | 59 | Rifle | 20 | 1180 |   | 0.000728239973586
500 S&W | 55 | Pistol | 50 | 2750 |   | 0.001697169429967
5.7x28mm | 54 | PDW | 20 | 1080 |   | 0.000666524721587
6.8mm SPCII | 54 | Rifle | 20 | 1080 |   | 0.000666524721587
454 Casull | 50 | Pistol | 50 | 2500 |   | 0.00154288129997
28 Gauge | 46 | Shotgun | 25 | 1150 | Assuming Birdshot | 0.000709725397986
10 Gauge | 40 | Shotgun | 5 | 200 |   | 0.000123430503998
204 Ruger | 39 | Rifle | 100 | 3900 |   | 0.002406894827953
270 WSM | 39 | Rifle | 20 | 780 |   | 0.000481378965591
25-06 Remington | 38 | Rifle | 20 | 760 |   | 0.000469035915191
35 Remington | 36 | Rifle | 20 | 720 |   | 0.000444349814391
338 Winchester Magnum | 35 | Rifle | 20 | 700 |   | 0.000432006763992
38 Super | 35 | Pistol | 50 | 1750 |   | 0.001080016909979
44 Special | 32 | Pistol | 50 | 1600 |   | 0.000987444031981
6.5x55 Swedish | 31 | Rifle | 20 | 620 |   | 0.000382634562393
22 Short | 31 | 0.22 | 100 | 3100 |   | 0.001913172811963
7mm-08 | 31 | Rifle | 20 | 620 |   | 0.000382634562393
10mm | 30 | Pistol | 50 | 1500 |   | 0.000925728779982
300 Weatherby Magnum | 28 | Rifle | 20 | 560 |   | 0.000345605411193
45 GAP | 27 | Pistol | 50 | 1350 |   | 0.000833155901984
45 Black Powder | 27 | Rifle | 20 | 540 |   | 0.000333262360794
222 Remington | 26 | Rifle | 20 | 520 |   | 0.000320919310394
54 Black Powder | 24 | Pistol | 20 | 480 |   | 0.000296233209594
30-40 Krag | 20 | Rifle | 20 | 400 |   | 0.000246861007995
223 WSSM | 19 | Rifle | 20 | 380 |   | 0.000234517957595
6.5 Creedmoor | 19 | Rifle | 20 | 380 |   | 0.000234517957595
458 SOCOM | 17 | Rifle | 20 | 340 |   | 0.000209831856796
280 Remington | 16 | Rifle | 20 | 320 |   | 0.000197488806396
44 Black Powder | 16 | Pistol | 20 | 320 |   | 0.000197488806396
45 Colt | 16 | Pistol | 50 | 800 |   | 0.00049372201599
450 Bushmaster | 15 | Rifle | 20 | 300 |   | 0.000185145755996
300 Remington Ultra Mag | 15 | Rifle | 20 | 300 |   | 0.000185145755996
32 Winchester Special | 15 | Rifle | 20 | 300 |   | 0.000185145755996
50 Beowulf | 14 | Rifle | 20 | 280 |   | 0.000172802705597
7.5x55 Swiss | 14 | Rifle | 20 | 280 |   | 0.000172802705597
44-40 Winchester | 13 | Rifle | 20 | 260 |   | 0.000160459655197
7mm Mauser | 13 | Rifle | 20 | 260 |   | 0.000160459655197
444 Marlin | 13 | Rifle | 20 | 260 |   | 0.000160459655197
6mm Remington | 13 | Rifle | 20 | 260 |   | 0.000160459655197
327 Magnum | 13 | Pistol | 20 | 260 |   | 0.000160459655197
7.62x25 Tokarev | 13 | Pistol | 50 | 650 |   | 0.000401149137992
260 Remington | 13 | Rifle | 20 | 260 |   | 0.000160459655197
22 Hornet | 12 | Rifle | 20 | 240 |   | 0.000148116604797
6.5x52 Carcano | 12 | Rifle | 20 | 240 |   | 0.000148116604797
450 Marlin | 11 | Rifle | 20 | 220 |   | 0.000135773554397
375 H&H Magnum | 11 | Rifle | 20 | 220 |   | 0.000135773554397
7.7x58 Japanese | 11 | Rifle | 20 | 220 |   | 0.000135773554397
257 Weatherby Magnum | 11 | Rifle | 20 | 220 |   | 0.000135773554397
 Total units -> | 38888 |   |  Total estimated rounds -> | 1620345 |   |  

Once you have this data finalized I encourage you to record the data and sources in the repo for future reference.

Was this page helpful?
0 / 5 - 0 ratings