fheroes2 icon indicating copy to clipboard operation
fheroes2 copied to clipboard

Combat, AI behavior, AI casts not necessary spells in combat, here Slow and Haste (0.9.6 4111)

Open LeHerosInconnu opened this issue 3 years ago • 4 comments

Preliminary checks

Describe the problem requiring a solution

In fheroes2, AI casts not necessary spells in combat, here Slow and Haste. AI casts the Slow spell on the troop of Hydras which is already the slowest troop and attacks this slowed troop in close combat anyway. AI casts the Haste spell on his troops who are already faster, and who can already reach the opposing troop.

In fheroes2:

https://user-images.githubusercontent.com/43583994/131835286-9fe53b2f-6a45-47a9-9675-8f7d5bc3b7c6.mp4

Flint attacks Roxana.

Here is the save file: AI casts slow no need 01.zip

Describe the possible solution

AI should economize his spell points rather than casting unnecessary spells.

Additional info

No response

LeHerosInconnu avatar Sep 02 '21 11:09 LeHerosInconnu

This issue should be retested on the latest version.

ihhub avatar Nov 13 '21 06:11 ihhub

Hello @ihhub and @vincent-grosbois,

This issue should be retested on the latest version.

I did some tests with version 0.9.9 4584.

With the save file "AI casts slow no need 01.sav", the AI still uses the Slow and Haste spells.

In fheroes2:

https://user-images.githubusercontent.com/43583994/141683600-82bd77eb-31f1-495b-82ba-0dfeb6270b3c.mp4

With a scenario started from the beginning, it's different. In this particular case, where the AI is adopting a defensive strategy, the Slow spell could be used at start of the combat. :) Also, the AI does not use Dispel Magic, Magic Arrow or Curse, and still use the spell Haste at the end of the combat.

In fheroes2:

AI spells 02

https://user-images.githubusercontent.com/43583994/141684872-1d6ac4ee-d6eb-4ab0-aea7-800cf1ecebe1.mp4

Regarding this remark:

This should somehwat improve issue https://github.com/ihhub/fheroes2/issues/4129 even though the problem will still remain that enemy will cast a slow spell even though it has very low score, if it's the only spell available

Wouldn't it be possible to make it so that when the AI hero has only one/several spell(s), and these spells are not "useful", the hero doesn't cast a spell rather than casting a not "useful" spell thus saving spell points?

Here is the test scenario file: 0 9951.zip

LeHerosInconnu avatar Nov 14 '21 14:11 LeHerosInconnu

Thanks ! I'm trying to have a look at the file but I'm not sure where I should extract the map file, any idea?

Wouldn't it be possible to make it so that when the AI hero has only one/several spell(s), and these spells are not "useful", the hero doesn't cast a spell rather than casting a not "useful" spell thus saving spell points?

Yes it's possible but it requires much more work than what we intended initially here. It's very complex to figure out if using a spell like slow or haste is 100% useless, in which case it would have a score of exactly 0 and we wouldn't cast it.

vincent-grosbois avatar Nov 16 '21 14:11 vincent-grosbois

Hello @vincent-grosbois,

Thanks ! I'm trying to have a look at the file but I'm not sure where I should extract the map file, any idea?

After extraction from .zip file, just put "0 9951.MX2" file into the "MAPS" folder of fheroes2.

For "AI casts slow no need 01.sav" file, just put it here (depending your system):

Save location 01

Wouldn't it be possible to make it so that when the AI hero has only one/several spell(s), and these spells are not "useful", the hero doesn't cast a spell rather than casting a not "useful" spell thus saving spell points?

Yes it's possible but it requires much more work than what we intended initially here. It's very complex to figure out if using a spell like slow or haste is 100% useless, in which case it would have a score of exactly 0 and we wouldn't cast it.

Okay.

LeHerosInconnu avatar Nov 16 '21 15:11 LeHerosInconnu