aliens

Author Topic: aimed shot for alien?  (Read 7097 times)

Offline tempuser

  • Sergeant
  • **
  • Posts: 18
    • View Profile
aimed shot for alien?
« on: March 19, 2013, 11:51:26 pm »
As I understand, aimed shot is not for alien?
Code: [Select]
void AggroBAIState::projectileAction(BattleAction *action)
...
if (RNG::generate(1,10) < 5 && action->weapon->getAmmoQuantity() > 2)
{
        action->type = BA_AUTOSHOT;
}
else
{
        action->type = BA_SNAPSHOT;
}
may be necessary to add aimed shot, provided that the purpose beyond a certain distance?

Offline redv

  • Colonel
  • ****
  • Posts: 335
    • View Profile
Re: aimed shot for alien?
« Reply #1 on: March 20, 2013, 12:02:30 pm »
Aimed shot is not for soldiers too)
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;
}
In current shooting model, probability to hit depend only from accuracy (in vanilla Xcom too).

So, calculate probability to miss:
accuracy 70%; weapon - Plasma Pistol
Autoshot:  probability to miss = (1 – 0.7*0.5)^9 = 0.021
Snapshot:  probability to miss = (1 – 0.7*0.65)^3 = 0.162
Aimshot+Snapshot:  probability to miss = (1 – 0.7*0.85)*(1 – 0.7*0.65) = 0.221

Best choice – always Autoshot (at any distance).

Offline tempuser

  • Sergeant
  • **
  • Posts: 18
    • View Profile
Re: aimed shot for alien?
« Reply #2 on: March 20, 2013, 04:34:49 pm »
automatic weapon to win this war ;D

Offline AMX

  • Sergeant
  • **
  • Posts: 35
    • View Profile
Re: aimed shot for alien?
« Reply #3 on: March 20, 2013, 06:39:11 pm »
Aimed shot is not for soldiers too)
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;
}
In current shooting model, probability to hit depend only from accuracy (in vanilla Xcom too).

So, calculate probability to miss:
accuracy 70%; weapon - Plasma Pistol
Autoshot:  probability to miss = (1 – 0.7*0.5)^9 = 0.021
Snapshot:  probability to miss = (1 – 0.7*0.65)^3 = 0.162
Aimshot+Snapshot:  probability to miss = (1 – 0.7*0.85)*(1 – 0.7*0.65) = 0.221

Best choice – always Autoshot (at any distance).
Sorry, what?
Right above the part you copied, the "accuracy" variable is modified depending on range.
I didn't bother checking where "accuracy" comes from originally, but I know the weapons have multiple accuracy values, one per allowed firing mode.
So I dare say you are wrong.

Offline redv

  • Colonel
  • ****
  • Posts: 335
    • View Profile
Re: aimed shot for alien?
« Reply #4 on: March 20, 2013, 07:00:09 pm »
Accuracy can be modified depend on range only if you use option "battleRangeBasedAccuracy". Default is "false".
This option taken from UFOextender.

Code: [Select]
if (Options::getBool("battleRangeBasedAccuracy"))
{
if (_action.type == BA_AUTOSHOT && realDistance > 112)
{
accuracy -= 0.00125 * (realDistance - 112);
}
if (_action.type == BA_SNAPSHOT && realDistance > 240)
{
accuracy -= 0.00125 * (realDistance - 240);
}
}

I don't like how works this option.
« Last Edit: March 20, 2013, 07:14:44 pm by redv »

Offline tempuser

  • Sergeant
  • **
  • Posts: 18
    • View Profile
Re: aimed shot for alien?
« Reply #5 on: March 21, 2013, 08:51:34 pm »
I don't like how works this option.
why?

Offline redv

  • Colonel
  • ****
  • Posts: 335
    • View Profile
Re: aimed shot for alien?
« Reply #6 on: March 22, 2013, 02:33:54 pm »
why?

Short answer – subjective feeling.

I will try to explain.

I think, Xcom is one of the best game ever made.
But vanilla Xcom has some disadvantages. One disadvantage is the model of shooting:
1. If unit have accuracy 50%, then he will hit with probability 50% regardless of distance (accuracy is manifestly compares with luck).
2. Even if enemy stand next tile.
3. Autoshot is always best choice, because chance to miss lesser.

UFOextender trying to decide 3th and partially 1st problem.
Solution is not obvious, because I always don't know, I missed because I had no luck, or because I've done determine distance incorrectly.

OpenXcom uses normal distribution for model of shooting. This makes it possible to solve 2nd problem. Simultaneously uses calculation probability to hit like in vanilla Xcom. As result – grow probability to hit at any range. The game becomes easier.
If we use option "rangeBasedAccuracy", then we have three key factors influence to chance to hit. At different distances the influence is various. Subjective feeling is uncertainty about choosing the right mode of the shooting.

I think, must be only one key factor – accuracy. But accuracy can not be manifestly compare with luck for the determination hits or misses. Other factors are secondary.

I wrote my version model of shooting. And I collected some interesting suggestions on the forum. Now I'm happy with the result)
https://github.com/SupSuper/OpenXcom/pull/368
https://openxcom.org/forum/index.php/topic,1050.0.html

Offline tempuser

  • Sergeant
  • **
  • Posts: 18
    • View Profile
Re: aimed shot for alien?
« Reply #7 on: March 22, 2013, 08:51:45 pm »
Generally in openxcom aliens (and soldiers) shoot incredibly accurately and it is boring. Recent example, a heavy wounded alien with accuracy=7 shoot my soldier from a distance of 15 cells. It's too much! As usual, I have a save :)

Offline redv

  • Colonel
  • ****
  • Posts: 335
    • View Profile
Re: aimed shot for alien?
« Reply #8 on: March 23, 2013, 01:45:54 pm »
For fun, I calculated the probability to hit.
Accuracy of your enemy is 7%. Distance is 15 tiles. Weapon is Plasma Rifle. Weapon mode is snapshot (accuracy 86%).

Vanilla Xcom (very roughly): 0.07*0.86 + (1 – 0.07) / (15*sin(0.5))^2 = 0.078
OpenXcom: 0.07*0.86 + (1 – 0.07) * 0.28 = 0.3206