OpenXcom Forum

Modding => OpenXcom Extended => OXCE Support => Topic started by: Ethereal on December 10, 2019, 08:50:14 pm

Title: [Answered] AI Behavior and Reaction
Post by: Ethereal 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.
Title: Re: AI Behavior and Reaction
Post by: The Martian 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
Title: Re: AI Behavior and Reaction
Post by: Meridian 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).
Title: Re: AI Behavior and Reaction
Post by: Ethereal 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.
Title: Re: AI Behavior and Reaction
Post by: Meridian 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.
Title: Re: AI Behavior and Reaction
Post by: The Martian 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 (https://github.com/ohartenstein23/OpenXcom/commit/17879ecceaaa004f9d80c2a227193d904f44e5e4).

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?
Title: Re: AI Behavior and Reaction
Post by: Ethereal 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.
Title: Re: AI Behavior and Reaction
Post by: Yankes 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.
Title: Re: AI Behavior and Reaction
Post by: Ethereal 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.
Title: Re: AI Behavior and Reaction
Post by: Yankes 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.