aliens

Author Topic: AI Behavior and Reaction  (Read 512 times)

Offline Ethereal

  • Colonel
  • ****
  • Posts: 349
    • View Profile
AI Behavior and Reaction
« on: December 10, 2019, 08:50:14 pm »
1) Aliens have too small a range for Auto firing. In fact, they only use the auto-shot for firing a close rang. It would be necessary to increase the distance to at least 9-10 cells.

2) Urgently need an option for weapons, which would completely block firing on the reaction for all shooting modes. The fact is that the aiming mode of shooting is used by aliens almost exclusively at the limit of visibility. At an average distance, aliens do not use it, which means that weapons that have only an aiming mode are rarely used by aliens. At the moment, to deprive the weapon of the ability to shoot on the reaction - to deprive him of the “Snap” shooting mode, and this is the only mode of shooting at medium distance from aliens.

I believe that heavy rocket launchers, mortars, and some other types of heavy weapons should not be able to fire at reactions, but should at the same time have a "Snap" firing mode. It is impossible to do so far.

Offline The Martian

  • Colonel
  • ****
  • Posts: 265
  • "It implores you to listen to its arguments..."
    • View Profile
Re: AI Behavior and Reaction
« Reply #1 on: December 11, 2019, 04:09:54 am »
I've been making use of confAimed: and confAuto: on weapons with no snap shot to bypass the enemy AI's ability to use reaction shot. So far I'd just been setting up the equipment without testing how the AI would handle it so I had not noticed this problem.
(I just thought they'd fire when in range with the best % chance to hit.)

What are the exact ranges the enemy can use Aimed, Auto and Snap at?
(This is quite the unexpected setback.)

Will the enemy AI move to a position it can fire at using Aimed or Auto if it is only in Snap range and does not have a Snap firing mode?

An override to allow the AI to use different firing modes at various ranges would be appreciated, perhaps something on the weapon like:

Code: [Select]
    AIAlter:
      aiSnapMinRange: false
      aiSnapMaxRange: false
      aiAimedMinRange: 0
      aiAimedMaxRange: 25
      aiAutoMinRange: false
      aiAutoMaxRange: false

I agree with Ethereal that it would be very useful to have an items: variable that prevented a weapon's snap shot from triggering reaction fire.
Code: [Select]
allowReactionFire: false
« Last Edit: December 11, 2019, 04:21:14 am by The Martian »

Online Meridian

  • Global Moderator
  • Commander
  • ***
  • Posts: 5952
  • Aaand we're back!
    • View Profile
    • My Wiki
Re: AI Behavior and Reaction
« Reply #2 on: December 11, 2019, 10:24:25 am »
1) Aliens have too small a range for Auto firing. In fact, they only use the auto-shot for firing a close rang. It would be necessary to increase the distance to at least 9-10 cells.

2) Urgently need an option for weapons, which would completely block firing on the reaction for all shooting modes. The fact is that the aiming mode of shooting is used by aliens almost exclusively at the limit of visibility. At an average distance, aliens do not use it, which means that weapons that have only an aiming mode are rarely used by aliens. At the moment, to deprive the weapon of the ability to shoot on the reaction - to deprive him of the “Snap” shooting mode, and this is the only mode of shooting at medium distance from aliens.

I believe that heavy rocket launchers, mortars, and some other types of heavy weapons should not be able to fire at reactions, but should at the same time have a "Snap" firing mode. It is impossible to do so far.

1a/ Aliens can auto-fire from any range. You can easily test this by removing snap shot and aimed shot from a plasma weapon. They just choose not to use it, because they think snap shot and aimed shot are better at larger distances.

1b/ If you want a different AI procedure for determining when which fire mode should be used, you can try extended algorithm by ohartenstein, see `extendedFireModeChoice` under: https://openxcom.org/forum/index.php/topic,5980.0.html

