project-navigation
Personal tools

Author Topic: AI is exploiting reaction fire buggyness  (Read 5216 times)

Offline anonymissimus

  • Sergeant
  • *****
  • Posts: 347
    • View Profile
AI is exploiting reaction fire buggyness
« on: February 25, 2016, 01:22:49 pm »
Sometimes an alien is standing in such a position at the beginning of its turn, that it could shout right away. This does however generally not happen. Instead it previously moves onto such a position that it's slightly behind a corner or similar, aims apparently slightly onto a "wrong" position and kills. There is no reason why my soldier shouldn't reaction shoot (only obstacles in the way - no friendly units) but doesn't. All such cases should be considered bugs. While I am also aiming onto "wrong" fields frequently, I almost never do it to exploit this bug as I cannot risk that it doesn't work. The AI appears to perfectly know whether it will work however. In all the cases it exploits the bug my RF didn't work, while I sometimes got reaction shot in cases where there was a red line from my soldier to the alien, both on the same height. The RF indeed hits the obstacle then, but only most of the time.

Offline DarkRain

  • Project Coder
  • Captain
  • ***
  • Posts: 746
    • View Profile
Re: AI is exploiting reaction fire buggyness
« Reply #1 on: February 26, 2016, 11:31:01 pm »
I think you just have bad luck

<snip>only obstacles in the way<snip>
Actually this is your problem then, you must remember that, when RF triggers, the game checks not only for friendly fire, but also checks the percentage of the shots fired that actually hit the enemy (using a sample of ~100 mock shots), if it is too low RF won't trigger, and yes the same check is applied when the AI uses RF, so if the AI uses RF but your soldiers don't, you either have bad luck or your soldiers aren't accurate enough to put enough shots through that corner.

And no, the AI cannot aim at "wrong" positions, it can only aim directly at a game entity (currently limited to characters only, shooting breakables is disabled) you will notice, for example, that they never bounce grenades, always throwing them right at your feet.

Offline anonymissimus

  • Sergeant
  • *****
  • Posts: 347
    • View Profile
