OpenXcom Forum

OpenXcom => Suggestions => Topic started by: Solarius Scorch on November 29, 2017, 11:58:32 pm

Title: UFO Extender accuracy discussion
Post by: Solarius Scorch on November 29, 2017, 11:58:32 pm
I don't use UFOExtender accuracy, so it's just using the default values.  I should probably update it because it seems to be a fairly popular add-on.

Can I ask why not? It's like not using multiple map levels... Why not have an accuracy penalty for longer distances?

I'm asking because it's not a "fairly popular add-on", you are literally the only person I know of who doesn't use UFO Extender Accuracy. It's just so weird, so I suppose there is some reason behind it?
Title: Re: UFO Extender accuracy discussion
Post by: chaosshade on November 30, 2017, 02:09:59 am
*snip*
I'm asking because it's not a "fairly popular add-on", you are literally the only person I know of who doesn't use UFO Extender Accuracy. It's just so weird, so I suppose there is some reason behind it?

Vanilla feel.  As much as I love modding OXC until it gets unstable, I'm trying to keep as much of the vanilla "feel" as possible.  I am aware that some of the things I do, some of the mods I have, and nearly all the mods I've written, absolutely demolish the laws of vanilla, but we're each playing our own way, right?

Also might explain why I find the game easier on Superhuman than I do on Beginner...
Title: Re: UFO Extender accuracy discussion
Post by: The Reaver of Darkness on November 30, 2017, 06:24:52 am
I'm asking because it's not a "fairly popular add-on", you are literally the only person I know of who doesn't use UFO Extender Accuracy. It's just so weird, so I suppose there is some reason behind it?
I don't use it and I've said before that I don't like it. It doesn't increase accuracy at shorter ranges, only decreases it at longer ranges. While I do feel accuracy should go down at longer ranges, my (much) larger concern is that it doesn't significantly improve at close range until you're no more than 1 tile away from an enemy, and even then the number of missed shots is ridiculous. Even diagonally adjacent, soldiers with poor accuracy often miss.

If UFO Extender Accuracy would address this problem in some way, I would use it. If not, I don't need it.
Title: Re: UFO Extender accuracy discussion
Post by: Solarius Scorch on November 30, 2017, 12:02:05 pm
Thanks for the feedback! I was hoping to provoke this sort of discussion, because it's something I have actually wanted to discuss. Sorry for using your thread Shade, I will separate it.

Reaver, how would you suggest this should work? Drop accuracy from tile 1 instead of a certain breaking point (normally 9 for auto etc.)? And increase overall accuracy to compensate, of course.
Title: Re: UFO Extender accuracy discussion
Post by: The Reaver of Darkness on November 30, 2017, 12:51:17 pm
I've thought that if I set all weapons to have about the same accuracy for every shot, and simply alter their range values, I could likely get good field numbers. The problem would be the misleading numbers in the UI. Players will be confused as to why their auto shot has the same accuracy as their aimed shot.


What I would do is have an optimal range, and at that range you get the listed accuracy. You just do OR/TR to get your final accuracy modifier, where OR is optimal range and TR is target range.[/i]
Title: Re: UFO Extender accuracy discussion
Post by: Meridian on December 21, 2017, 12:13:48 pm
It doesn't increase accuracy at shorter ranges, only decreases it at longer ranges. While I do feel accuracy should go down at longer ranges, my (much) larger concern is that it doesn't significantly improve at close range until you're no more than 1 tile away from an enemy, and even then the number of missed shots is ridiculous. Even diagonally adjacent, soldiers with poor accuracy often miss.

If UFO Extender Accuracy would address this problem in some way, I would use it. If not, I don't need it.

I COMPLETELY agree... accuracy should go up at close range.... and be a guaranteed hit at 1 tile range.
Unfortunately, many people don't share our opinion.
Title: Re: UFO Extender accuracy discussion
Post by: Solarius Scorch on December 21, 2017, 12:35:02 pm
Shooting point blank (from 1 tile away) is a special case. Thinking you can walk up to a combat ready enemy, put your rifle to their head and hit them with 100% chance is beyond silly and I'm sure we all understand it...

But the issue here is with a bit longer distances, like 3 or 7 tiles. I have no strong opinion on this, except that it probably relies on the weapon.
Title: Re: UFO Extender accuracy discussion
Post by: Meridian on December 21, 2017, 02:34:08 pm
Shooting point blank (from 1 tile away) is a special case. Thinking you can walk up to a combat ready enemy, put your rifle to their head and hit them with 100% chance is beyond silly and I'm sure we all understand it...