2/ You can block reaction fire by removing a snapshot. If you still want a weapon to have a snapshot (e.g. you want a snapshot for your rocket launcher), you can remove the real snapshot... and rename and redefine the autoshot to work exactly like snapshot (except it won't reaction fire).

Offline Ethereal

  • Colonel
  • ****
  • Posts: 349
    • View Profile
Re: AI Behavior and Reaction
« Reply #3 on: December 11, 2019, 12:19:21 pm »
1a/ Aliens can auto-fire from any range. You can easily test this by removing snap shot and aimed shot from a plasma weapon. They just choose not to use it, because they think snap shot and aimed shot are better at larger distances.

1b/ If you want a different AI procedure for determining when which fire mode should be used, you can try extended algorithm by ohartenstein, see `extendedFireModeChoice` under: https://openxcom.org/forum/index.php/topic,5980.0.html

Thanks, I'll try.

I looked. "autoRange:" and "maxRange:" are used in my modification, but this does not change the essence. Another thing is if "min \ max Range" and "dropoff" could be configured for each shooting mode separately. But there are no such options either.

2/ You can block reaction fire by removing a snapshot. If you still want a weapon to have a snapshot (e.g. you want a snapshot for your rocket launcher), you can remove the real snapshot... and rename and redefine the autoshot to work exactly like snapshot (except it won't reaction fire).

And how will aliens use it? I am more than sure that the aliens do not care what the shooting mode is called. They will use the renamed auto-shot as an auto-shot, i.e. at close proximity.

I don’t think it would be extremely difficult and long time for you to create the “allowReactionFire:” function, which will solve many problems and save the modmakers from finding workarounds, that will inevitably be crooked.
« Last Edit: December 11, 2019, 12:40:29 pm by Ethereal »

Online Meridian

  • Global Moderator
  • Commander
  • ***
  • Posts: 5952
  • Aaand we're back!
    • View Profile
    • My Wiki
Re: AI Behavior and Reaction
« Reply #4 on: December 11, 2019, 01:36:52 pm »
And how will aliens use it? I am more than sure that the aliens do not care what the shooting mode is called. They will use the renamed auto-shot as an auto-shot, i.e. at close proximity.

That's why I gave you link in point 1b/.

Extended algorithm doesn't consider only the distance, but also firing accuracy, shot type, number of shots, how much TUs a shot costs, unit's intelligence, unit's aggression, etc.

I don’t think it would be extremely difficult and long time for you to create the “allowReactionFire:” function

Correct.
« Last Edit: December 11, 2019, 01:40:10 pm by Meridian »

Offline The Martian

  • Colonel
  • ****
  • Posts: 265
  • "It implores you to listen to its arguments..."
    • View Profile
Re: AI Behavior and Reaction
« Reply #5 on: December 11, 2019, 02:03:15 pm »
Aliens can auto-fire from any range. You can easily test this by removing snap shot and aimed shot from a plasma weapon. They just choose not to use it, because they think snap shot and aimed shot are better at larger distances.

That is a relief.

If you want a different AI procedure for determining when which fire mode should be used, you can try extended algorithm by ohartenstein, see `extendedFireModeChoice` under: https://openxcom.org/forum/index.php/topic,5980.0.html

This script looks very useful, thank you for linking it.


The source code is available on my GitHub page.

Edit 171110: This is an official part of OXCE+, so the links for my repository above are deprecated.  This post will remain for documentation.

And it is already included in OXCE, excellent! ^_^

(Question)
Is it possible to set extendedFireModeChoice: true on only a specific enemy unit type, or is it only a global modifier for all enemy units AI?

Offline Ethereal

  • Colonel
  • ****
  • Posts: 349
    • View Profile
Re: AI Behavior and Reaction
« Reply #6 on: December 11, 2019, 02:05:20 pm »
That's why I gave you link in point 1b/.

Extended algorithm doesn't consider only the distance, but also firing accuracy, shot type, number of shots, how much TUs a shot costs, unit's intelligence, unit's aggression, etc.

Interesting. Thanks. I will try to apply it correctly.

Offline Yankes

  • Moderator
  • Commander
  • ***
  • Posts: 2247
    • View Profile
Re: AI Behavior and Reaction
« Reply #7 on: December 12, 2019, 01:06:09 am »
To disable reaction shots you can use yscripts too, there is hook that detriment if weapon can react to movements, if you return 0 it will never do any thing.

Offline Ethereal

  • Colonel
  • ****
  • Posts: 349
    • View Profile
Re: AI Behavior and Reaction
« Reply #8 on: December 12, 2019, 09:11:12 am »
To disable reaction shots you can use yscripts too, there is hook that detriment if weapon can react to movements, if you return 0 it will never do any thing.

Could you give more details? I have a bad English, and frankly, I don’t even know what to look for.
Add.
Probably means "XPIRATEZ_STEALTH_GUN". Perhaps this is an option for others, but not for mine. "reaction_unit.geReactionScore reaction_viewer;" means that the weapons in the second slot are also affected by this hook, which is very sad.
« Last Edit: December 12, 2019, 01:09:33 pm by Ethereal »

Offline Yankes

  • Moderator
  • Commander
  • ***
  • Posts: 2247
    • View Profile
Re: AI Behavior and Reaction
« Reply #9 on: December 12, 2019, 07:47:47 pm »
I look on implementation and I see that than when hook is run code know that weapon "reactor" want use. And this mean if it have two weapons second one will not be used.