aliens

Author Topic: [FIXED] lowAccuracyHitCounter [OXC]  (Read 1721 times)

Offline Delian

  • Colonel
  • ****
  • Posts: 228
    • View Profile
[FIXED] lowAccuracyHitCounter [OXC]
« on: September 06, 2020, 10:27:27 pm »
There is a soldier statistic called lowAccuracyHitCounter that is used for commendations. It doesn't seem to work.

I've checked the code in ProjectileFlyBState.cpp, and it looks like this counter was supposed to increase if you hit your target when your accuracy is less than the distance from the target. I've tried debugging the code a little and I've noticed the following:
The BattleUnit::getFiringAccuracy() call returns base accuracy instead of distance-reduced one.

For instance, I'm using a shotgun with a range of 6 and 6 reduction/tile to fire at a target 19 tiles away. At close range, the soldier has 92% accuracy with this shotgun, but due to the distance, the accuracy gets reduced to 14%. I shoot and hit the target, but this statistic doesn't increase. Obviously, since the accuracy value being used in the above check is "92" instead of "14".

I'm using X-PirateZ v.L3 with OpenXcom Extended 6.6 (v2020-08-22).
« Last Edit: February 02, 2023, 03:25:18 pm by Meridian »

Offline Meridian

  • Global Moderator
  • Commander
  • *****
  • Posts: 7806
    • View Profile
Re: [BUG] lowAccuracyHitCounter
« Reply #1 on: September 07, 2020, 11:51:16 am »
This is standard OXC behavior, if a fix is needed then it should be done in OXC, not only in OXCE.

Commendations/diaries code doesn't have any specification and its author (Shoes) is not active anymore (as far as I can say).

Also, checking distance-reduced accuracy can be abused very easily... just stand close to an enemy and force-fire 20 tiles behind the enemy = free low accuracy hit.

Offline Delian

  • Colonel
  • ****
  • Posts: 228
    • View Profile
Re: [BUG] lowAccuracyHitCounter
« Reply #2 on: September 07, 2020, 01:04:34 pm »
This is standard OXC behavior because the standard beavior doesn't include accuracy reduction with range. If it included it, then the check here would likely also have included the actual reduced accuracy. So as far as I can tell, the behavior, when the realistic accuracy is turned on, is bugged. Even if it was fixed in the OXC, you'd still have to fix it in your fork.

It can't be abused because there's also a check if (victim == targetVictim), so if you aim far behind someone, the bonus won't be applied, because you hit someone that wasn't your target.

Offline Meridian

  • Global Moderator
  • Commander
  • *****
  • Posts: 7806
    • View Profile
Re: [BUG] lowAccuracyHitCounter
« Reply #3 on: September 07, 2020, 01:23:29 pm »
This is standard OXC behavior because the standard beavior doesn't include accuracy reduction with range.

But standard OXC behavior does include accuracy reduction with range.
It's a normal OXC feature, there is nothing OXCE-specific about it.

Even if it was fixed in the OXC, you'd still have to fix it in your fork.

Yes, I merge OXC changes regularly.
If it's changed in OXC, it will be merged into OXCE within a few weeks.

It can't be abused because there's also a check if (victim == targetVictim), so if you aim far behind someone, the bonus won't be applied, because you hit someone that wasn't your target.

True.
Sadly it only confirms there is no specification for it, I'd love to see missed shots that hit other units count toward this commendation.

Offline Delian

  • Colonel
  • ****
  • Posts: 228
    • View Profile
Re: [BUG] lowAccuracyHitCounter
« Reply #4 on: September 07, 2020, 01:45:48 pm »
Think about it. If you shoot at someone with 0% accuracy and you somehow hit them, then logically this statistic should increase.

Yes, there's no specification, so... what should the correct behavior be then? I think the idea of accuracy being less than the distance to the target is good, so you can't abuse it at short range. But then, it would still be easy to improve it if, for instance, you shot with 30% accuracy at someone 31 tiles away. So I think that another condition of accuracy being less than ~15% would be good.

Anyway, if you won't fix it, where should this bug be reported then?

Offline Meridian

  • Global Moderator
  • Commander
  • *****
  • Posts: 7806
    • View Profile
Re: [BUG] lowAccuracyHitCounter
« Reply #5 on: September 07, 2020, 01:57:13 pm »
Think about it. If you shoot at someone with 0% accuracy and you somehow hit them, then logically this statistic should increase.

I fully agree with your reasoning.
Just saying that it is a standard OXC behavior, and my primary goal in OXCE is to be as backwards-compatible with OXC as humanly possible.

Anyway, if you won't fix it, where should this bug be reported then?

To quote myself: "if a fix is needed then it should be done in OXC"

Offline Solarius Scorch

  • Global Moderator
  • Commander
  • *****
  • Posts: 10870
  • WE MUST DISSENT
    • View Profile
    • Nocturmal Productions modding studio website
    • Email
Re: [BUG] lowAccuracyHitCounter
« Reply #6 on: September 07, 2020, 03:43:56 pm »
There is a bug tracker here: https://github.com/OpenXcom/OpenXcom/issues

I think it would be the best way to report this issue.


Offline Delian

  • Colonel
  • ****
  • Posts: 228
    • View Profile
Re: [BUG] lowAccuracyHitCounter
« Reply #7 on: October 03, 2021, 12:48:22 pm »
Well, a year has passed since I submitted a ticket to that bug tracker and nothing has been done.

So, I submitted a pull request with a fix myself. Now I need someone to test the bug fix and approve the changes.

But for OXCE, you will not be able to automatically merge the changes because:
- The code in the changed function is already different between OXC and OXCE
- The fix itself is different in OXCE (OXC doesn't include "no LOS accuracy penalty")