No, I don't.
I think it's beyond silly that you cannot do that (unless you have a 3 ton 15-century naval cannon in your hand).
I have listed the reasons many times, I won't repeat myself.
Title: Re: UFO Extender accuracy discussion
Post by: Solarius Scorch on December 21, 2017, 02:45:11 pm
I have no martial training, but I'm still fairly sure I'd have pretty good chance to grab the rifle, deflect the rifle or sidestep it. Like any other person in combat situation.
Would I bet my life on this? Of course not. And if the attacker misses the first time, the second or third would do the job. But still, I am untrained and generally in bad shape.
Can you reiterate your counter-argument, Meridian? Because I honestly don't get your point. Where are you coming from?
Title: Re: UFO Extender accuracy discussion
Post by: Meridian on December 21, 2017, 03:30:08 pm
I have no martial training, but I'm still fairly sure I'd have pretty good chance to grab the rifle, deflect the rifle or sidestep it. Like any other person in combat situation.
Would I bet my life on this? Of course not. And if the attacker misses the first time, the second or third would do the job. But still, I am untrained and generally in bad shape.
Can you reiterate your counter-argument, Meridian? Because I honestly don't get your point. Where are you coming from?

1. I am 10 meters away from you
2. I have a pistol in my hand
3. I raise my hand and start (roughly) aiming at you
4. I start walking closer to you while constantly aiming at you (and improving the aim and closing the distance at the same time)
... my chances to hit you go up exponentially
5. just before I am at arm's distance away from you (=1 tile), I fire
... because I have never used a gun (and it will probably be still locked or something), my chances of hitting you are 0%... but any trained soldier's chance to hit you is 99.99999999%
Title: Re: UFO Extender accuracy discussion
Post by: Solarius Scorch on December 21, 2017, 03:48:48 pm
Yeah, I understand your point and I agree. However, this is only one of many scenarios on how a unit finds itself in melee combat range - when going around the corner, or falling from a higher level, or because the units are already engaged in close combat, etc. Since the engine is a simplification anyway, I just think CQC is a more versatile approach, and also (as a bonus) more "cinematic".
Title: Re: UFO Extender accuracy discussion
Post by: The Reaver of Darkness on December 21, 2017, 10:51:17 pm
If you're talking about being close enough for them to knock the weapon away from you, then sure, you lose accuracy if and only if they disrupt your weapon. It quickly drops from a nearly certain hit to none at all if the disrupt is successful. But if you were just a few cm further, and out of reach, you're going to hit most likely.

What isn't debateable is that accuracy improves as range to target decreases. If you want to talk realism, accuracy at sufficiently short ranges (instant hit, no drift) is a function of angular size, angular velocity, and short term changes in angular velocity. Someone with good aim can defeat the angular velocity itself, meaning the only factors that matter are range to target and the target's ability to perform evasive maneuvers. You can write the latter in as a unit defense attribute, the former fits exactly what we're talking about. The angular velocity factor is unimportant as it is more complex to simulate (especially in a turn-based game) and it is suitably covered by having soldier accuracy attribute in the first place.

There's nothing wrong with allowing a soldier to hit every time when they are adjacent to the target. It's a reasonable compromise for the much more important and very realistic situation in which you almost always hit at 1 tile away. And if someone is REALLY bothered by this, they can write their own mod to perform weapon disruption attacks on reactions.
Title: Re: UFO Extender accuracy discussion
Post by: Zyzyfer on December 30, 2017, 12:46:06 pm
I also find that on the higher difficulty (on the mod I play), attempting to get 1 square to targets often gets you picked off and killed. So its actually quite risky. So if you do manage it why not reap the reward of 99.9% accuracy of point-blank range; its actually quite realistic.
Title: Re: UFO Extender accuracy discussion
Post by: Starving Poet on January 25, 2018, 05:19:44 am
Just stand 2 tiles away.  98% accuracy instead of 99 and immune to melee counters.  If you don't kill them, take 1 step forward and disrupt their attacks next turn.

Sent from my LG-H872 using Tapatalk

Title: Re: UFO Extender accuracy discussion
Post by: The Reaver of Darkness on February 01, 2018, 02:56:14 am
Unfortunately a soldier at 1 tile distance from the target will still miss around half as often as they will from opposite ends of the map.


