Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Gun spawn overhaul #76714

Merged
merged 30 commits into from
Oct 2, 2024
Merged

Conversation

Holli-Git
Copy link
Contributor

@Holli-Git Holli-Git commented Sep 28, 2024

Summary

Content "Overhaul gun spawning"

Purpose of change

Gun spawns are all over the place. There's not much rhyme or reason why a gun would spawn in its quantity besides guesswork. This PR aims to bring gun spawns in-line with real-world numbers, so there's less of a headache when adding new guns. This information was based mostly on gunbroker results, and #37571.

Describe the solution

Uses gunbroker and #37571 to gauge how often a caliber should spawn, and how often a gun should spawn. This is by no means perfect and has lots of flaws, but currently its the best solution due to a lack of any other information.

Removes itemgroups like rare/obscure guns and smg groups. This is because before, "rare guns" had a fixed chance to spawn somewhere, despite rarity not really working like that. Instead, guns now have to get a good dice roll to spawn somewhere, instead of it being fixed. SMG spawns were removed as a civilian can't really own an actual SMG, and so it was better split into either pistols or rifles.

Adjusts some behavior of conversion gun spawns, as they could spawn in guns you could not easily legally own.

Describe alternatives you've considered

Not doing this, it was a whole lot of work.

Testing

Loaded up a world before changes, loaded into the same one after without any errors. Tested a few itemgroups in game, such as the display ones to make sure no ammo spawned with it, etc.

Additional context

Caused by #75925. Also requires a lot of reworking of guns, and ammo spawns. Yay.

@Holli-Git Holli-Git marked this pull request as draft September 28, 2024 19:48
@github-actions github-actions bot added NPC / Factions NPCs, AI, Speech, Factions, Ownership [JSON] Changes (can be) made in JSON Mods Issues related to mods or modding Map / Mapgen Overmap, Mapgen, Map extras, Map display Spawn Creatures, items, vehicles, locations appearing on map Monsters Monsters both friendly and unfriendly. Items: Ammo / Guns Ammunition for all kinds of weapons and these weapons themselves Mods: Magiclysm Anything to do with the Magiclysm mod labels Sep 28, 2024
@github-actions github-actions bot added the astyled astyled PR, label is assigned by github actions label Sep 28, 2024
@github-actions github-actions bot added json-styled JSON lint passed, label assigned by github actions BasicBuildPassed This PR builds correctly, label assigned by github actions labels Sep 28, 2024
Copy link
Member

@GuardianDll GuardianDll left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

itemgroups looks okay

@Holli-Git Holli-Git changed the title Gun spawn overhaul Gun spawn overhaul (Don't yet merge) Sep 29, 2024
@Holli-Git Holli-Git marked this pull request as ready for review September 29, 2024 19:43
@github-actions github-actions bot removed the BasicBuildPassed This PR builds correctly, label assigned by github actions label Sep 29, 2024
@github-actions github-actions bot added the BasicBuildPassed This PR builds correctly, label assigned by github actions label Sep 30, 2024
@Holli-Git Holli-Git changed the title Gun spawn overhaul (Don't yet merge) Gun spawn overhaul Sep 30, 2024
@tenehea
Copy link

tenehea commented Sep 30, 2024

SMG spawns were removed as a civilian can't really own an actual SMG, and so it was better split into either pistols or rifles.

This is a very bizarre assertion, unless rifles contains semi-auto pistol caliber rifles.

@Holli-Git
Copy link
Contributor Author

This is a very bizarre assertion, unless rifles contains semi-auto pistol caliber rifles.

Yeah, they do now. Check the changes I've made

@Night-Pryanik
Copy link
Contributor

This is a big chunk of changes. It's really hard to review it properly (for me, at least). May I suggest splitting this PR into a smaller pieces, for example first one for pistols, second one for shotguns etc?

@Holli-Git
Copy link
Contributor Author

This is a big chunk of changes. It's really hard to review it properly (for me, at least). May I suggest splitting this PR into a smaller pieces, for example first one for pistols, second one for shotguns etc?

That would've been fairly harder to do, as since they cover a lot of the same areas it would introduce a lot of merge conflicts. Guns are also pretty interconnected, and I'm unsure if I could sort them into pistol/shotgun/rifle. Though I do understand where you're coming from, and am thankful for the review, so in the future I'll split it up into different PRs.

@kevingranade
Copy link
Member

kevingranade commented Oct 1, 2024

Ran my demographics test on top of this to see if anything skewed badly. tl;dr nothing horrific, rifles vs pistols is kind of out of whack, but my source for that is pretty sketchy to start with, and I don't know if this PR did it or if it was already there. I'll rerun on before-this-change to check, but it takes 8h to run so I'll have results tomorrow (EDIT: if I remember to start it, which I did not).

gun type expected actual
pistols 0.616f 0.47416f
rifles 0.357f 0.50239f
shotguns 0.027f 0.02345f
calibre expected actual
9mm 0.21502f 0.24853f
223 0.1286f 0.10938f
45 0.05041f 0.06391f
380 0.04938f 0.04019f
40 0.04115f 0.04782f
357mag 0.03498f 0.0169f
762 0.03498f 0.02165f
308 0.02572f 0.08697f
38 0.01955f 0.02545f
44 0.01543f 0.00827f
3006 0.00823f 0.01782f
45colt 0.00823f 0.00413f
762R 0.00412f 0.00629f
270win 0.00309f 0.00441f
410shot 0.00309f 0.00101f
300blk 0.00206f 0.0f
10mm 0.00103f 0.00154f
123ln 0.00103f 0.00069f
other 0.11728f 0.06595f

@kevingranade kevingranade merged commit e50203b into CleverRaven:master Oct 2, 2024
17 of 24 checks passed
@kevingranade
Copy link
Member

Belated rerun from before this PR:

gun type expected actual
pistols 0.616f 0.41017f
rifles 0.357f 0.55517f
shotguns 0.027f 0.03466f

In short, it was already skewed this direction, though this PR might have contributed a bit.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
astyled astyled PR, label is assigned by github actions BasicBuildPassed This PR builds correctly, label assigned by github actions Items: Ammo / Guns Ammunition for all kinds of weapons and these weapons themselves [JSON] Changes (can be) made in JSON json-styled JSON lint passed, label assigned by github actions Map / Mapgen Overmap, Mapgen, Map extras, Map display Mods: Aftershock Anything to do with the Aftershock mod Mods: Backrooms Mods: Defense Mode Anything to do with the Defense Mode mod Mods: Innawood 🌲 Anything to do with Innawood mod Mods: Magiclysm Anything to do with the Magiclysm mod Mods: Mind Over Matter Mods: No Hope Relating to the mod No Hope Mods Issues related to mods or modding Monsters Monsters both friendly and unfriendly. NPC / Factions NPCs, AI, Speech, Factions, Ownership Spawn Creatures, items, vehicles, locations appearing on map
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants