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

Rebalance aiming and skill training #18020

Merged
merged 34 commits into from Sep 12, 2016

Conversation

Projects
None yet
8 participants
@mugling
Copy link
Contributor

commented Aug 13, 2016

Our current aiming formula uses total dispersion σ (arc minutes) to calculate the tangent of an isoceles triangle formed by the player, intended target and actual target. The relationship is expontential:

range

Effective range is defined as the length of either equal side for triangle with vertex angle θ = σ and with a tangent of 0.25 (derived from 50% chance of accuracy_goodhit).

Total dispersion is calculated as σ = W + P + R where:

  • W is the constant sum of the weapon and ammo values
  • P is determined from player skill
  • R is current effective recoil

If we intend for MAX_RANGE of 30 the usable values for constant W fall within the range [100,600]:

scaled

Aiming reduces R so the distance between MIN_RECOIL and effective sight_dispersion controls how much range improves with aiming (how far left you move on the above graph).

The current range of P is [0-250] dependent both upon marksmanship and relevant weapon skill. Reducing P also results in moving left on the graph with the effects dependent upon σ from other sources: low P has much more effect if W is also low.

In other words player skill (P) is only relevant for already accurate weapons and should be balanced around these:

item W + Rmin (MoA) Range at P0 Range at P5
Glock 19 360 + 90 = 450 5 6
R700+scope 30 + 0 = 30 12 22

If we change P to be dependent only upon marksmanship (in linear proportion) we can decide on the range [P0,P10] based upon Rmin and W.

Currently Rmin is zero when using the the rifle_scope after maximum aiming at PER 10 and there is no reason to change this. We can also presume P10 (maximum marksmanship) is zero.

Knowing this we define an accurate rifle as W=120 which at P10 and Rmin gives an effective range of 29. If we remove the scope and use iron sights we might expect a reduction in range of at least 50% - this would be σ=240 based on an increase from Rmin=0 to R=120.

If we then define a typical rifle as W=180 the following applies:

Item Iron sights (120) Rifle scope (0)
Typical rifle (180) 12 19
Accurate rifle (120) 14 29

These values are reasonable - adding a better sight to a typical rifle helps but the combination cannot be used as an alternative to the pairing of an accurate rifle with good sights.

We need to ensure that the above relationship holds true for all values of P. If we propose a linear range for P of [0,100] then the following apply:

Item P0 P5 P10
Typical rifle + iron sights (300) 12 10 9
Accurate rifle + iron sights (240) 14 12 10
Typical rifle + rifle scope (180) 19 15 12
Accurate rifle + rifle scope (120) 29 20 16

We now arrive at the following definitions:

  • marksmanship is the ability to use accurate weapons and sights
  • The range of levels is [0,10] with P having the inversely proportional range [100,0]
  • default sights are iron sights with Rmin=120

@mugling mugling force-pushed the mugling:arc4 branch 2 times, most recently Aug 13, 2016

@mugling

This comment has been minimized.

Copy link
Contributor Author

commented Aug 13, 2016

This now brings us to the issue of how to split W between GUN and AMMO. Because some ammo types are used by pistol, smg and rifle, which all need to have differing ranges, it is clear that the majority of the effect should be from GUN.

If we propose that ¾ of the effect is from GUN then dispersion for 223 becomes 30. We could then define 9mm as having twice that value:

Item GUN AMMO Rmin Dispersion P0 P5 P10
Glock 19 480 60 120 660 4.5 4.9 5.2
MP5 240 60 120 420 6.6 7.3 8.2
Cx4 180 60 120 360 7.5 8.4 9.6
M4A1 180 30 120 330 8.0 9.1 10.4
AR-15 150 30 120 300 8.6 9.8 11.5
R700 90 30 120 240 10.1 11.9 14.3

For the above examples which all use base iron sighs (120) there an untrained survivor doesn't gain much benefit from the Cx4 carbine over the MP5. If we apply the best possible sights to each item, either rifle_scope (0), pistol_scope (30) or holographic_sight (60):

Item GUN AMMO Rmin Dispersion P0 P5 P10
Glock 19 480 60 30 570 5.1 5.6 6.0
MP5 240 60 60 360 7.5 8.4 9.6
Cx4 180 60 0 240 10.1 11.9 14.3
M4A1 180 30 0 210 11.1 13.2 16.4
AR-15 150 30 0 180 12.3 14.9 19.1
R700 90 30 0 120 15.6 20.2 28.6