I ran a test using a shot with a 30% listed chance to hit. Here are the results:
orthogonally adjacent: 98% hit
1 tile away orthogonal: 73% hit
1 tile away orthogonal + 1 tile up: 64% hit
diagonally adjacent: 99% hit
diagonally adjacent + 1 tile up: 53% hit
1 tile away diagonal: 72% hit


What you can see here is that being truly adjacent to the target makes it hard to miss, but being just one square distant from the target gives the soldier a very substantial capacity to miss. Being a tile higher increases this further. If the soldier is a tile higher yet still adjacent to the target, they can miss a lot. Being above or diagonal to the target can reduce accuracy even faster than distance will. My highest miss rate was while adjacent to the target.

I tried again at 2 tiles away (2 tiles between soldier and target) and hit 52%. The result was about the same as diagonal+up yet adjacent, leading me to believe that the soldier being 3 taxicab moves away from the target in both cases is more important to hit chance than the actual euclidean distance. I feel like I'm probably wrong, but my results have generally correlated accuracy with taxicab distance, not euclidean distance. Something funny is going on here.
Title: Re: UFO Extender accuracy discussion
Post by: ohartenstein23 on February 01, 2018, 03:11:54 am
That's because the 'distance' X-Com uses for determining angular deviation from a target isn't quite Euclidean; taxicab was a good guess, but it isn't quite that either. There is some X/Y non-uniformity (because thus it is commanded (https://github.com/SupSuper/OpenXcom/blob/master/src/Battlescape/Projectile.cpp#L375)), and strange things go on with height distance too.
Title: Re: UFO Extender accuracy discussion
Post by: The Reaver of Darkness on February 01, 2018, 12:02:35 pm
Interesting. Well, we need to be able to make accuracy go up a lot at short range, not only adjacent range. This non-uniformity may be extreme now, but with a decent accuracy system (such as optimal range/target range) it would be negligible and there wouldn't be any cases in which it affects gameplay so significantly. A 30% shot with 2 squares to target should hit almost every time. Even just pointing the weapon in the target's general direction will score hits at that range. But 30% accuracy actually shows a decent amount of aiming. This soldier will hit about 30% of long-range shots with an open line of fire.
Title: Re: UFO Extender accuracy discussion
Post by: darkestaxe on February 04, 2018, 05:26:13 am
I'd calculate it like:
Actual_Shot_Accuracy = ((Soldier_Firing_Accuracy/100) * Weapon_ShotType_Accuracy) * (Weapon_ShotType_Optimal_Range / Distance_To_Target)

For example, a soldier with 60 firing accuracy fires a snap shot using a Rifle at 10 squares from his target, where a rifle has 60% snap shot accuracy and snap shots have a default 15 square optimal range.

0.54 = (60/100 * 0.6) * (15 / 10)
or 54% accuracy

I think this would be a much better implementation of range based accuracy, but the default for aimRange should be changed from 200 to 30, or aimed shots will have extremely high accuracy.
Title: Re: UFO Extender accuracy discussion
Post by: Lagi on February 08, 2018, 04:02:32 pm
I would like very much increase accuracy at short range!

darkestaxe math looks sensible.

Could the formula include obstacles on the Line of Fire?

I would prefer drop of accuracy at the point blank, to give niche for melee attacks. 2 tiles away 95% sounds rad.
Title: Re: UFO Extender accuracy discussion
Post by: The Reaver of Darkness on February 09, 2018, 03:16:57 am
It's actually my math. I got darkestaxe to write it in pseudocode for me.


Could the formula include obstacles on the Line of Fire?

I would prefer drop of accuracy at the point blank, to give niche for melee attacks. 2 tiles away 95% sounds rad.
The game already includes obstacles in the calculation. My equation is supposed to determine the accuracy value given as the shot is made, just like how the UFO Extender Accuracy works. It'll display roughly your chance to hit if you have an open shot. It's up to you to see that your shot is partly occluded and recognize that your actual chance to hit may be lower.


As for accuracy drop at shorter range, I would like to see the effect be an option you can add to your mod. UFO Extender Accuracy has a minimum range setting, the way it works is that anything between minimum and dropoff has max accuracy, while anything over or under has gradually reduced accuracy based on distance. As my calculation is very different, I should develop an equation for a minimum accuracy function.

My initial thought is to set an optimal close range, and if such a range is set then as target gets closer, accuracy increases only until optimal far range, stays the same from optimal far to optimal close, and goes down from optimal close, reaching zero at zero squares distance (being in the same tile). So then the calculation for the accuracy reduction would be: (TR/OCR)*BSA
TR = Target Range
OCR = Optimal Close Range
BSA = Base Shot Accuracy

