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

realistic gun maintenance #34240

Merged
merged 39 commits into from Oct 2, 2019

Conversation

misterprimus
Copy link
Contributor

Summary

SUMMARY: Balance "Adjusts fouling and misfire mechanics"

Purpose of change

make misfires/weapon malfunctions more realistic and less chance-based

Describe the solution

Creates fouling mechanics for guns. Fouling occurs much more quickly from firing blackpowder, whereas fouling from normal rounds requires a LOT of work to foul the gun. There's no longer blackpowder "clogging" - the gun just eventually becomes incredibly unreliable due to fouling accumulation. Gun can no longer be damaged randomly just from firing - this does not happen IRL. A "misfire" is generally just a dud IRL - no way for it to cause damage to the gun. You can click a snap cap as long as you like; real manuals for guns even say so. A gun CAN get damaged if it is so dirty that it causes pressure to build up to very high levels inside the weapon, sometimes leading to damage, but this is unlikely except at the highest levels of fouling.

Describe alternatives you've considered

Considered adding more realistic cleaning mechanisms - cleaning with solvents first, then applying oil, but was worried it would turn off devs for requiring too many steps. Right now the pipe cleaner is assumed to perform both of those functions abstractly.

Additional context

src/ranged.cpp Outdated Show resolved Hide resolved
src/ranged.cpp Outdated Show resolved Hide resolved
misterprimus and others added 2 commits September 26, 2019 08:40
Co-Authored-By: BevapDin <tho_ki@gmx.de>
@ThomasLinkin
Copy link

Sounds nice. But what if you can implement it into the Gunsmith Repair Kit? Beside the gun fixing function,you can put in the gun cleaning function so that this problem won't get any more complicated,but also help the player to have an easy access to gun cleaning instead of running around to find component

@ThomasLinkin
Copy link

Also,can i suggest that since you said dirty gun always jammed,we can tag the gun you get from zombies as "Dirty" and need cleaning? This will encourage the player to clean their guns,thus get some usage out of this.

@misterprimus
Copy link
Contributor Author

Sounds nice. But what if you can implement it into the Gunsmith Repair Kit? Beside the gun fixing function,you can put in the gun cleaning function so that this problem won't get any more complicated,but also help the player to have an easy access to gun cleaning instead of running around to find component

I think it already works like that. The gun gets cleaned as soon as the fouling malfunction is removed, reducing dirt to 0. This can be done with the kits AND the pipe cleaner, which appears to be fairly easy to craft. I think your bigger problem will be finding enough ammo to foul the gun (unless you use black powder). IRL gun enthusiasts go through thousands of rounds sometimes and the gun works despite not being cleaned. This PR is close, but not quite as forgiving as that. Still likely won't be a problem with normal ammo until you're going to mags and mags of it clearing a city.

@misterprimus
Copy link
Contributor Author

misterprimus commented Sep 26, 2019

Also,can i suggest that since you said dirty gun always jammed,we can tag the gun you get from zombies as "Dirty" and need cleaning? This will encourage the player to clean their guns,thus get some usage out of this.

In real world USA you're unlikely to find heavily fouled guns. Gun owners typically either overclean their guns or you have a n00b who forgets to oil his new gun. You're more likely to get a slightly damaged gun from it being dropped (NATO guns appear to be vulnerable to dropping) than a dirty gun, so I think the current implementation + my PR would represent the real world quite well.

There are many firearms owners, including experienced shooters, won't clean their firearms until a few thousand rounds.

data/json/items/gun/faults_gun.json Outdated Show resolved Hide resolved
data/json/items/gun/faults_gun.json Show resolved Hide resolved
Co-Authored-By: Jianxiang Wang (王健翔) <qrox@sina.com>
@ZhilkinSerg ZhilkinSerg added [C++] Changes (can be) made in C++. Previously named `Code` [JSON] Changes (can be) made in JSON Game: Balance Balancing of (existing) in-game features. Ranged Ranged (firearms, bows, crossbows, throwing), balance, tactics labels Sep 26, 2019
@ThomasLinkin
Copy link

So which category of crafting are we talking about to craft the pipe cleaner? Weapon? Or ammo? If that so,then which level? From what type of book you can get the recipe out of? What i meant was make it easy for us gun-noob by set all of it into a single kit instead of a kit and a pipe cleaner since it will be easier to find . besides,you can only found guns on zombie cops and zombie soldier and such,and it would be nice to think they clean their guns regularly after turned into a zombie.