Cx4 is now much better than MP5 (at least in terms of range) but remains worse than the similarly sized M4A1 due to the higher dispersion of 9mm. A pistol scope on the glock makes little difference.

This still leaves us with the question of how to balance pistol_scope. If we presume 44 ammo is more accurate than 9mm and give it a value of 40 and then take sw629 as an example:

Item GUN AMMO Rmin Dispersion P0 P5 P10
Glock 19 480 60 120 660 4.5 4.9 5.2
SW629 280 30 120 430 6.5 7.2 8.0
MP5 240 60 120 420 6.6 7.3 8.2
Cx4 180 60 120 360 7.5 8.4 9.6

With iron sights sw629 is better than glock_19 but slightly inferior to hk_mp5. If however we add better sights:

Item GUN AMMO Rmin Dispersion P0 P5 P10
Glock 19 480 60 30 570 5.1 5.6 6.0
MP5 240 60 60 360 7.5 8.4 9.6
SW629 280 30 30 340 7.8 8.8 10.1
Cx4 180 60 0 240 10.1 11.9 14.3

From this we can determine both that AMMO dispersion should span [0,100] and that the below defaults produce reasonable results:

item class W
pistol 480
accurate pistol 280
smg 240
carbine 180
typical rifle 150
accurate rifle 90
sight Rmin
iron sights 120
red dot sight 90
holographic sight 60
pistol scope 30
rifle scope 0
@mightyagrippa

This comment has been minimized.

Copy link
Contributor

commented Aug 13, 2016

Data is great and I like the approach, but a few things off the top of my head.

  1. Reducing player skill dispersion so much makes early game pistols much more powerful. Testing on a previous issue showed that a 0 skill character now has similar accuracy and damage to a previous 8 skill character, though lacking the reduction to firing time.
  2. MAX_RANGE of 30 means players can no longer snipe anti-materiel turrets and tank drones. Both have lethal ranges of 30 or more.
  3. What skill will govern the reduction to gun firing time?
  4. What's going to train the specific gun skills (handguns, rifles, etc)?
@mugling

This comment has been minimized.

Copy link
Contributor Author

commented Aug 13, 2016

@mightyagrippa I did a quick edit of your post to keep those points together as otherwise some would otherwise disappear as I push further commits.

What skill will govern the reduction to gun firing time?

A combination of DEX, hand encumbrance, weapon volume, sight aim_cost and relevant weapon skill

What's going to train the specific gun skills (handguns, rifles, etc)?

Probably based on nett damage but I'm still working this out. Suggestions are welcomed.

MAX_RANGE of 30 means players can no longer snipe anti-materiel turrets and tank drones. Both have lethal ranges of 30 or more.

Both would be subject to a similar limit and there are of course further tactics for use against either.

Reducing player skill dispersion so much makes early game pistols much more powerful. Testing on a previous issue showed that a 0 skill character now has similar accuracy and damage to a previous 8 skill character, though lacking the reduction to firing time.

This is very much WIP so please do test and report back. Gun's were previously defacto useless so it's more relevant to consider if they are too under/overpowered than compare to the previous implementation.

@mightyagrippa

This comment has been minimized.

Copy link
Contributor

commented Aug 13, 2016

Probably based on nett damage but I'm still working this out. Suggestions are welcomed.

Damage-based experience would be a significant nerf to .22; plinking for practice is about the only reason I'm ever happy to find it. The current model where gun skills are trained alongside marksmanship skill seems alright.

Both would be subject to a similar limit and there are of course further tactics for use against either.

Of course, but I'd like to keep sniping in the plausible player toolbox against them. That won't happen if getting a shot at them requires exposing the player to a round of .50 cal or 40mm grenade. Just to make sure, when you say MAX_RANGE = 30 are you talking about "no shooting past 30" or "calibrate numbers so shooting past 30 is very hard"?

This is very much WIP so please do test and report back. Gun's were previously defacto useless so it's more relevant to consider if they are too under/overpowered than compare to the previous implementation.

