Range vs Accuracy: Let's improve it.

Ideas and suggestions for how to improve the Warzone 2100 base game only. Ideas for mods go in Mapping/Modding instead. Read sticky posts first!
User avatar
Stratadrake
Trained
Trained
Posts: 197
Joined: 07 Sep 2008, 09:43
Location: Pacific NW
Contact:

Re: Range vs Accuracy: Let's improve it.

Post by Stratadrake »

I'm not saying that scatter-based weapon accuracy is a "bad" thing, it is just a fundamentally different model than what WZ was and is.
Strata @dA, @FAC
iap
Trained
Trained
Posts: 244
Joined: 26 Sep 2009, 16:08

Re: Range vs Accuracy: Let's improve it.

Post by iap »

Do you think it shouldn't be changed? Does it so fundumental to the games mechanic, or is it just for historical reasons?
User avatar
Iluvalar
Regular
Regular
Posts: 1828
Joined: 02 Oct 2010, 18:44

Re: Range vs Accuracy: Let's improve it.

Post by Iluvalar »

oh god... I will just repeat...

A Gaussian scattering would tremendously affect the desirable range of the weapon depending on the target size. In such a way that a cyborg could be shot at only 4 tiles away and a factory 35 tiles away.

Even if we were deciding that it's the model we want AND that it would be something that could still be called warzone2100, No one here ever came with any kind of plan on how the stats of the game should be changed to be balanced after that scattering.

IT IS so fundamental.
Heretic 2.3 improver and proud of it.
User avatar
Stratadrake
Trained
Trained
Posts: 197
Joined: 07 Sep 2008, 09:43
Location: Pacific NW
Contact:

Re: Range vs Accuracy: Let's improve it.

Post by Stratadrake »

Agree; it's a fundamentally different accuracy model that, even if it is not particularly visible or does not feel particularly different to the end user, still would require reworking the stats on virtually everything in the game to implement.

Also, a fixed scatter angle does not support that some weapons (e.g. Lancers) are currently more accurate at long range than short, sometimes significantly.
Strata @dA, @FAC
iap
Trained
Trained
Posts: 244
Joined: 26 Sep 2009, 16:08

Re: Range vs Accuracy: Let's improve it.

Post by iap »

Ok.
I didn't look at your patch but did you try this approach and it faild?

* find the line that is perpendicular to the line between unit and target And cross the target's position
* Choose direction (left or right)
* Shot to a random dot on the line that is in that direction starting from the target location, witch is:
- greater than half unit width if miss
- less than this if hit

It's 2d but it will work. Maybe there is a greater problem I did not understand?
User avatar
Iluvalar
Regular
Regular
Posts: 1828
Joined: 02 Oct 2010, 18:44

Re: Range vs Accuracy: Let's improve it.

Post by Iluvalar »

if hit, it's better to aim for the center. Because the unit could change direction while the projectile is in the air. The projectile are fast enough to not be affected much. But if we intentionally aim the border of the units, it could have an effect.

For the remaining, I think I understand what you mean, but why having a 2d system if my patch make a functional 3d system ?
Heretic 2.3 improver and proud of it.
iap
Trained
Trained
Posts: 244
Joined: 26 Sep 2009, 16:08

Re: Range vs Accuracy: Let's improve it.

Post by iap »

I'm sorry, I did not examine your patch well enough (I'm not near my computer, it's all from my phone ), but there seems to be a debate about it. If it gives the desired results with a straight forward calculation than it's ok.

Anyway this should be a very simple calculation, but I don't think this thread is about the calculation itself... :hmm:
User avatar
Stratadrake
Trained
Trained
Posts: 197
Joined: 07 Sep 2008, 09:43
Location: Pacific NW
Contact:

Re: Range vs Accuracy: Let's improve it.

Post by Stratadrake »

I want to perform an experiment on the current 3.1 beta 11 like the following:

1 - Mod a unit that will have exactly 101 HP.
2 - Mod a weapon that inflicts 0 firepower with a 100 shot salvo. (Thus it always inflicts the minimum 1 pt. damage).
2a - Give it about 50% accuracy, more or less, with equal values at short/long ranges.
3 - Unload full salvo onto unit. Damage % after salvo -> actual weapon's accuracy.
4 - Check whether this matches the stated accuracy (on Design screen or weapons.txt). If it varies significantly then we have undeniable proof of an accuracy bug.
if hit, it's better to aim for the center.
On the other hand it is a little more consistent to apply a scatter to both hits and misses alike. Hit = scatter inside hitbox, miss = scatter outside hitbox.