@misterprimus
Copy link
Contributor Author

So which category of crafting are we talking about to craft the pipe cleaner? Weapon? Or ammo? If that so,then which level? From what type of book you can get the recipe out of? What i meant was make it easy for us gun-noob by set all of it into a single kit instead of a kit and a pipe cleaner since it will be easier to find . besides,you can only found guns on zombie cops and zombie soldier and such,and it would be nice to think they clean their guns regularly after turned into a zombie.

You can find the info here:
https://cdda-trunk.chezzo.com/pipe_cleaner/craft

I made neither the pipe cleaner nor the kit. The pipe cleaner just cleans the gun. The kit can clean the gun AND repair it.

Most of the guns you will find will be in gun shops, not dead zeds. Dead zeds don't need to clean their guns. They don't even use their guns. A dead zed's gun will have whatever condition and dirt it had when the cop turned into a zed, which I suspect would be "good" and "clean," minus whatever abuse the zed accidentally applied to the gun. Fouling accumulation is impossible without firing the gun, so the only issue the gun might have is a mechanical (condition) issue resulting from the zed stumbling onto the gun and pinning it against the ground. This is already properly implemented.

@ThomasLinkin
Copy link

So the recipe is new eh? Wait,wire? I thought we need like a long tube or something,not a wire?

@misterprimus
Copy link
Contributor Author

So the recipe is new eh? Wait,wire? I thought we need like a long tube or something,not a wire?

I guess. I didn't make it.

@I-am-Erk
Copy link
Contributor

I'd say, after this pr, there should be a chance that zombie guns are fouled. Regardless of their cleanliness before, they're now being dragged through dirt, vomited, and oozed on. It doesn't need to be a guarantee but maybe the (filthy) tag on a monster should confer a 50% chance its gun is fouled too.

@misterprimus
Copy link
Contributor Author

I'd say, after this pr, there should be a chance that zombie guns are fouled. Regardless of their cleanliness before, they're now being dragged through dirt, vomited, and oozed on. It doesn't need to be a guarantee but maybe the (filthy) tag on a monster should confer a 50% chance its gun is fouled too.

Makes sense. Let me see if I can find a good way of adding that as a feature. Or maybe leave it to a future PR. Either way won't be too unbalanced in the short-term since guns will still fall down damaged like they used to.

@misterprimus
Copy link
Contributor Author

Anyone know what this is/how to fix it? Seems to be the only problem:
The command "sudo -E apt-add-repository -y "ppa:ubuntu-toolchain-r/test"" failed and exited with 1 during .

@ThomasLinkin
Copy link

At least we are getting the jammed gun into use. Don't have to be frequent,but at least let the zombie's gun jammed every now and then like Far Cry 2 so that the player have to move their ass to find guns instead of just sitting around with the wander horde mode on,waiting for guns

@ThomasLinkin
Copy link

Oh and if the gun is dirty, how about adding a really high chances of malfunctioning while shooting? This will force the player to go clean the gun or drop it,and it would be nice. Sounds annoying,but really awesome if you really give it a thought

@misterprimus
Copy link
Contributor Author

At least we are getting the jammed gun into use. Don't have to be frequent,but at least let the zombie's gun jammed every now and then like Far Cry 2 so that the player have to move their ass to find guns instead of just sitting around with the wander horde mode on,waiting for guns

Zombie guns don't jam. Zombies don't carry guns and don't use them. Waiting for hordes to come in with guns is no more viable now than it was before. This PR does not really affect that.

@misterprimus
Copy link
Contributor Author

Oh and if the gun is dirty, how about adding a really high chances of malfunctioning while shooting? This will force the player to go clean the gun or drop it,and it would be nice. Sounds annoying,but really awesome if you really give it a thought

Guns already do jam when they are dirty with this PR. That was the central point of the PR.

misterprimus and others added 11 commits September 28, 2019 10:43
Co-Authored-By: Jianxiang Wang (王健翔) <qrox@sina.com>
Co-Authored-By: Jianxiang Wang (王健翔) <qrox@sina.com>
Co-Authored-By: BevapDin <tho_ki@gmx.de>
Co-Authored-By: Jianxiang Wang (王健翔) <qrox@sina.com>
Co-Authored-By: Jianxiang Wang (王健翔) <qrox@sina.com>
@misterprimus
Copy link
Contributor Author

