aliens

Author Topic: Questions About OXC Firing Accuracy  (Read 9615 times)

Offline Qpoter

  • Colonel
  • ****
  • Posts: 114
    • View Profile
Questions About OXC Firing Accuracy
« on: February 09, 2014, 03:41:34 am »
I've noticed a few oddities in OpenXcom regarding firing accuracy or firing in itself, and I want to know why these things are the way they are and/or if they can be changed to more closely reflect the original game's behavior.

First up, when taking Auto Shots and the target dies before the burst finishes-
Original: the remainder of the burst will hit the spot where the target once stood
OXC: the remainder of the burst will hit the ground underneath the target (its corpse)
 
Secondly, is accuracy in OpenXcom based on probability?
I heard somewhere in these forums that Firing Accuracy in OXC basically states the probability for a 'hit' trajectory to be calculated, and if the RNG roll fails, a 'miss' trajectory is calculated. However, afaIk, the original game's Firing Accuracy did not reflect your chance to hit, but instead just calculated the possible spread in degrees of any given shot you take. This made it possible, for example, to take a 56% Accuracy Snap Shot at a target right in front of you and have the shot literally fly directly to your left or some other really bad angle (although the odds of these extreme misses are miniscule, I have witnessed them a few times in Let's Plays of the original and have also experienced them).

And thirdly, when you save before you take a shot, and then continue to reload the save game and take that same shot, it will always take the same trajectory (so if the shot misses it will continue to miss and will never hit no matter how many times you reload). Is this to prevent save scumming? If so, I disapprove of it, not because I save scum myself (I noticed this while testing a few mods) but because I think if people want to save scum you should allow them the opportunity. If it isn't for preventing save scumming, I still think this should be corrected.

Whew, that was a mouthful! So, in conclusion, if these mechanics work in OXC the way I suspect they do, I'd like to see them changed to more closely model the original game's behavior.

Offline SupSuper

  • Lazy Developer
  • Administrator
  • Commander
  • *****
  • Posts: 2162
    • View Profile
Re: Questions About OXC Firing Accuracy
« Reply #1 on: February 09, 2014, 08:46:44 am »
Secondly, is accuracy in OpenXcom based on probability?
I heard somewhere in these forums that Firing Accuracy in OXC basically states the probability for a 'hit' trajectory to be calculated, and if the RNG roll fails, a 'miss' trajectory is calculated.
This is how new XCOM works, not OXC.

