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.58k stars 360 forks source link

Adventure map, optimize AI behavior of heroes during movement (1.1.0 8733) #8799

Open LeHerosInconnu opened 1 month ago

LeHerosInconnu commented 1 month ago

Preliminary checks

Describe the problem requiring a solution

In the example, the green AI player's hero Troyan bypasses a stack of resources to make his move. This is often the case, from what I've observed in my games. However, not picking up the stack of resources during the move doesn't benefit the hero's movement points. By bypassing the stack of resources, the hero makes two diagonal steps, for a total of 2 x 150 movement points, in the case of terrain with no penalty. A total of 300 movement points. Collecting the stack of resources as he moves, the hero would spend 100 movement points to pick up the stack of resources, then 2 x 100 movement points to move to the same location on the adventure map. The same total of 300 movement points as before, with the added bonus of having picked up the stack of resources, thus avoiding an additional displacement to another hero or to the same hero later to pick up the stack of resources.

In fheroes2:

https://github.com/ihhub/fheroes2/assets/43583994/c8f6002f-53c2-40a3-90b2-c3b5ba22a0c4

Here is the save file: AI contourne ressource 01.zip

Describe the possible solution

In similar cases to the one presented, make the hero pick up the stack of resources instead of bypassing it.

Additional info

No response