image
???

src/ranged.cpp Outdated Show resolved Hide resolved
Rail-runner's suggestion on removing UPS_CHARGES check in deciding to fail to cycle or not. Appears to have worked with the minigun.

Added check to see if non-fouling parameter was in the current ammo effects. Purpose was to get rid of fouling in guns like the rail rifle, which don't even use gunpowder. These fouled without this change, but now seem to be working properly.
@LoGIRz
Copy link

LoGIRz commented Sep 29, 2019

Don't some zombies carry their guns in holsters like zombie military pilots? Should there a way to increase the chance to recover a clean gun off such zombies?

@misterprimus
Copy link
Contributor Author

Don't some zombies carry their guns in holsters like zombie military pilots? Should there a way to increase the chance to recover a clean gun off such zombies?

There is. Look at zombie cop json for the example. By default the drop dirt range is all over the place, but you can put in a custom range for specific drops, like the zombie cop.

it.faults.insert( fault_gun_blackpowder );
if( !curammo_effects.count( "NON-FOULING" ) ) {
if( curammo_effects.count( "BLACKPOWDER" ) ) {
if( ( it.ammo_data()->ammo->recoil < firing->min_cycle_recoil ) &&
Copy link
Member

Choose a reason for hiding this comment

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

It was intentional that this failed to cycle on every shot when the ammunition was blackpowder.
We need some more evidence for which guns can cycle with blackpowder.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I think it's just an optical illusion on GitHub's change analyzer, Kevin. All I did was add:

if( !curammo_effects.count( "NON-FOULING" ) ) {

to that big section dealing with blackpowder stuff, but because it applies to the entire section, the entire section was indented. So GitHub thinks I deleted that whole section and then added it back, but in reality all I did was insert that one line more or less and the astyle indented it.

The purpose of that line, btw, is to allow people to add a NON-FOULING parameter to non-gunpowder ammo (like the rails for the rail rifle) to avoid fouling of guns like the rail rifle, which makes no sense since it uses electromagnetism/electricity and NOT gunpowder as propellant.

Speaking of which, I think I need to do the same for the nail guns/air-based weapons to prevent fouling in these non-GP guns.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

BP ammo should still cause a malfunction, btw, unless something broke.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I just checked and BP still causes stovepiping, so I didn't remove that functionality.

Copy link
Member

Choose a reason for hiding this comment

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

Yea my bad, sorry.

adds ability to mark a gun, in addition to ammo, as non-fouling.
@kevingranade kevingranade merged commit 95fd840 into CleverRaven:master Oct 2, 2019
@RDru
Copy link
Contributor

RDru commented Oct 2, 2019

I don't see any way in game to clean/remove fouling.

@Qrox
Copy link
Contributor

Qrox commented Oct 2, 2019

I think you can do it by mending the gun from the item action menu? (inventory - select the gun - mend - select the fault)

@misterprimus
Copy link
Contributor Author

I don't see any way in game to clean/remove fouling.

Mend menu. Note you won't see "faulty" if you just have dirtying, as dirtying in and of itself is not a "fault" per se, just accumulated dirt.

@misterprimus
Copy link
Contributor Author

Also curious if anyone has any input re: what should and should not get "fouled." Obviously any item can start out foul due to, as someone suggested, zeds barfing/bleeding on it, dragging it through the mud, etc... Obviously guns would always foul due to use of gunpowder. Air guns currently are set to not foul, though technically they do, albeit I'm not sure it will ever be enough to matter:
https://www.pyramydair.com/blog/2005/04/how-should-i-clean-my-airgun-barrel/

Bows/xbows also accumulate dirt/oils from use:
https://www.archerytalk.com/vb/showthread.php?t=1372213

Bows/xbows I believe should foul presently if they are is_gun.

Any input would be helpful as we tweak this in future PRs.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[C++] Changes (can be) made in C++. Previously named `Code` Game: Balance Balancing of (existing) in-game features. [JSON] Changes (can be) made in JSON Ranged Ranged (firearms, bows, crossbows, throwing), balance, tactics
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

10 participants