ihhub / fheroes2

fheroes2 is a recreation of Heroes of Might and Magic II game engine.
https://ihhub.github.io/fheroes2/
GNU General Public License v2.0
2.67k stars 373 forks source link

AI doesn't perform sufficient protection for victory condition castle #5820

Open Branikolog opened 2 years ago

Branikolog commented 2 years ago

Preliminary checks

Describe the problem requiring a solution

image Rushing a weaker hero standing nearby AI left castle empty. Evil_3_0028_1.zip

Describe the possible solution

AI should consider the threat near castle before leaving it. The most safe pattern is to make AI count his moves so he could return back to defending castle on the current turn. More complex solution is to teach AI analyzing the nearest area. If there's an enemy hero who could possibly reach the castle, then AI shouldn't end turn outside the castle. If AI could reach all threating heroes within current turn, then he can leave castle for 1 turn without protection. Both solutions have pros and cons. 1st solution will make AI more stationary regarding his patrol status. 2nd solution could be abused, if player could DD to the empty castle from more distant area, than AI considers.

Additional info

No response

Alucard648 commented 2 years ago

Also make sure that AI can use Town Portal spell, if he has one, for bringing more troops and best hero to threatened vital city, as well as other end-game logistics.