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

Adjust grenade values #37585

Merged

Conversation

Brian-Otten
Copy link
Contributor

@Brian-Otten Brian-Otten commented Jan 31, 2020

Summary

SUMMARY: Balance "Adjust grenade values "

Purpose of change

Normal military frag grenades now use the same format as other explosives so the code is less confusing. Adjusted values to match the m67 frag grenade.

Describe the solution

https://en.wikipedia.org/wiki/M67_grenade
Explosives power is TNT equivalence, m67 frag has 180 grams of compound B which is 240 grams tnt.
Casing mass used is weight of the grenade minus weight of the explosive filler.

Fragment size was estimated with some help from dev-general at 0.15 grams. This is subject to change if someone has better data / a better way of estimating shrapnel size.

Describe alternatives you've considered

Testing

Spawn grenades ingame, they function as expected of military grenades without errors.

Additional context

Estimations by tenmillimaster
"my hairy inverted golfball has 726 points, by my count
image

tiny bit of error on the left hand side, but eh
good enough
so if it fragmented perfectly, less fuze elements and whatnot, it'd split into ~1452 pieces?"

The grenade is currently set to fragment in 1466 pieces.

@Brian-Otten Brian-Otten changed the title Makes grenades use modern code Adjust grenade values Jan 31, 2020
@Brian-Otten
Copy link
Contributor Author

It looks like adjusting the grenade to match its real life values is making it fail the explosion test, going to try seeing if it passes if we assume it fragmenting less evenly and produce less/larger fragments. If that doesn't pass this PR can probably be closed/stalled until someone reworks the explosion tests.

@Brian-Otten
Copy link
Contributor Author

Brian-Otten commented Jan 31, 2020

It looks like the test is failing because it thinks the new grenade is too weak, while it now behaves much more like the other ingame explosives. I "suspect" that with the old code it is not generating 212 pieces of shrapnel, but setting the casing mass to 212 and generating a "lot" of tiny shrapnel
image
Which is extremely effective against completely unarmored zombies but extremely weak against even small armor values.

Grenade versus zombie cops:
image

Makeshift grenade versus zombie cops
image

It should be noted that zombie cops only have 6 cut armor.

@Brian-Otten
Copy link
Contributor Author

Kevin helped me figure out that grenade is using the default shrapnel size of 0.005 grams, which gives the frag grenade 42400 pieces of shrapnel, which is probably too much.
Adjusting the shrapnel size to somewhere closer to 1500 is easily done, but we need to adjust the explosion_balance_test.cpp to accept the new values.
First idea was to change it to count wounded zombies as "casualties" in the lethality test.

Makes the grenade splinter into 1446 fragments
@Brian-Otten
Copy link
Contributor Author

New value seems to give very sensible results, passing the 5m test, and i believe would pass the 15m test if we count the wounded as casualties.

It does seem to be failing the vehicle test now though, i think because the shrapnel now does enough damage to harm the vehicle, which it could not before.

Uses the code kevin wrote in CleverRaven#37605 so the grenade change is packed with the new test, so we can see if it passes.
@Brian-Otten
Copy link
Contributor Author

Added the modified explosions test kevin wrote to this PR.

@ZhilkinSerg ZhilkinSerg added [C++] Changes (can be) made in C++. Previously named `Code` [JSON] Changes (can be) made in JSON Code: Tests Measurement, self-control, statistics, balancing. Game: Balance Balancing of (existing) in-game features. labels Feb 1, 2020
To see if this makes it pass the test.
@Brian-Otten
Copy link
Contributor Author

Going to tweak fragment damage to vehicles till i've walked it to the target of narrowly passing the vehicletest again.

Default fragment mass is now the same as the new frag grenade fragment mass.
@Brian-Otten
Copy link
Contributor Author

Explosion test is now passing lethality/casualty tests, but failing the vehicle test. The frag grenade is slightly harming the wheels and the alternator. It only passes if it does not damage the vehicle. Not sure what the best approach to fix it would be.

@Brian-Otten Brian-Otten closed this Feb 1, 2020
@Brian-Otten Brian-Otten reopened this Feb 1, 2020
@Brian-Otten
Copy link
Contributor Author

... i fat fingered the close PR button. Working on a fix for the vehicle test with suggestions from kevin, once that is narrowed down to pass the test this should be ready.

@Brian-Otten
Copy link
Contributor Author

Brian-Otten commented Feb 2, 2020

I'm starting to suspect that the code for reducing damage to vehicles is working oddly.
I've been trying to dial it in so the new grenade does not harm vehicles at all (so it can pass the test), but with the new fragment sizes it seems to damage vehicles, even when i've changed it to
g->m.bash( target, damage / 4000, true );
from g->m.bash( target, damage / 10, true );

@Brian-Otten
Copy link
Contributor Author

Brian-Otten commented Feb 4, 2020

All right, it took some tuning but i finally got this where i want it / where it should be. Grenades now have realistic values and effects, and shrapnel damage to vehicles/objects is behaving as i might expect, with the grenade barely damaging vehicles / doors (unless detonated from really close) but heavier explosives doing a bit better.
Little showcase:
Before detonation
image
After detonation
image

I think this should be ready to merge now. We might want to consider waiting for after 0.E to be fully sure there are no weird interactions in the upcoming stable, but making the grenade handle properly might also be seen as important, so i leave that up to the devs.

}

TEST_CASE( "grenade_vs_vehicle", "[grenade],[explosion],[balance]" )
{
check_vehicle_damage( "grenade_act", "car", 5 );
}
}
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
}
}

@kevingranade kevingranade merged commit 6d26b22 into CleverRaven:master Feb 11, 2020
@Brian-Otten
Copy link
Contributor Author

Brian-Otten commented Feb 11, 2020

Thanks for the review and teamwork on this one kevin. Would not have been possible without your help on the explosives test.

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` Code: Tests Measurement, self-control, statistics, balancing. Game: Balance Balancing of (existing) in-game features. [JSON] Changes (can be) made in JSON
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants