Join GitHub today
GitHub is home to over 36 million developers working together to host and review code, manage projects, and build software together.
Sign up[READY] Ranged balance unit test #21468
Conversation
kevingranade
force-pushed the
kevingranade:ranged_balance_unit_test
branch
Jul 24, 2017
This comment has been minimized.
This comment has been minimized.
|
RNG has to be there until you write a CD function for your distribution. One important thing those tests should test should be distribution of hit types, not just binary hit/miss. |
kevingranade
force-pushed the
kevingranade:ranged_balance_unit_test
branch
Jul 29, 2017
This comment has been minimized.
This comment has been minimized.
|
Wild firing without aiming fails, it's too accurate. |
Coolthulhu
self-assigned this
Jul 30, 2017
kevingranade
force-pushed the
kevingranade:ranged_balance_unit_test
branch
Jul 30, 2017
Coolthulhu
reviewed
Jul 30, 2017
| item &ammo = shooter.i_add( item( ammo_id, calendar::turn, gun.ammo_capacity() ) ); | ||
| REQUIRE( gun.is_reloadable_with( ammo_id ) ); | ||
| REQUIRE( shooter.can_reload( gun, ammo_id ) ); | ||
| gun.reload( shooter, item_location( shooter, &ammo ), gun.ammo_capacity() ); |
This comment has been minimized.
This comment has been minimized.
Coolthulhu
Jul 30, 2017
Contributor
The test files could use some styling. For example, tabs->spaces.
This comment has been minimized.
This comment has been minimized.
kevingranade
Jul 30, 2017
Author
Member
I'm partially waiting on #21494 and partially just being sloppy since I'm still rewriting large sections of it as I go. Will be 100% astyled by the time I mark it ready to merge.
Coolthulhu
reviewed
Jul 30, 2017
| shooter.get_weapon_dispersion( gun, | ||
| rl_dist( shooter.pos(), test_target.pos() ) ); | ||
| dispersion.add_range( std::max( static_cast<double>( gun.sight_dispersion() ), | ||
| shooter.recoil_total() * ( 1.0 - aim_ratio ) ) ); |
This comment has been minimized.
This comment has been minimized.
Coolthulhu
Jul 30, 2017
Contributor
recoil_total would probably just return RECOIL_MIN, except when something is weirdly initialized or after burst.
But projectile_attack doesn't increase recoil.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
kevingranade
Jul 30, 2017
Author
Member
Actually I think it is doing what I want right now, but it's farly fragile, I should just use RECOL_MIN.
Coolthulhu
reviewed
Jul 30, 2017
|
|
||
| statistics minimum_stats = firing_test( shooter, gun_type, 0.0, minimum_range ); | ||
| INFO( "Accumulated " << minimum_stats.n() << " samples." ); | ||
| CHECK( minimum_stats.avg() < 0.01 ); |
This comment has been minimized.
This comment has been minimized.
Coolthulhu
Jul 30, 2017
Contributor
Why 1%? That's very strict, especially when you're counting grazes and not just good hits.
This comment has been minimized.
This comment has been minimized.
kevingranade
Jul 30, 2017
Author
Member
Why not? If it starts failing we can adjust, but in this case we're asserting "almost never hits", so I'd like to be as strong as is practical.
Note I'm not rejecting your request to factor in hit quality, I'm just filling this out in what I think is the best order, I'll circe back around to check if hit quality is practical to extract once I have the use cases covered.
This comment has been minimized.
This comment has been minimized.
Coolthulhu
Jul 30, 2017
Contributor
Well, the test cases may need adjusting then.
Almost always missing at 5 tiles is comparable to reliably missing broad side of the barn from inside.
This comment has been minimized.
This comment has been minimized.
kevingranade
Jul 30, 2017
Author
Member
You might have missed the detail that this is with no aiming at all, this is effectively the quickdraw scenario.
Also it's not remotely a barn-sized target, it's exactly analagous to shooting at a person-sized and shaped target at the stated range. Depending on how we set up our range adjustment, that 5-tile range will almost certainly be equivalent to 20' or so, at which point a novice always missing a man-sized target when quickdrawing is perfectly reasonable.
This comment has been minimized.
This comment has been minimized.
Coolthulhu
Jul 30, 2017
Contributor
I wouldn't enforce "always misses" on novices. It may be reasonable to expect it, but it only complicates things when balancing.
It does matter for experts - those certainly need to be capped from above, but again - 1% cap is really strict, at this point it's a problematic limitation that doesn't test an in-game situation.
Any hit rate below 10% that includes grazes is well into not being worth it for proper firearms. It would make sense for pneumatics or lasers, where ammunition is very cheap, but firearms are expensive to maintain and also loud.
It's basically a statistical outlier - one that is not worth including in the model.
If you bumped the rate to at least 10%, it would both become more practical and easier to actually enforce without breaking other values.
But then again, going for capping the 10% "good hit" rate would be even better. It would test actual in-game effects, not implementation details.
This comment has been minimized.
This comment has been minimized.
kevingranade
Jul 31, 2017
Author
Member
I'll agree to the extent that assertions about "solid hits" are higher value than assertions about "technical hits", and if we do encounter a deadlock while balancing, the "technical hits" are the ones to relax.
Coolthulhu
reviewed
Jul 30, 2017
| dealt_projectile_attack shot = | ||
| projectile_attack( make_gun_projectile( gun ), shooter.pos(), test_target.pos(), | ||
| dispersion, &shooter, nullptr ); | ||
| firing_stats.add( shot.hit_critter != nullptr ); |
This comment has been minimized.
This comment has been minimized.
Coolthulhu
Jul 30, 2017
Contributor
Would be more meaningful to count only hits above certain threshold of accuracy.
Grazes are relatively common and their damage is at most 1/8 of base damage. For weak firearms, it means no damage against even moderately armored targets.
This comment has been minimized.
This comment has been minimized.
kevingranade
Jul 30, 2017
Author
Member
If it's practical to make assertions about hit quality, I'll also make assertions about it, but grazes aren't meaningless to make assertions about.
kevingranade
changed the title
Ranged balance unit test
[WIP] Ranged balance unit test
Jul 30, 2017
Coolthulhu
removed their assignment
Jul 30, 2017
kevingranade
force-pushed the
kevingranade:ranged_balance_unit_test
branch
2 times, most recently
Aug 2, 2017
This comment has been minimized.
This comment has been minimized.
|
Needed a massive overhaul for performance reasons, it was taking multiple seconds to complete, and it's just going to continue to get worse over time. (after changes they're running in under 0.05s) This covers the bases outlined in #21244 but needs some additional tweaking and then of course the actual balance changes.
|
kevingranade
force-pushed the
kevingranade:ranged_balance_unit_test
branch
Aug 2, 2017
kevingranade
force-pushed the
kevingranade:ranged_balance_unit_test
branch
4 times, most recently
Aug 17, 2017
This comment has been minimized.
This comment has been minimized.
|
Constraint for quickdraw turned out to be overly-agressive after all, it took dropping it to one hit out of 10, increasing the range slightly and increasing MAX_RECOIL (and associated values) by 5x to enforce it properly, but that did it and it seems like a workable adjustment, the original MAX_RECOIL was just a shot in the dark after all rimshot. |
This comment has been minimized.
This comment has been minimized.
|
For context, "completely unaimed" is now 3,000 MOA, which in more accessable terms, is roughly 3" (radius) per tle of distance. That doesn't sound like much, but it's 5x as high as it used to be, and it's plenty to make you miss when added to other sources of inaccuracy. I'm pretty happy with that result, it actually gives us a basis for what unaimed accuracy should be as opposed to it being totally arbitrary. This does cause a problem though, now that aiming is a lot faster, it's more of a no-brainer to keep aiming to the maximum, since the spike in accuracy at the very end is extremely high. |
This comment has been minimized.
This comment has been minimized.
|
How about add relation between aming speed and player weapon skill so unexpirienced player take aim slower? |
This comment has been minimized.
This comment has been minimized.
|
It's already there. |
kevingranade
referenced this pull request
Aug 25, 2017
Closed
Gun accuracy calculation broken #21244
This comment has been minimized.
This comment has been minimized.
|
Additional info, I wrote a test to find the dispersion value where hit rate exceeds 50% at various ranges, and here's the output: |
kevingranade
force-pushed the
kevingranade:ranged_balance_unit_test
branch
2 times, most recently
Aug 31, 2017
kevingranade
changed the title
[WIP] Ranged balance unit test
[CR] Ranged balance unit test
Sep 2, 2017
kevingranade
reviewed
Sep 2, 2017
| int limit = 0; | ||
| if( !gun.has_flag( "DISABLE_SIGHTS" ) && effective_dispersion( gun.type->gun->sight_dispersion ) < recoil ) { | ||
| cost = std::max( std::min( gun.volume() / 250_ml, 8 ), 1 ); |
This comment has been minimized.
This comment has been minimized.
kevingranade
Sep 2, 2017
Author
Member
Balance aside, this is a bugfix. The previous version based aiming speed for unmodded guns on gun size, then completely ignored it once a sight ws added.
kevingranade
added some commits
Sep 16, 2017
kevingranade
force-pushed the
kevingranade:ranged_balance_unit_test
branch
Sep 26, 2017
kevingranade
added some commits
Sep 26, 2017
kevingranade
force-pushed the
kevingranade:ranged_balance_unit_test
branch
to
ae61a67
Sep 26, 2017
This comment has been minimized.
This comment has been minimized.
|
Ok, that's everything except the overhaul of range_with_even_chance_of_good_hit(). I made the multipliers for dex and per the same (2.25), which is the furthest I could adjust it without making the tests start failing. |
This comment has been minimized.
This comment has been minimized.
|
All right, let's get it in for now. The rebases get heavy and it's good enough for now. Problems not fixed yet:
|
Coolthulhu
merged commit 41e8209
into
CleverRaven:master
Sep 27, 2017
This comment has been minimized.
This comment has been minimized.
|
Shit, should have been more careful - I totally missed the part where the tests for high-level characters got adjusted in the wrong way and relaxed into uselessness. It still solves the part where guns are totally useless that resulted from the revert earlier on, but does not achieve balance. |
This comment has been minimized.
This comment has been minimized.
|
Create issue on that. Better with "Priority" tag. |
Firestorm01X2
referenced this pull request
Sep 27, 2017
Closed
Game error crash when try to throwing #22001
This comment has been minimized.
This comment has been minimized.
|
There is chance that this PR caused crashes on throwing. Look for referenced issue. |
This comment has been minimized.
This comment has been minimized.
|
In
The item being thrown expects a gun type to be associated with it, but there is only a null pointer available for items that can only be thrown (
The game doesn't crash if you try to throw a gun. This apparently means if I try to throw a pistol, it will use my pistol skill to determine the time it takes to throw it. I tested changing handgun level 0 to level 20, and it caused the Additionally, the actual throw time cost is calculated separately at |
kevingranade
deleted the
kevingranade:ranged_balance_unit_test
branch
Sep 28, 2017
kevingranade
referenced this pull request
Oct 2, 2017
Closed
Occasional test failures in ranged_test.cpp #22064
This comment has been minimized.
This comment has been minimized.
Sagan-Ro
commented
Oct 13, 2017
|
Okay, so I have a few questions that are really bugging me:
I am really, really hoping the absolutely craptastic new "performance" of long-range weaponry and burst firing is just because the new system isn't finished yet. I was playing release 6723 for over a month, and could tag enemies more than 2/3 the time with the Heavy Rail Rifle (scope+gyroscopic stabilizer+tuned mechanism+match trigger) around 55+ squares away. Now I just get grazing hits over 20 squares, and any hit at all seems to go to zero at or past 25 squares. Thank you so much, I would really like it if my sniper could actually, um... snipe. It's pointless to have long-distance weapons in this game if long-distance attacks are no longer possible. |
This comment has been minimized.
This comment has been minimized.
|
Please don't post in closed issues. |
kevingranade commentedJul 23, 2017
•
edited
First stab at an automated test to ensure ranged balance as outlined in #21244
Fixes #21244
Fixes #19718
Fixes #21158
- [ ] Apply 5x increase to MAX_RECOIL and related values in a more consistent way.- [ ] Apply dispersion scaling changes to item definitions instead of as an override.