Another idea: When aiming 'miss' projectiles, make the 'worst' shot deviation proportional to how badly the diceroll failed.

So instead of:

Code: Select all

int rand = gameRand(100);

 bool is_hit = rand <= resultHitChance;

   if (is_hit)
   {
...
You could have:

Code: Select all

/* Roll the dice and compare to accuracy value */
int is_hit = resultHitChance - gameRand(100);

if (is_hit >= 0)
{
/* BANG! It's a hit */
...
}
else
/* Miss... */
/* Worst miss distance is derived from the rolled dice value.  Actual miss distance is randomly selected from that range */
int missDistance = minOffset + gameRand(-is_hit);
(aside: Autocensors create interesting results with variable naming conventions)

This also biases missed shot locations in favor of near-misses (quadratically in fact), but without needing to do any flops. E.g. for any given weapon accuracy a miss can be up to (100 - accuracy) outside hitbox, but the actual miss distance per shot is randomly selected from this range. So if the diceroll missed by 5 (e.g. any weapon with 95% or less accuracy) the shot is a near miss; if the diceroll missed by 60 (e.g. only weapons with 40% or less accuracy), it can be a wide miss or it could be another near miss (this is chosen randomly).

And can somebody get the cat off my keyboard.
Strata @dA, @FAC
User avatar
Iluvalar
Regular
Regular
Posts: 1828
Joined: 02 Oct 2010, 18:44

Re: Range vs Accuracy: Let's improve it.

Post by Iluvalar »

Reusing the same dice roll was my first idea. But it have no impact in the game at all, beside giving me less fine grain to determine were the projectile land. Because of my scattering function (x^3) there were more projectile at the worstShot distance.

for instance, if a projectile have 80% chance to hit, and I base the miss distance on the 20% remaining, there would be 1/20 of the projectile at the worst distance. While if I do another random roll with 100, I will have a wide 1/100 grain. That's not a big deal because at that point, nobody know how much the shot was missed anyway...
Heretic 2.3 improver and proud of it.
User avatar
Stratadrake
Trained
Trained
Posts: 197
Joined: 07 Sep 2008, 09:43
Location: Pacific NW
Contact:

Re: Range vs Accuracy: Let's improve it.

Post by Stratadrake »

Reusing the same dice roll was my first idea. But it have no impact in the game at all, beside giving me less fine grain to determine were the projectile land.
The only problem with that is the linear distribution between "near miss" and "worst shot". My suggested idea rolls a second random value based on the outcome of the first one to determine where the actual shot scatters, resulting in a (x^2) scatter. E.g:

Your (old) version:
scatter_per_shot = minimum_distance + random(0, miss)

My version:
scatter_per_shot = minimum_distance + random(0, random(0, miss))

So if I have an accuracy 70% and I rolled an 80, that shot scatters by random(0, 10). If I rolled a 90, the shot scatters by random(0,20). Either shot can land between (0-10) off target, but only the latter shot (where the diceroll missed by a larger factor) can land between (10-20) off target. No shot from this weapon can ever land more than (30) off target because the weapon only misses 30% of the time. A weapon with lower base accuracy can scatter shots farther away from the target, and longer range always means more scatter for any weapon (which is why I didn't put unit labels onto the scatter values), but will still tend to favor near misses.
Strata @dA, @FAC
User avatar
JJjopando
Rookie
Rookie
Posts: 26
Joined: 17 Jul 2012, 17:20
Location: Akron, OH

Re: Range vs Accuracy: Let's improve it.

Post by JJjopando »

Stratadrake, how does your suggestion differ qualitatively from a Gaussian distribution?
Proud former soldier of the 39th Infantry
BATTLE OF THE PLAIN OF REEDS - WE WILL NOT FORGET
User avatar
Iluvalar
Regular
Regular
Posts: 1828
Joined: 02 Oct 2010, 18:44

Re: Range vs Accuracy: Let's improve it.

Post by Iluvalar »

We are talking about gaussian distribution only for the misses. So the balance for the hit is conserved while we look as much realistic as possible.

Stratadrake:
First I had :

scatter_per_shot = minimum_distance + rand(miss)^2 * dist (dont forget dist for the angular effect)

But then I found that rand(miss)^3 on a wider worst area was looking even better. With some very rare hugly misses.

But then i found that an high accuracy was causing rounding error. So I finaly chose to use rand(100)^3/100^3*miss. For all we care, it's the same thing...
Heretic 2.3 improver and proud of it.
Post Reply