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 max range is capped #18299

Closed
Coolthulhu opened this issue Sep 12, 2016 · 25 comments

Comments

Projects
8 participants
@Coolthulhu
Copy link
Contributor

commented Sep 12, 2016

Known and all, but I'm just leaving it out as a reminder that arbitrary hard cap isn't the right way to do it.
A reality bubble cap is necessary, 30 tiles cap isn't.

Ideas:

  • Add a deterministic penalty that scales with range. Essentially a cap on accuracy. If high, it would prevent getting hits near cap. If low, it could still allow guaranteed headshots for overpowered characters.
  • Add a hard low cap on dispersion.
  • Revise dispersion calculations to prevent near-0 dispersion guns naturally, then nerf all 0 dispersion guns and give them something sensible. Most important parts would be to add some "soft cap" on json dispersion (as in adding a note that "not even futuristic guns should have less than 60 dispersion") and then revising how gunmods affect dispersion. Most likely by making gunmods apply multipliers rather than additions/subtractions. Would also require getting rid (or nerfing) of "accurizing".
  • Some range-dependent special case. For example, dispersion penalty that is 0 until soft range cap and then rises with range.
  • Generate missed_by with a normal distribution rng.

@mugling mugling added the Aiming label Sep 12, 2016

@mugling

This comment has been minimized.

Copy link
Contributor

commented Sep 12, 2016

Also the interface - finding targets at that distance could get painful

@Coolthulhu

This comment has been minimized.

Copy link
Contributor Author

commented Sep 12, 2016

Interface isn't really a big problem for as long as we have target cycling.
If it is, we could also add a *band style targeting, where pressing "right" picks the nearest target within 45 degree cone pointing directly right and ditto for other 7 directions. This is really useful when changing targets a lot. For example, ToME has it and there's quite a bit of re-targeting in it.
Aiming at ground or allies requires special cases - either new keybinds (shift+dir) or aiming mode switch - but it's not used that often.

@mugling

This comment has been minimized.

Copy link
Contributor

commented Sep 12, 2016

Generate missed_by with a normal distribution rng.

This is an interesting idea, but how?

@Coolthulhu

This comment has been minimized.

Copy link
Contributor Author

commented Sep 12, 2016

Current algorithm is like this:

  • Calc dispersion
  • rng_normal( 0, dispersion )
  • Convert to MoA
  • missed_by = sqrt( 2 * pow( distance, 2 ) * ( 1 - cos( dispersion ) ) )

New one would go like this:

  • Calc dispersion
  • Convert to MoA
  • max_missed_by = sqrt( 2 * pow( distance, 2 ) * ( 1 - cos( dispersion ) ) )
  • Grab a number from N( 0, max_missed_by / 2 ) (similar to rng_normal( 0, max_missed_by * 2 ), I think)
  • abs it

The difference would be that the "normalization" would be done on the missed distance rather than the angle. As a result, the misses would be much less "square".
At the moment you can see that while all hits are perfect lines, the near-misses still manage to strike as much as half the distance from the target. Check it out with an antimateriel turret at capped range - it will fire 10 shots directly into you @, then fire one 5 tiles from you.
If distance missed was normal, it would result in less perfect hits (since low numbers differ less when squared) and more sensible near misses (since huge misses would be normalized out).

@DangerNoodle

This comment has been minimized.

Copy link
Contributor

commented Sep 17, 2016

What led to the 30-tile cap, exactly? I recall that before there was no cap, the only constraint was the reality bubble on paper (and in practice, the visual range even in broad daylight).

@mugling

This comment has been minimized.

Copy link
Contributor

commented Sep 17, 2016

@DangerNoodle see the vertical part of the curve in the original PR

@DangerNoodle

This comment has been minimized.

Copy link
Contributor

commented Sep 17, 2016

I see. Peculiar.

@mugling

This comment has been minimized.

Copy link
Contributor

commented Sep 17, 2016

I think @Coolthulhu gave a better summary of the problem elsewhere. In short we need to rework the curve but that's a very math heavy job. Removing the cap doesn't fix the problem it just adds a further one.

@DangerNoodle

This comment has been minimized.

Copy link
Contributor

commented Sep 17, 2016

Understandable, in that case. I would not be certain of how to resolve the math either.

@Coolthulhu

This comment has been minimized.

Copy link
Contributor Author

commented Sep 17, 2016

Removing the cap doesn't fix the problem it just adds a further one.

It does fix it, just that it adds a new one afterwards.

@mugling

This comment has been minimized.

Copy link
Contributor

commented Sep 17, 2016

The rough plan I have in mind is resolve recoil and then go back on to that unless @Coolthulhu feels particularly keen for the math first?

@Coolthulhu

This comment has been minimized.

Copy link
Contributor Author

commented Sep 17, 2016

Recoil and range don't depend on each other too much.
Though if range solving would involve changing the miss math (for example, to normal distribution), it would be a good idea to get it in before recoil changes, as it will affect how bursts look like.

@mugling

This comment has been minimized.

Copy link
Contributor

commented Sep 17, 2016

I'm a long way along with recoil so I'd prefer to finish that unless you have something ready?

@Firestorm01X2

This comment has been minimized.

Copy link
Contributor

commented Jan 24, 2017

I think it should count as milestone for 0.D .

Maybe it is better to go for easy solution and add a hard low cap on dispersion?

@Coolthulhu Coolthulhu added this to the 0.D milestone Jan 24, 2017

@Barhandar

This comment has been minimized.

Copy link
Contributor

commented Jan 30, 2017

"not even futuristic guns should have less than 60 dispersion"