I disagree strongly on guns being previously useless. The dispersion issues you've noted did make them bad outside of close range, but within 3 or 4 tiles they were useful and even vital to survival. Close range pistol work gave an out to heavily fatigued survivors. SMG or rifle bursts at distance 3 were the simplest safeish way to dispatch the toughest zombies. Even sniping had uses, but since that took like 20 shots to kill a turret you're probably in the right on that one. Looking forward to trying out the new systems.

I'd also suggest retaining gun skill contribution to dispersion. It makes sense that part of accuracy is general firearms skill and part is familiarity with a specific type of weapon. Otherwise it's possible to train to 10 marksmanship on a .22 rifle and thus be a grandmaster shotgunner. But your rebalancing to make marksmanship the primary factor seems right, previous state of 75% gun skill and 25% marksmanship felt too slanted toward gun skill.

@mugling

This comment has been minimized.

Copy link
Contributor Author

commented Aug 13, 2016

Damage-based experience would be a significant nerf to .22

Yes, that could be a problem

Of course, but I'd like to keep sniping in the plausible player toolbox against them. That won't happen if getting a shot at them requires exposing the player to a round of .50 cal or 40mm grenade.

Turrets aren't especially accurate. If you have sufficient skill to snipe them you will already outclass them.

I disagree strongly on guns being previously useless. The dispersion issues you've noted did make them bad outside of close range, but within 3 or 4 tiles they were useful

