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 the hero's path, taking into account the destination reached on the next turn #8797

Open LeHerosInconnu opened 1 month ago

LeHerosInconnu commented 1 month ago

Preliminary checks

Describe the problem requiring a solution

In fheroes2, optimize the hero's path, taking into account the destination reached on the next turn.

In the example, the hero will reach the gems mine the following turn. For the hero's path, for the current day (green arrows), we can see that the hero's last step is taken horizontally. On the following turn, we can see that the hero will make a diagonal move to reach the gems mine (the last step to reach the brown cross). If the proposed path is followed, the next turn the hero will have 1050 movement points left when he reaches the gems mine. Now, if the path is optimized by making a diagonal move for the hero's last step, the hero will have 1100 movement points left when he reaches the gems mine.

In fheroes2:

Path optimize 01 001

Path optimize 01 002

Path optimize 01 003

Default path, 1050 movement points left. Path optimize 01 004

Optimized path, 1100 movement points left. Path optimize 01 005

Here is the save file: Path optimize 01.zip

Describe the possible solution

Optimize the hero's path, taking into account the destination reached on the next turn.

Additional info

No response