fheroes AI mixes oddly with Berserk #7716
Granfalegion
started this conversation in
Ideas
Replies: 1 comment 4 replies
-
In fheroes2, units under the influence of the Berserker spell always attack the unit closest to them, but they can do this generally by choosing an arbitrary cell next to the target unit, not necessarily strictly the closest to them. This brings some variety and is not used to maximize the future utility. In this case, it's pure coincidence. |
Beta Was this translation helpful? Give feedback.
4 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
fheroes AI differs from vanilla AI by moving its troops in more advantageous ways. Once a target is established, fHeroes melee troops often move as far as they can to the rear of their target before attacking, thus putting them closer to the enemy rearline and in a better position to attack opposing ranged troops the next turn. This differs from vanilla AI, which typically takes the shortest path it can to its target and stays there until the melee completes or a higher priority target enters its range.
This appears to have odd effects when applied to troops under the influence of Berserker. Berserk troops spend their turn charging the nearest other stack of creatures, whether friend or foe, and then attacking them. However, in fHeroes, Berserk troops still appear to jockey their position in a way that puts them close to the enemy battle line.
Here's an example clip in action: https://clips.twitch.tv/TallExquisiteTarsierKappaPride-k_HWlKG6NlCkmaSw
Note that the Berserk swordsmen move to the left before attacking their friendly stack. The swordsmen are slowed, so they move only 3 hexes in a turn. They begin the turn 4 hexes away from the nearest opposing stack, the Crusaders. The leftward move allows them to both attack a friendly stack AND ensure that they will be in range of an actual opponent stack the next turn.
While the behavior is strategically correct, being strategically correct is the opposite of the intent of the Berserker spell. The units should not be taking into account future strategic decisions when deciding where to stand to attack their targets. An ideal implementation would replicate the AI's vanilla behavior: Choose a target in range, take the shortest path towards them, and attack. If it is not possible to implement a straightforward charge for Berserk, a fallback could be to at least take into account the ownership of the target stack when deciding how to maneuver for it. If attacking an opposing stack, move toward the opposing rearline; if attacking a friendly stack, move toward the friendly rearline.
Berserker renders a stack out of control and unable to distinguish between friend and foe. fHeroes' AI movement for Berserk troops fails to capture this notion and we observe Berserk troops maximizing their future utility with full knowledge of what troops they will eventually (but not now) consider to be their exclusive enemies again.
Beta Was this translation helpful? Give feedback.
All reactions