However, afaIk, the original game's Firing Accuracy did not reflect your chance to hit, but instead just calculated the possible spread in degrees of any given shot you take. This made it possible, for example, to take a 56% Accuracy Snap Shot at a target right in front of you and have the shot literally fly directly to your left or some other really bad angle (although the odds of these extreme misses are miniscule, I have witnessed them a few times in Let's Plays of the original and have also experienced them).
Yes, OpenXcom works exactly like the original. A cone is drawn between the source and the target, with a spread based on the total base accuracy, and a trajectory is randomly picked (so it's still based on probability :P) based on a normal distribution, where the dead-on shot is the most-likely and the cone edges are the least-likely.

And thirdly, when you save before you take a shot, and then continue to reload the save game and take that same shot, it will always take the same trajectory (so if the shot misses it will continue to miss and will never hit no matter how many times you reload). Is this to prevent save scumming? If so, I disapprove of it, not because I save scum myself (I noticed this while testing a few mods) but because I think if people want to save scum you should allow them the opportunity. If it isn't for preventing save scumming, I still think this should be corrected.
OpenXcom saves the RNG seed to make it possible to easily reproduce and debug savegames, so the same set of actions will always have the same result. If this is undesirable, you can set "newSeedOnLoad: true" in your options.cfg, but this will make your saves mostly useless for debugging should a problem occur.

Offline Qpoter

  • Colonel
  • ****
  • Posts: 114
    • View Profile
Re: Questions About OXC Firing Accuracy
« Reply #2 on: February 09, 2014, 09:56:14 am »
OK, that made things a lot clearer. Many thanks.

Offline Warboy1982

  • Administrator
  • Commander
  • *****
  • Posts: 2333
  • Developer
    • View Profile
Re: Questions About OXC Firing Accuracy
« Reply #3 on: February 09, 2014, 10:29:38 am »
i'll fix the autofire thing

Offline redv

  • Colonel
  • ****
  • Posts: 335
    • View Profile
Re: Questions About OXC Firing Accuracy
« Reply #4 on: February 09, 2014, 03:20:19 pm »
Secondly, is accuracy in OpenXcom based on probability?
I heard somewhere in these forums that Firing Accuracy in OXC basically states the probability for a 'hit' trajectory to be calculated, and if the RNG roll fails, a 'miss' trajectory is calculated. However, afaIk, the original game's Firing Accuracy did not reflect your chance to hit, but instead just calculated the possible spread in degrees of any given shot you take.

The OXC reproduces original X-Com EU algorithm.
In this string the game throws dice hit/miss: https://github.com/SupSuper/OpenXcom/blob/master/src/Battlescape/Projectile.cpp#L297 https:// code was changed
Next "if" is decision about what "was hit" or "was miss".
If you got a "hit", then you have almost 100% chance to real hit (less 100% possible on long distances).
If you got a "miss", you still have chances to hit because all calculations of trajectory does in 3D (you can press F10 for saving 3D screenshot).
« Last Edit: February 19, 2014, 12:42:53 am by redv »

Offline Firestorm_01

  • Sergeant
  • **
  • Posts: 25
    • View Profile
Re: Questions About OXC Firing Accuracy
« Reply #5 on: February 18, 2014, 08:57:11 pm »
Quote
If you got a "hit", then you have almost 100% chance to real hit (less 100% possible on long distances).
If you got a "miss", you still have chances to hit because all calculations of trajectory does in 3D (you can press F10 for saving 3D screenshot).
Two questions:
So the best option is still autofire?
Ufo Extender Accuracy should prevent upper thing. But do alines know their chance to hit with Ufo Extender Accuracy on and use that knowledge to calculate their actions?
« Last Edit: February 18, 2014, 09:00:40 pm by Firestorm_01 »

Offline redv

  • Colonel
  • ****
  • Posts: 335
    • View Profile
Re: Questions About OXC Firing Accuracy
« Reply #6 on: February 19, 2014, 12:41:41 am »
If you use vanilla accuracy, then yes, autofire is always best choice.
If you use UFOextender accuracy, then you should use autofire only at short distance, because after some threshold distance, accuracy of autofire will dramatically decreases (very realistic ;-).
Aliens don't knows exactly his chance to hit because the game not contains algorithm for calculation of true chances. But aliens knows his accuracy. Like you)

You can check the code: https://github.com/SupSuper/OpenXcom/blob/master/src/Battlescape/Projectile.cpp
« Last Edit: February 19, 2014, 12:45:08 am by redv »

Offline Firestorm_01

  • Sergeant
  • **
  • Posts: 25
    • View Profile
Re: Questions About OXC Firing Accuracy
« Reply #7 on: February 19, 2014, 06:47:06 am »
Quote
But aliens knows his accuracy. Like you)
But do they use their accuracy in thier planning? I mean:"Should I shoot him if my accuracy lower 30%".
It they do, do they take in account Ufo Extender Accuracy if it is on. For example:"My accauracy on snapshot  is 45%. But wait, Ufo Extender Accuracy is on, so my accuracy actualy  to that target is lower than 30%. Let's do something else instead snapshot. Maybe aimed shot".

Offline Warboy1982

  • Administrator
  • Commander
  • *****
  • Posts: 2333
  • Developer
    • View Profile
Re: Questions About OXC Firing Accuracy
« Reply #8 on: February 19, 2014, 08:43:47 am »
aliens use some fuzzy logic to decide their shot type, but mostly it's based on range to target and time units available vs time units reserved to escape.

the range determination is not terribly far off the default drop-off ranges as used by ufoextender. this does not exclude the possibility of using auto shot at extreme ranges, but they are much more likely to prioritize aimed or snap.