Closed LeHerosInconnu closed 3 years ago
@LeHerosInconnu This is partially addressed by #2155 .
AI heroes like to play with Stone Liths. :)
Already fixed in the pull request. They always had some internal value for the lack of better logic. Now stone liths considered valuable only if not every exit is explored, otherwise it's ignored. Note that current AI already can plan paths through stone liths when other side is not in the fog of war.
In the original game, there are always defending creatures in all AI castles. It is extremely rare to see defenseless AI castles (usually when there are no more creatures to recruit or on day 1 when the AI hasn't had the hand yet to recruit the creatures).
This a lazy and wrong approach; it shouldn't be done this way. Gold is very limited in this game, even for AI. Useless garrison = less buildings are recruiting power when it matters.
Current AI buys creatures only if castle is under threat (enemy army detected within certain radius). Day 7 or any other day handled the same. I believe that current radius should cover most cases, but we can easily adjust it if you find a way to exploit. Also note if multiple castles are under attack it will reinforce most valuable ones first.
In fheroes2, during the combat, the AI hero runs away with a still large army when he could do more damage to the human player's troops without risking losing the battle.
Threshold right now is 10% of enemy army. We can add a more elaborate logic later, but it's not a top priority. There's bigger fish to fry.
I appreciate the feedback though, it is timely as 0.8.3 release is around the corner. A lot of mentioned issues (such as not flagging certain objects or threat radius) are easily adjustable. Potentially we could add a AI config variables for testers to see if it improves the behavior.
Hi @idshibanov,
Note that current AI already can plan paths through stone liths when other side is not in the fog of war.
That's really great. :) Are the possible opposing moves (AI and human players) with the stone liths also taken into account to estimate a possible threat?
Current AI buys creatures only if castle is under threat (enemy army detected within certain radius). Day 7 or any other day handled the same. I believe that current radius should cover most cases, but we can easily adjust it if you find a way to exploit. Also note if multiple castles are under attack it will reinforce most valuable ones first.
That's nice too. :)
In fheroes2, during the combat, the AI hero runs away with a still large army when he could do more damage to the human player's troops without risking losing the battle.
Threshold right now is 10% of enemy army. We can add a more elaborate logic later, but it's not a top priority. There's bigger fish to fry.
Okay, we'll see about that later.
I appreciate the feedback though, it is timely as 0.8.3 release is around the corner. A lot of mentioned issues (such as not flagging certain objects or threat radius) are easily adjustable. Potentially we could add a AI config variables for testers to see if it improves the behavior.
Yes, that would be good for testing. Also, we would need some cheat codes like in the original game for testing. Remove the war fog, add creatures (black dragons) to the hero's army, have infinite movement for the heroes, get resources, etc.
I made some additional tests with the version fheroes2 0.8.2 2108, here is what I observed. Note: All of this is still valid with the version fheroes2 0.8.3 2163.
The AI hero Ruby does not capture the defenseless Bloodreign castle where she could have recruited additional troops. Instead, Ruby goes south where the human hero Dimitry will be able to easily attack her.
In fheroes2:
End the turn. Here is the save file: Ai dont capture free castle.zip
It is easy to trick the IA into a trap.
The AI hero Ariel attacks human hero Ambrose in Xabran Castle. If all the troops in the garrison are transferred to Ambrose's army before the end of the turn, Ariel does not attack Ambrose.
Before attacking a castle, AI should consider which garrison troops will join the defending hero in the attack.
Also, at the end of this combat, the AI hero does not flee when she has only a few Dwarves left, and she loses his few Dwarves following a retaliation during their last attack (the "10% of enemy army" rule previously mentioned does not seem to be applied here). Make the combat by passing the turn for all the defensive troops.
Ariel attacks Ambrose: "Broken_Alliance_0028p.sav". In fheroes2:
The AI hero Carlawn attacks human hero Ector in Sheltemburg Castle. If all the troops in the garrison are transferred to Ector's army before the end of the turn, Carlawn does not attack Ector.
Carlawn attacks Ector: "Broken_Alliance_0034.sav". In fheroes2:
The AI hero Gem attacks human hero Ector in Sheltemburg Castle. If all the troops in the garrison are transferred to Ector's army before the end of the turn, Gem does not attack Ector.
Carlawn attacks Ector: "Broken_Alliance_0036.sav". In fheroes2:
Also, the IA should optimize the placement of its troops during combat. In the examples, Titans are positioned after the Archmagi in the order of play, while Titans do more damage. In this case Titans should be positioned to act before the Archmagi.
In fheroes2:
End the turn. Here are the save files: AI trap.zip
Here are some cases where the IA has no troops in defense in its castle despite a nearby threat.
Dimitry near castle Woodhaven (before and after threat): "Castle no defense 30.sav" and "Castle no defense 31.sav". In fheroes2:
Dimitry near castle Bloodreign (before and after threat): "Castle no defense 20.sav" and "Broken_Alliance_0045n.sav". Ector near castle Dragontooth (before and after threat): "Castle no defense 12.sav" and "Castle no defense 13.sav". Sir Gallant near castle Dragontooth (before and after threat): "Castle no defense 10.sav" and "Castle no defense 11.sav". Ambrose near castle Whiteshield: "Castle no defense 04.sav" and "Castle no defense 04a.sav".
Here are the save files and screenshots: Castle no defense threat.zip
The AI hero Wrathmont disembarks at a place where he has no choice but to re-embark the next turn: "Before Ai disembark no way.sav" and "Ai disembark no way 01.sav".
In fheroes2:
End the turn. Here are the save files: AI disembark no way.zip
Hoping that this can help. :)
Are the possible opposing moves (AI and human players) with the stone liths also taken into account to estimate a possible threat?
Yes, they should be accounted for. In the future same logic could handle Dimension Door calculations, but it's not a priority for now.
The AI hero Ruby does not capture the defenseless Bloodreign castle where she could have recruited additional troops. Instead, Ruby goes south where the human hero Dimitry will be able to easily attack her.
This is a bug/oversight which I would be able to fix if you reported it a bit earlier :) Basically AI is spooked by your hero Dimitry but picks the wrong direction to run (targeting castle Woodhaven).
Before attacking a castle, AI should consider which garrison troops will join the defending hero in the attack.
Yes, this is exactly what's missing. We have to add a function that will calculate full potential force, instead of taking the garrison via Castle::GetArmy
call.
Also, the IA should optimize the placement of its troops during combat.
Another feature that's planned but not implemented yet. We have a function for it, but no code there yet :)
Here are some cases where the IA has no troops in defense in its castle despite a nearby threat.
Definitely a bug, it is supposed to work. I'll take a look at the save to fix.
Hi @LeHerosInconnu could you please update this issue as we made some changes since this issue was created?
Hello @ihhub,
Hi @LeHerosInconnu could you please update this issue as we made some changes since this issue was created?
Some remarks concerning a game played with version 0.8.4 2479.
A simple rule to apply for AI regarding resources:
I updated the first post about teleporters and the defense of castles.
Hi @LeHerosInconnu , could you please update your findings. Recently we fixed castle's defence tactics. If AI has enough resources it'll buy monsters. Not all of your saves will have this due to lack of gold in AI but for some AI buys monsters to prevent capturing.
Hello @ihhub,
Hi @LeHerosInconnu , could you please update your findings. Recently we fixed castle's defence tactics. If AI has enough resources it'll buy monsters. Not all of your saves will have this due to lack of gold in AI but for some AI buys monsters to prevent capturing.
Okay, I have a test in progress.
Hello @ihhub,
Hello @ihhub,
Hi @LeHerosInconnu , could you please update your findings. Recently we fixed castle's defence tactics. If AI has enough resources it'll buy monsters. Not all of your saves will have this due to lack of gold in AI but for some AI buys monsters to prevent capturing.
Okay, I have a test in progress.
Some remarks concerning a test with version 0.8.4 2704.
I updated the first post.
Already Month 2 in the game, AI's Barbarian heroes do not use magic during combat.
Fix is already on the way. AI forgot to buy the book :)
AI heroes need to be improved at capturing/recapturing resource generators such as Magic Gardens, etc. especially when the "world: Wind/Water Mills and Magic Garden can be captured" option is enabled.
Here AI is just isn't aware of this option and won't go for empty Magic gardens. We can adjust priority later.
Most of the things under this issue should be fixed after recent PRs. I think we could close this one after a round of testing.
Shall we close this issue? Did we address all requirements here?
I did a test with fheroes2 0.9.2 3284.
AI heroes keep landing in places where the only possible action is to re-embark.
In fheroes2:
End the turn.
Here is the save file (before the AI hero landed): Before AI land no way 10.zip
I'm closing this issue in favor for #4464 where we're going to address AI behavior in relation to boats and beach tiles.
In the original game, the AI always collects resources, visits locations with potential resources, and captures mines and the like when possible.
In fheroes2, even if the AI doesn't need resources in the short term, it will always need them in the long term and most importantly it prevents the human player from collecting these resources.
Lean To not visited (and uncaptured resources and Water Wheel, and another Lean To not visited not far away to the northwest): "Lean To 01.sav". In fheroes2:
Magic Garden not captured: "Garden 01.sav". In fheroes2:
Pile of Ore not collected, and Magic Gardens not captured: "Ore pile 01.sav". In fheroes2:
Here are the save files: Resources not captured.zip
In fheroes2, during the combat, the AI hero runs away with a still large army when he could do more damage to the human player's troops without risking losing the battle.
In the original game, AI heroes always try to do the maximum damage to the human player's troops (apart from mandatory attacks on shooters, etc.) because the human player does not have significant resources to replace his lost troops. Again, this is an AI "strategy" to reduce the power of the human player's armies.
Edit 2020/12/27.
Some remarks concerning a game played with version 0.8.4 2479.
A simple rule to apply for AI regarding resources:
In fheroes2:
Orange AI hero captured the gold mine, but did not pick up the piles of resources or capture the Magic Gardens:
Red AI player did not pick up easily accessible resources or capture the Magic Garden near the captured resource generators:
Green AI hero did not pick up the resource stack right next to his position:
Red AI hero did not capture the Magic Garden located near his path to capture the gold mine:
Red AI hero captured the gold mine but did not capture the Magic Gardens:
Orange AI heroes did not capture the Magic Garden located near their position:
Edit 2021/02/02.
Some remarks concerning a test with version 0.8.4 2704.
Edit 2021/04/28.
I did a test with fheroes2 0.9.2 3284.
AI heroes keep landing in places where the only possible action is to re-embark.
In fheroes2:
End the turn.
Here is the save file (before the AI hero landed): Before AI land no way 10.zip