So for example, we have a rifle with a snap shot optimal far range of 15 tiles while its optimal close range is 3 tiles. The soldier using this weapon has 60 accuracy and the rifle's snap shot accuracy is 60%. Here's the accuracy at different ranges:
1 tile: 12%
2 tiles: 24%
3 tiles: 36%
5 tiles: 36%
7 tiles: 36%
10 tiles: 36%
15 tiles: 36%
20 tiles: 27%
30 tiles: 18%
45 tiles: 12%

You'll note that the accuracy reaches 36% in a certain range and levels off. An alternative method would be to have accuracy continue to increase as target range decreases, until the halfway point between optimal far and optimal close range at which point it switches to the other calculation and makes accuracy begin to decrease. The halfway point isn't necessarily the median between the two but rather the point at which both calculations reach the same value. In this case, it is ~6.7082 tiles, which you can find by getting the square root of the far divided by the close, and multiply the result by the far range. 15 / 3 = 5, (sqrt)5 = ~2.2361, ~2.2361 * 3 = ~6.7082. Essentially you're just running both calculations and taking the smaller of your two resulting accuracy values. Here's how it would play out:

1 tile: 12%
2 tiles: 24%
3 tiles: 36%
5 tiles: 60%
7 tiles: 77%
10 tiles: 54%
15 tiles: 36%
20 tiles: 27%
30 tiles: 18%
45 tiles: 12%

As you can see, this change only affects values between 3 and 15 tiles. With this equation, the accuracy peaks at around 6 to 7 tiles distance to target.
Title: Re: UFO Extender accuracy discussion
Post by: heu3becteh on June 08, 2018, 04:20:54 pm
I like the UFO Extender accuracy as it makes sense to use something other that Auto-shot, while without it Aimed and Snap are rarely useful.

The problem I want to adress is how the % to hit affects the cone at which soldier can fire upon, and particularly how he can fire almost at whatever (even at his comrades standing at adjacent tiles left and right, maybe even behind him?) when he has 0% to hit, it looks quite stupid, to extend of being ridiculous. And defies common sense - if your target is located further, you are more likely to shot at completely another angle, wasting your buddy standing beside you.

There is a solution to never fire with 0% chance, but that is just workaround. May it be possible to make it look reasonable? Sometimes it can be useful to just destroy all cover enemy has with Auto-fire, but with 0% accuracy you will just wipe out your team.