which is also the only range at which they were useful (first table from #17643)

The current model where gun skills are trained alongside marksmanship skill seems alright.
I'd also suggest retaining gun skill contribution to dispersion

The preamble included a worked example as to why gun skill is irrelevant to accuracy for most skills.

Start at σ=600 on the above graph (an inaccurate weapon), move left 200 units (equivalent to gaining 20 levels of marksmanship) and note that the gain in effective range is negligible. Now try starting from σ=300(a more accurate weapon). Note that marksmanship is irrelevant for everything except inaccurate weapons.

That curve is a result of the mathematical laws concerning trigonometry and short of replacing the entire aiming code with a new model we are subject to it's limitations. The worked examples I gave show how to implement suitable values using the curve.

Otherwise it's possible to train to 10 marksmanship on a .22 rifle and thus be a grandmaster shotgunner.

The question was what benefit should increasing shotgun skill bring as it's not range.

@mightyagrippa

This comment has been minimized.

Copy link
Contributor

commented Aug 13, 2016

Turrets aren't especially accurate. If you have sufficient skill to snipe them you will already outclass them.

Fair point, just tested vs an antimateriel turret and took 1 leg hit out of 100 shots. Tank drones will still be an issue, their special attack ranges out to 50.

which is also the only range at which they were useful (first table from #17643)

Useless outside short range isn't de facto useless.

The preamble included a worked example as to why gun skill is irrelevant to accuracy for most skills.

Not disputing your math or your working model, I'm saying that instead of P scaling from 100 to 0 solely with marksmanship it could scale with 80% marksmanship and 20% gun skill. Or some other weighting.

The question was what benefit should increasing shotgun skill bring as it's not range.

Why not some range?

@mugling

This comment has been minimized.

Copy link
Contributor Author

commented Aug 13, 2016

Not disputing your math or your working model

Nonetheless I'm going to repeat this as it answers your question:

Start at σ=600 on the above graph (an inaccurate weapon), move left 200 units (equivalent to gaining 20 levels of marksmanship) and note that the gain in effective range is negligible. Now try starting from σ=300(a more accurate weapon). Note that marksmanship is irrelevant for everything except inaccurate weapons.

Any reply that doesn't refer to that curve is a complete rewrite of ranged weapons.

@mightyagrippa

This comment has been minimized.

Copy link
Contributor

commented Aug 13, 2016

Yes. I read that. I'll quote the initial PR:

If we change P to be dependent only upon marksmanship (in linear proportion) we can decide on the range [P0,P10] based upon Rmin and W.

I'm asking why change P to be dependent only upon marksmanship. If P = (100 - 8 * marks - 2 * gun) instead of (100 - 10 * marks) you get the same [0-100] bounds.

@mugling

This comment has been minimized.

Copy link
Contributor Author

commented Aug 13, 2016

I'm asking why change P to be dependent only upon marksmanship.

Because it would only be relevant for a rifle skill and wouldn't affect any of the other weapons yet would make reasoning about balance more complex.

If P = (100 - 8 * marks - 2 * gun) instead of (100 - 10 * marks) you get the same [0-100] bounds.

If you do the maths for that the effect of going from shotgun level 0 to 5 is a 2% increase in range.

Any reply that doesn't refer to that curve is a complete rewrite of ranged weapons.

Put your finger on the curve and move 20 units left. See what changes in range are actually possible?

This is the inherent trap of balancing without top-down design. The temptation to add a little bit of this plus a little of that doesn't result in a balanced design - just a reduction to the lowest common denominator. In our original implementation this resulted in the only effective range being 2-3 tiles.

@mugling mugling force-pushed the mugling:arc4 branch Aug 13, 2016

@PogoMarimo

This comment has been minimized.

Copy link

commented Aug 14, 2016

If we are rebalancing skill gain, it depends entirely on what factors are easy to integrate--For instance, I would integrate the "Grazing, Solid, Headshot" feedback into skill gain to simulate the varying degrees of positive feedback and success--This in place of "damage dealt". I would also integrate the difficulty of the firearm (From an aim_speed and recoil perspective) to simulate a more difficult practice circumstances allowing greater skill gain (You learn more from successfully firing a large caliber handgun than a tiny .22). This means .22 are still useful for practice (Especially in bulk practice) but a .45 will still be more insightful in skills. Lastly, especially for marksmanship, I would make skill gain a function of the distance of a successful shot--For a skilled marksman a 50 yard shot is child's play and trivial, but 400 yard practice can still reap large benefits.

And just to reiterate, Marksmanship should primarily impact longer range shots through dispersion, and Gun Skills should primarily effect recoil and aim_speed (Though some bleed over between the two is also acceptable--An 80/20 split for primary and secondary skill).

@Izicata

This comment has been minimized.

Copy link
Contributor

commented Aug 14, 2016

If I'm reading this right, you've put a hard cap on the maximum range of a weapon at 30? Why? There are guns in the game that shoot well beyond 30 tiles. They're rare, but they exist, and one of them is even craftable. Even if only high-skill mutants would be able to actually hit anything at that range, you should still be allowed to attempt the shot.

@mugling

This comment has been minimized.

Copy link
Contributor Author

commented Aug 18, 2016

There are guns in the game that shoot well beyond 30 tiles

Are there? I'd be very surprised in the old implementation if it was possible for total dispersion (σ) to be sufficiently low for that.

maximum range of a weapon at 30? Why?

See the above curve - it's impossible to balance above that that value as very small changes in dispersion result in disproportionately huge changes in range. Any weapons acting at such range require special casing and if we chose to go down that route it will definitely be a separate PR after all other issues are resolved.

@mugling mugling force-pushed the mugling:arc4 branch to b77958b Aug 18, 2016

@mugling

This comment has been minimized.

Copy link
Contributor Author

commented Aug 18, 2016

Aiming speed is now significantly affected by relevant weapon skill. The below shows the effect of going from level 0 (S4) to 4 (S5) for both marksmanship and relevant weapon skill:

train

Although both are useful more accurate weapons will benefit more from marksmanship whereas smaller weapons will benefit more from weapon skill.

Clothing encumbrance also is now more significant with S5 being an unarmored and S6 a heavilly armored player where skills and stats are otherwise equal:

clothing

With sufficient skill a heavily armored player could still make use of a pistol or SMG but aiming an accurate rifle whilst wearing plate armor is going to be far less effective.

@mugling mugling force-pushed the mugling:arc4 branch to db7c5b1 Aug 18, 2016

@mugling

This comment has been minimized.

Copy link
Contributor Author

commented Aug 18, 2016

Latest commits also support gunmods replacing (or otherwise obscuring) base gun sights via the DISABLE_SIGHTS flag. Consequentially there is now more of a trade-off between accurate and quick sights.

@mugling

This comment has been minimized.

Copy link
Contributor Author

commented Sep 11, 2016

Bursts drain focus slower

How so?

@mugling

This comment has been minimized.

Copy link
Contributor Author

commented Sep 11, 2016

Latest commit fixes the issue of installing weapon mods. You can now specify weapon and the relevant base weapon skill will be considered

@mugling

This comment has been minimized.

Copy link
Contributor Author

commented Sep 11, 2016

Backed out of damage xp scaling. Playtesting identified no problems. Launchers are kludged to train even on misses.

Ready

@mugling

This comment has been minimized.

Copy link
Contributor Author

commented Sep 12, 2016

I now have 12 open PR's of which #18020 and #18272 are the most important so marked as priority. #18020 closes a number of bugs and blocks any further work on ranged items and #18272 would allow lot of the extra items/professions PR's to then be dealt with.

@Firestorm01X2

This comment has been minimized.

Copy link
Contributor

commented Sep 12, 2016

Get it merged (c'mon), get it merged (yeah), get it merged!
Let's get it merged (ha), let's get it merged in here.
Let's get it merged (ha), let's get it merged in here.
Let's get it merged (ha), let's get it merged in here.
Let's get it merged (ha), let's get it merged in here.
Yeah!

@Coolthulhu Coolthulhu self-assigned this Sep 12, 2016

// Use different amounts of time depending on the type of gun and our skill
moves -= time_to_fire( *this, *gun.type );

practice( skill_gun, xp * ( get_skill_level( skill_gun ) + 1 ) );
if( !xp && one_in( 10 ) ) {
add_msg_if_player( m_info, _( "You'll need to aim at more distant targets to further improve your marksmanship." ) );

This comment has been minimized.

Copy link
@Coolthulhu

Coolthulhu Sep 12, 2016

Contributor

This prints even if the player aims at the edge of the bubble and fails to hit the targets.

This comment has been minimized.

Copy link
@mugling

mugling Sep 12, 2016

Author Contributor

Fixed in 6a9ac05

// First check stats
std::string fail_stat;
int min_stat;

This comment has been minimized.

Copy link
@Coolthulhu

Coolthulhu Sep 12, 2016

Contributor

Can be unitialized, causing a warning which fails the build.

This comment has been minimized.

Copy link
@mugling

mugling Sep 12, 2016

Author Contributor

Fixed in f7a1ba0

@Coolthulhu

This comment has been minimized.

Copy link
Contributor

commented Sep 12, 2016

Aim bars need fixing. Fixing them well would require redesigning them (for example, making them understand normal distribution), but a simple fix to make them feel correct would be to change the hardcoded 250 value to MIN_RECOIL (which would be better named MAX_RECOIL).

@mugling

This comment has been minimized.

Copy link
Contributor Author

commented Sep 12, 2016

Will look into that simple fix. Can you open an issue against the aiming tag for overhauling the display.

@mugling

This comment has been minimized.

Copy link
Contributor Author

commented Sep 12, 2016

Fixed

@Coolthulhu

This comment has been minimized.

Copy link
Contributor

commented Sep 12, 2016

I'm going to experimentally merge this one. But expect trouble, since it's a big change.
The slow aiming times may turn out to be tedious, in which case we'll need to adjust them until they no longer are (even if it ruins sniping).
A big problem is that now aiming generally takes enough time for the zed to close up, meaning that you aim until it's adjacent, shoot, run away for it to be at the edge of the range and repeat.

Normal distribution of shots is almost certainly good. May need small adjustments, but it looks far more sensible than linear.

@Coolthulhu Coolthulhu merged commit bc7dd31 into CleverRaven:master Sep 12, 2016

@mugling

This comment has been minimized.

Copy link
Contributor Author

commented Sep 12, 2016

A big problem is that now aiming generally takes enough time for the zed to close up, meaning that you aim until it's adjacent, shoot, run away for it to be at the edge of the range and repeat.

You can generally avoid the need to aim if you are already within the effective range. Where you do need to aim it's generally preferred to stay put once you've done this so to be able to make follow-up shots. The important parameters for adjustment are sight aim_cost and recoil. The former controls time to first shot and the latter time between followup shots.

Hand guns should take much less time than long guns to aim but have severely limited range. Play-testing is likely required to balance this further.

Normal distribution of shots is almost certainly good. May need small adjustments, but it looks far more sensible than linear.

It does seem to work a lot better.

@Coolthulhu

This comment has been minimized.

Copy link
Contributor

commented Sep 12, 2016

To fix:

  • Hand encumbrance doesn't have a note saying that it slows down aiming
  • Aim bars don't understand normal distribution
  • missed_by to tile miss is still very weird, although normal distribution improved it
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.