Re: AI is exploiting reaction fire buggyness
« Reply #2 on: February 27, 2016, 01:07:44 am »
when RF triggers, the game checks not only for friendly fire, but also checks the percentage of the shots fired that actually hit the enemy (using a sample of ~100 mock shots), if it is too low RF won't trigger, and yes the same check is applied when the AI uses RF, so if the AI uses RF but your soldiers don't
Well sorry, but that seems a bad logic to me. If there are no friendly units in danger of being hit, reaction fire should just always trigger, independently from such a calculation. The soldier is almost guaranteed to die (especially otherwise, meaning he doesn't reaction shoot).
I'm pretty sure I also have seen it happen that the alien trick fails though, the alien fires 3 shots or even full auto, but all of them hit the obstacle(s). It's just that if even a single one slips through, that means instadeath due to the difficulty scaled damage.
And it of course happens that my soldiers actually reaction shoot, but generally only if there are no obstacles in the way, which means that being partly covered to make being hit less likely is not allowed.
EDIT
your soldiers aren't accurate enough to put enough shots through that corner.
In the depicted situation, assuming perfect accuracy of my soldier, *all* of the reaction shots would hit the obstacle. As I said, the alien moves onto a position slightly behind a corner or obstacle before shooting. The shot line from my soldier to the alien is (would be) red, and in the other direction it's got to be as well, logically. So, given the reaction fire check with the 100 shot tests, it of course doesn't trigger then.
EDIT2
To not be misunderstood here...it is perfectly fine with me that the AI is exploiting things, and also that the soldier dies. The problem is that reaction fire is so buggy...
EDIT3
This check with 100 sample shots might also be why reaction fire seems to never work on long range then (but not so long that the weapon's range is exceeded).
« Last Edit: February 27, 2016, 07:57:16 pm by anonymissimus »

Offline DarkRain

  • Project Coder
  • Captain
  • ***
  • Posts: 746
    • View Profile
Re: AI is exploiting reaction fire buggyness
« Reply #3 on: February 28, 2016, 06:10:15 am »
Well sorry, but that seems a bad logic to me.
I'm fairly sure that check pre-dates my involvement with the project, so I cannot speak for the rationale that led to its inclusion, something about ammo conservation I'm sure.

Quote
And it of course happens that my soldiers actually reaction shoot, but generally only if there are no obstacles in the way, which means that being partly covered to make being hit less likely is not allowed.
Yes, I see how that would be... let's say "problematic" for a tactical game.

Quote
In the depicted situation, assuming perfect accuracy of my soldier, *all* of the reaction shots would hit the obstacle. As I said, the alien moves onto a position slightly behind a corner or obstacle before shooting. The shot line from my soldier to the alien is (would be) red, and in the other direction it's got to be as well, logically. So, given the reaction fire check with the 100 shot tests, it of course doesn't trigger then.
Ok, I think I'm getting a better picture of what you mean, so I guess more accuracy would indeed be counter-productive to RF in this situation...

Quote
This check with 100 sample shots might also be why reaction fire seems to never work on long range then (but not so long that the weapon's range is exceeded).
Most likely

Offline anonymissimus

  • Sergeant
  • *****
  • Posts: 347
    • View Profile
Re: AI is exploiting reaction fire buggyness
« Reply #4 on: February 29, 2016, 07:07:40 pm »
An example screenshot showing a typical case of the depicted situation. Bot the alien (after its shot) and my soldier did not move (yet). Plasma rifle snap shot from the alien, which hit the obstacle, so the soldier survived, in this case. Reaction fire (assault rifle snap shot) was active but did not trigger.

Offline pete conway

  • Rookie
  • ***
  • Posts: 24
    • View Profile
Re: AI is exploiting reaction fire buggyness
« Reply #5 on: March 09, 2016, 11:47:39 am »
Would Left hand weapon v right hand weapon have anything to do with it? many years ago on another game entirely we used to exploit a corner in a similar fashion!

I understand that All Characters are Right handed but might that have been wedged into the equation?  just a thought!

Offline DarkRain

  • Project Coder
  • Captain
  • ***
  • Posts: 746
    • View Profile
Re: AI is exploiting reaction fire buggyness
« Reply #6 on: March 10, 2016, 11:51:16 pm »
Depends on the weapon each has a "shot origin" that shifts the shot's starting point but always to the same side regardless of which hand the weapon is held with (currently all hand-held weapons shift to the right IIRC but it might be possible to script a weapon with a "left handed" shot origin)


Anyway, I've greatly increased the chances of RF when partial cover is an issue, it still requires at least one of the mock shots to hit an enemy — otherwise we'd have characters trying to RF through transparent walls (alien base), bullet-proof windows (bunker) and so on.

Now let's see how many complains we'll get about this...
« Last Edit: March 11, 2016, 03:03:14 am by DarkRain »

Offline anonymissimus

  • Sergeant
  • *****
  • Posts: 347
    • View Profile
Re: AI is exploiting reaction fire buggyness
« Reply #7 on: March 11, 2016, 02:09:58 pm »
If the code doesn't distinguish between friendly units and obstacles I'm sure someone will complain about RF hitting friendlies. Soldiers and civilians can be treated in the same way in the case of Phalanx, aliens only should care about other aliens.
So, if at least one sample shot hits an enemy, shoot, but if at least one sample shot hits a friendly unit, don't. The second condition takes priority.

Offline DarkRain

  • Project Coder
  • Captain
  • ***
  • Posts: 746
    • View Profile
Re: AI is exploiting reaction fire buggyness
« Reply #8 on: March 11, 2016, 08:16:01 pm »
The code already uses the same sample to count the number of friendly (and civilian if needed) hits, but the limit on friendly fire is less strict, and increases as the morale of the shooter worsens — to the point an insane unit will not care if the whole sample is all friendly hits.

Well, I guess that might indeed make friendly fire more likely, now that those friendlies blocking the line of fire has much less weight in the calculation