Lasers at in-game distances effectively have no innate dispersion and their sight dispersion is more the fact that humans cannot stay perfectly still. If you're going to do a low hardcap on dispersion, please write the note in a way that states you're doing it for balance reasons specifically.

Or don't do hardcaps on gun stats, just softcaps that require advanced tech to overcome. Someone with fully bionic arms and spine ought to have advanced stabilization algorithms to eliminate sway. That, or just add a huge mutated chicken and tie the gun to its head.

@Coolthulhu

This comment has been minimized.

Copy link
Contributor Author

commented Jan 30, 2017

Someone with fully bionic arms and spine ought to have advanced stabilization algorithms to eliminate sway.

Sway is just one component of dispersion. There are others, not so easily compensated for, such as barrel vibration, requiring essentially per-ammo-type accurizing to fully overcome.

As for lasers: we could keep those hardcapped on range with handwave explanation like "blooming" or "loses focus". This would make them different to ordinary guns by giving them low range, but amazing accuracy within that range.

@Firestorm01X2

This comment has been minimized.

Copy link
Contributor

commented Jan 30, 2017

Sway is just one component of dispersion. There are others, not so easily compensated for, such as barrel vibration, requiring essentially per-ammo-type accurizing to fully overcome.

As for lasers: we could keep those hardcapped on range with handwave explanation like "blooming" or "loses focus". This would make them different to ordinary guns by giving them low range, but amazing accuracy within that range.

In that way it can be done with:

  1. Setting MAX RANGE to 60
  2. Editing JSONs of laser weapons

Maybe setting hard cap on dispersion even not necessary in that case.
Simple and clear.

Also there is one more thing. Complex solution may be not worth it at all in that case. If I understand it right - we are going to dance around 10% or less of chance to hit for end game sniper just to make it less than 100%. If that is the case then it is definitely not worth it.

@kevingranade

This comment has been minimized.

Copy link
Member

commented Jan 30, 2017

@Coolthulhu

This comment has been minimized.

Copy link
Contributor Author

commented Jan 30, 2017

My proposed end goal for handling the gap between irl ranges and in game ranges is to express all item properties as actual irl MoA

Wiki says that 20 MoA is the upper bound for self defense handguns. 20 MoA at distance 60 (say, tiles) is ~0.35. So any handgun which would barely qualify for self-defense would count as amazing sniper rifle in game.
So it's basically just the scaling factor here, which means it's just another arbitrary tweak saving the day, with IRL data being just another problem to solve with said factor.

@BorkBorkGoesTheCode

This comment has been minimized.

Copy link
Contributor

commented Jan 30, 2017

Sounds like the grazing hit system needs to be updated to handle sup-tile accuracy.

@Coolthulhu

This comment has been minimized.

Copy link
Contributor Author

commented Jan 30, 2017

It has sub-tile accuracy. All the problems would be much worse if it didn't.

@Varghus

This comment has been minimized.

Copy link

commented Feb 3, 2017

1 Minute of angle is 1"of dispersion at 100 yards and 10" at 1000 yards. 6 MOA at 100 yards is considered "minute of bad guy" any more than that is missing a 12" silhouette more than hitting.

@Coolthulhu

This comment has been minimized.

Copy link
Contributor Author

commented Feb 7, 2017

I tried to fix it, but I encountered a problem and needed to close:
If we want gun dispersion to depend on range, the "maximum range for given accuracy" function gets rather complex. It would need to be iterative, because at any given time we need current range to calculate effective range.
Unless we exposed the formula to the function. But that would require maintaining forward and inverted versions of the same formula, so it would be good to avoid it.

@kevingranade kevingranade added this to Blockers in 0.D Release Mar 2, 2017

@kevingranade

This comment has been minimized.

Copy link
Member

commented Mar 4, 2017

Random size note, @Varghus is correct, I added an extra 0.

We don't need a "maximum range for given accuracy" function in the game code, just in a unit test situation or similar (though that sucks because of the random element, so run a bunch of trials...). The ideal is to scale dispersion such that shorter-ranged firearms will be effectively useless beyond their intended effective range, then you don't need to do anything funny, it's just trig.

The only difference between my proposal and @Coolthulhu's various dispersion capping proposals is we don't have guns with nonsense stats in the json, just one documented method somewhere that converts from "irl dispersion" to "in game dispersion". Also if we do something that extends effective maximum range (such as expanding the reality bubble or allowing weapons to fire at targets outside the reality bubble), we only need to adjust one thing to ratchet up everythings' effective range to match the new game-imposed maximum range. Also it makes things like comparing thrown weapon dispersion with firearm dispersion easier, we have rough real-world stats on both and we want them to agree with each other, at least proportionally.

@Coolthulhu

This comment has been minimized.

Copy link
Contributor Author

commented Mar 5, 2017

We don't need a "maximum range for given accuracy" function in the game code

It's really useful to avoid having the game get spoiler-heavy. Ranged combat system is rather complex and depends a lot on player knowledge (rather than character knowledge) to properly optimize.
By giving the player an option to preview an approximation of accuracy, the knowledge of game mechanics becomes less important.

I'd rather keep the function until it's obvious there is no good way around removing it.

@Coolthulhu Coolthulhu moved this from Blockers to In Progress Blockers in 0.D Release Mar 16, 2017

@Coolthulhu Coolthulhu moved this from In Progress Blockers to Closed Blockers in 0.D Release Mar 21, 2017

@kevingranade kevingranade removed this from Closed Blockers in 0.D Release Apr 15, 2017

@kevingranade kevingranade added this to Closed Issues in 0.D Release Aug 21, 2018

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.