As I understood here (https://openxcom.org/forum/index.php?topic=1856.0), the calculation goes like that:
1. RNG decides is it a hit or is it a miss.
2. If it is a hit - shot flies straight at the target and hits.
    If it is a miss - shot flies by some traectory inside a cone (which depends on accuracy), and the trajectory inside this cone is selected based on the normal distribution. That trajectory can pass through your target too, making it a hit.

That means that when you use fire with 0% accuracy, you go straight to the point 2, and fire at some trajectory inside of a cone.

Based on that, my question: is it possible to affect % to hit with UFO Extender accuracy option on, but do not affect the cone, inside which trajectory of a miss is selected?
So that this option affects point 1, but does not affect point 2. I think that makes sense.

Best regards.
Title: Re: UFO Extender accuracy discussion
Post by: The Reaver of Darkness on June 09, 2018, 05:32:08 am
My equation actually solves both of the problems you listed.

 * As accuracy diminishes beyond optimal range, and optimal range can be set by the individual shot on each weapon, different shots will be ideal at different ranges, same as with UFOExtender Accuracy.

The game has a very wide maximum shot angle. I think it should be narrowed, but it primarily shows problems when listed chance to hit is very low. If the player is given options which help to avoid being forced into tiny chances to hit, then wide shots like that won't be as common.

 * In UFOExtender Accuracy, your shot's accuracy diminishes at a steady rate, and suddenly reaches zero at some point. My equation fixes this by offering a diminishing return on accuracy with distance. As distance increases and accuracy decreases, the rate of decrease also decreases, such that the chance to hit approaches zero without ever reaching it. This means that an auto shot at 15 squares might say 2% chance to hit, and the same shot at 30 squares might say 1% chance to hit. This equation would allow aimed shots to have a reasonable range like 20 perhaps without suffering the same problems of being unable to hit targets just because they are too far away.

Example: We have a soldier with 70 accuracy using a weapon in which the aimed shot has an optimal range of 20 and an accuracy of 120. The base accuracy (at 20 squares) is 84%. Here's accuracy at longer distances on the battlefield:
30: 56%
40: 42%
50: 34%
60: 28%
No matter how far away you get, the shot can still hit the target and won't go insanely wide.

Here's the same values with UFOExtender Accuracy (if I calculated it correctly in my head):
30: 64%
40: 44%
50: 24%
60: 4%
This is why UFOExtender Accuracy cheats and sets aimed shot range to 200.
Title: Re: UFO Extender accuracy discussion
Post by: Meridian on June 09, 2018, 10:01:30 am
This is why UFOExtender Accuracy cheats and sets aimed shot range to 200.

UFOExtender doesn't cheat... aimed shot range is 200 also without it... and can be modded if you want.
Title: Re: UFO Extender accuracy discussion
Post by: Starving Poet on June 09, 2018, 04:23:53 pm
As I understood here (https://openxcom.org/forum/index.php?topic=1856.0), the calculation goes like that:
1. RNG decides is it a hit or is it a miss.
2. If it is a hit - shot flies straight at the target and hits.
    If it is a miss - shot flies by some traectory inside a cone (which depends on accuracy), and the trajectory inside this cone is selected based on the normal distribution. That trajectory can pass through your target too, making it a hit.

Read the first reply on that thread - thats exactly how it doesn't work.
Title: Re: UFO Extender accuracy discussion
Post by: The Reaver of Darkness on June 09, 2018, 11:11:27 pm
UFOExtender doesn't cheat... aimed shot range is 200 also without it... and can be modded if you want.
What do you mean? Before UFOExtender Accuracy there wasn't a range factor for accuracy. Individual weapons may have had a range, but that's a strict limit on how far the projectile can travel. The 200 range for aimed shots is there for accuracy calculations using UFOExtender's system.
Title: Re: UFO Extender accuracy discussion
Post by: heu3becteh on June 12, 2018, 11:57:30 pm
Read the first reply on that thread - thats exactly how it doesn't work.
Can you please clarify how does it work then?
I have read all the topic, not only the first reply, and I did understand that reply (https://openxcom.org/forum/index.php/topic,1856.msg17369.html#msg17369) the way I described.
The first reply (https://openxcom.org/forum/index.php/topic,1856.msg17360.html#msg17360) can imply that there is no 1 step, and the trajectory is just calculated from the beginning without any RNG.

If the game does calculate the trajectiry right away, it is possible to make 0% cone not as crazy as it is now by making it the same as with vanilla accuracy, but changing the distribution properties (which decide to which part of a cone the projectile will more likely to fly) with range. Can that be done?
Title: Re: UFO Extender accuracy discussion
Post by: lx_ufoforum on January 11, 2019, 08:45:06 pm
im making a translation and i need to know if this affects aliens so i can put it in the description text.

and i think that no amount of changes will make a chance based system right.
answer a question: will those soldiers rely on luck(chance) to hit?
if i was one of them, i would not. its all a matter of many circumstances and they can not be simulated by a general purpose random number generator.
forget that someone once upon a time created a flawed system and think how would you simulate whats going on on the battlefield.

have you played frontline tactics? every shot is a hit(no cth bs). and that does not make the game any worse than x-com as a tactical turn based game with firearms combat(atleast for me).
answer my first line ;)
Title: Re: UFO Extender accuracy discussion
Post by: Meridian on January 11, 2019, 10:12:07 pm
im making a translation and i need to know if this affects aliens so i can put it in the description text.

yes, this affects also aliens and civilians
Title: Re: UFO Extender accuracy discussion
Post by: Abyss on January 20, 2019, 08:41:16 pm
That's quite a topic I was thinking of all the time when 0% hit chance resulted into the crazy cone of projectiles distribution. I believe that shot trajectory should be at least at the target's position unless it's broke with enemy nearby.   

Is it possible that megamods will include the Fire Extender modification in default to turn on? XCF and Piratez have no option in the mods setup.
Title: Re: UFO Extender accuracy discussion
Post by: Meridian on January 20, 2019, 08:54:08 pm
Is it possible that megamods will include the Fire Extender modification in default to turn on? XCF and Piratez have no option in the mods setup.

Both Piratez and XCF have this option turned on.
Title: Re: UFO Extender accuracy discussion
Post by: Abyss on January 21, 2019, 02:17:03 am
Both Piratez and XCF have this option turned on.

Ok. That's cool.