aliens

Author Topic: New version of battleRangeBasedAccuracy  (Read 10013 times)

Offline redv

  • Colonel
  • ****
  • Posts: 335
    • View Profile
New version of battleRangeBasedAccuracy
« on: March 08, 2013, 11:22:21 am »
Anybody uses option "battleRangeBasedAccuracy"?

I prepared a new version of "battleRangeBasedAccuracy".

Features:
 1. Unit always have chance to hit;
 2. Unit always have chance to miss;
 3. Chance to hit depend on range to target;
 4. Chance to hit depend on lighting (day/night and sources of light);
 5. To hit in Sectoids difficult, in large units – easily;
 6. Chance to hit on range 10 tiles approximately equivalent as displayed accuracy;
 7. Autoshot great only for short range (near 7 tiles);
 8. If you have displayed accuracy near 120% and above, you almost always hit on any distance;
 9. If you wear Power Suit or Flying Suit, then easier to shoot at you.

What factors should be taken into account?
What factors are unnecessary?
I need feedback.

Offline Daiky

  • Battlescape Programmer
  • Administrator
  • Commander
  • *****
  • Posts: 904
    • View Profile
Re: New version of battleRangeBasedAccuracy
« Reply #1 on: March 08, 2013, 11:43:26 am »
battleRangeBasedAccuracy comes from UFOextender -  I decided not to fiddle with it myself and implement it as it was (it might be other people recently messed with it recently, I'm not really following the code anymore)
https://www.ufopaedia.org/index.php?title=UFOextender

1.unit always have a change to hit and a change to miss... this is already the case.
Chance to hit depend on range to target is exactly what the option does.
Chance to hit depend on lighting doesn't seem to fit in the scope of "rangebasedaccuracy" I would make a new option "lightingbasedaccuracy"
Small units are harder to hit and large units easier... this is already the case (loftemps)
7. is exactly what the option already does. 8. this is not the case, because of the damage system (contradicts with your point 2 by the way) 9. I don't see the logic in that.

2cts from the grumpy ol developer  ;)

Offline redv

  • Colonel
  • ****
  • Posts: 335
    • View Profile
Re: New version of battleRangeBasedAccuracy
« Reply #2 on: March 08, 2013, 12:25:41 pm »
Original OpenXcom code has:
Code: [Select]
https:// check if we hit
if (RNG::generate(0.0, 1.0) < accuracy)
{
https:// we hit, so no deviation
dRot = 0;
dTilt = 0;
}

For example: if we have accuracy>=1.0 we always hit. At any range. Really? And how about loftemps?

Other case: enemy unit stand next tile from me, but i have accuracy=0.3. I miss! Why? Shoot at close range. Chance to hit must be near 99,9%.

About Power Suits.
Yes. It is disputed point.
Power Suit – this is heavy armor with exoskeleton and power source. Personal tank.
Power Suit larger than Personal Armor (or no armor). loftemps+1

Other side:
Power Suit appears in the middle or at the end of the game. You also have trained soldiers (high accuracy, psi abilities), and the enemy is no real danger. loftemps+1 needed to balance the game in case use new version of "battleRangeBasedAccuracy".

UFOextender was limited by possibilities of vanilla Xcom.

About lightingBasedAccuracy.
May be you right. In this case need implement lightingBasedAccuracy to the original OpenXcom formula too.

Upd: If need, the table of probability to hit:
https://dl.dropbox.com/u/73411168/UFO-Accuracy.ods
« Last Edit: March 08, 2013, 01:32:50 pm by redv »

Offline TopCat

  • Sergeant
  • **
  • Posts: 34
    • View Profile
Re: New version of battleRangeBasedAccuracy
« Reply #3 on: March 13, 2013, 12:55:24 am »
Unit Strength should have influence on accuracy (and currently it haven't ). Even on  TwoHanded penalty (when you don't have empty second hand) is hard coded to 0.8.

It's look like strength is also not used for throwing!!!

Volutar

  • Guest
Re: New version of battleRangeBasedAccuracy
« Reply #4 on: March 13, 2013, 03:42:21 am »
i know that when you're kneeling, you got to get 2x less chances to avoid hit. Currently stand/kneel state almost has no influence on hit/miss ratio.

Offline redv

  • Colonel
  • ****
  • Posts: 335
    • View Profile
Re: New version of battleRangeBasedAccuracy
« Reply #5 on: March 13, 2013, 10:56:29 am »
Volutar, yes, currently stand/kneel state has no influence on hit/miss ratio.
In the suggested formula impact of stand/kneel is negligible:
Target is soldier. Displayed accuracy – 70%.
- Probability to hit at distance of 5 tiles – 92.1% (when soldier is knelling - 92.1%)
- Probability to hit at distance of 20 tiles – 34.0% (when soldier is knelling - 31.3%)
But you can hide)

TopCat, strength has indirect effects to accuracy.
If soldier nave low strength, then he have TU penalty. Sometime he cannot use aim shot.
Strength has the effect on range distance of throwing.

Volutar

  • Guest
Re: New version of battleRangeBasedAccuracy
« Reply #6 on: March 13, 2013, 11:23:55 am »
I think kneeling should lead to more noticeable reduce of chance of being hit. To give people more chances to survive and to make them use kneeling more often. Without even obsticles.

Offline redv

  • Colonel
  • ****
  • Posts: 335
    • View Profile
Re: New version of battleRangeBasedAccuracy
« Reply #7 on: March 13, 2013, 11:47:55 am »
No. If the distribution of shots is similar to the "bell", the result will be that kind.

Volutar

  • Guest
Re: New version of battleRangeBasedAccuracy
« Reply #8 on: March 13, 2013, 12:30:44 pm »
I know that. But kneeling units should get "enemy miss" bonus. Inspite on raw ariphmetics.

Offline xracer

  • Commander
  • *****
  • Posts: 565
  • X-COM lover, we've gone at it everywhere
    • View Profile
Re: New version of battleRangeBasedAccuracy
« Reply #9 on: March 16, 2013, 12:30:05 am »
i thought i asked about this and kneeling does that that effect of making your target harder to hit. I though I was told that is based on the voxels of the target (or something like that)

But yes, a kneeling target presents a smaller profile to the shooter thus making it a bit more difficult to hit the target. The raw number
Also a kneeling stance does provide a better shooting stance and provides an improved probability of hitting an enemy, which i have check it does in gameplay.
Redv, I know i am not a programmer, but i have checked and kneeling does provide an improved accuracy. maybe i am wrong but i am pretty sure i checked that. st least from the player perspective.

Offline redv

  • Colonel
  • ****
  • Posts: 335
    • View Profile
Re: New version of battleRangeBasedAccuracy
« Reply #10 on: March 16, 2013, 02:49:32 pm »
This is specific problem. Xcom battlefield is flat. In vanilla Xcom spread of shots in vertical axis 4 times lower then horizontal. In OpenXcom spread in vertical axis 2 times lower then horizontal. In my formula spread in vertical axis also 2 times lower then horizontal axis. So lowering the height of the target almost not affect on probability of hit.
I tested variant when spread in vertical and horizontal axis is equivalent. Does not look very nice.

On the other hand, if soldier is kneeled, he is lower in 22/14 = 1.57 times. Chance to hit them must be lower near 1.08 – 1.34 times (depending on the distance 10-20 tiles). This is equivalent to reducing of the accuracy on 5%.
As compromise, I can check kneeling and in this case reduce the accuracy on 5%.
« Last Edit: March 16, 2013, 03:15:55 pm by redv »

Volutar

  • Guest
Re: New version of battleRangeBasedAccuracy
« Reply #11 on: March 17, 2013, 12:16:57 am »
How shortening in 1.5 times can lower chance in 1.08 times? It must be the same - 1.5 times! Like it's linear.

Offline redv

  • Colonel
  • ****
  • Posts: 335
    • View Profile
Re: New version of battleRangeBasedAccuracy
« Reply #12 on: March 17, 2013, 08:10:34 am »
No.
You would have been right, if the distribution would have been linear.
But the distribution is normal, then the dependence is nonlinear.

Volutar

  • Guest
Re: New version of battleRangeBasedAccuracy
« Reply #13 on: March 17, 2013, 09:08:26 am »
Thing is, in vanilla kneeling have had more obvious "protection factor". And that should stay intact.

Offline redv

  • Colonel
  • ****
  • Posts: 335
    • View Profile
Re: New version of battleRangeBasedAccuracy
« Reply #14 on: March 17, 2013, 09:33:46 am »
How this dependence looks?
I cannot find this thing in https://ufopaedia.org, and in source code of vanilla Xcom too.