Comments (8)
Hi @Branikolog this behavior should be changed by #7986.
from fheroes2.
Hi, @oleg-derevenetz
Oh, sorry, missed this items in the PR!
Should I close the issue now?
from fheroes2.
Hi @Branikolog that PR fixes the excessive desire to retreat from archers or too slow units, but archers will still shoot at possibly blocking stacks.
I also suggest defending ranged troop focusing the most dangerous attacking stack anyway, rather than running from or killing a weak stack which is about to block the defending ranger troop. In my example above Centaurs could attack Rangers and prevent losses, but they decided to attack weak walking centaur and allowed Rangers to shoot once.
This is a rather vague wish. If we follow this literally, then the stack never need to retreat at all, because the default behavior is to just attack the most dangerous attacking stack. But the retreat mechanism is also useful:
fheroes2.engine.version_.1.0.9.2023-10-26.12-35-45.mp4
from fheroes2.
@oleg-derevenetz
Indeed.
But in some cases this logic allows to demolish the significant amount of troops, just because ranged troop made the first, especially effective shot.
You know, I'm doing quite a lot of tests and in some cases, when comparable armies are met, the only non-optimal decision can cause an absolutely different outcome. I've recently pushed two large stacks of troops against each other and the battle could be finished either with victory or loss just because of the early first attack dispersion. And the number of troops left was even far from minimal. So the success of the first attack had a drastic influence on the outcome.
So I suggest to make a few checks in the case some troops are going to block the ranged defending one.
The first check should consider the potential losses, when the attacking melee troop reached defending one. If the damage is not really high, and the ranged troop could kill attacker with retaliation or with 1-2 melee attacks then lower the attacking priority for attacker in favor of dealing the damage to other threatening troops.
And the second check should consider whether any troop of attacking side can do a high damage right in the current turn (after the defending ranged troop).
Currently, AI behaves properly in this regard, when opposing two stacks, that can both reach him:
2023-10-26.14-00-19.mp4
But in the case of ranged attacking stack, AI ignores him focusing the potential blocking one instead:
2023-10-26.13-55-50.mp4
from fheroes2.
So I suggest to make a few checks in the case some troops are going to block the ranged defending one.
The first check should consider the potential losses, when the attacking melee troop reached defending one. If the damage is not really high, and the ranged troop could kill attacker with retaliation or with 1-2 melee attacks then lower the attacking priority for attacker in favor of dealing the damage to other threatening troops.
And the second check should consider whether any troop of attacking side can do a high damage right in the current turn (after the defending ranged troop).
After some thought, I decided to remove the corner-case heuristics of this kind completely within the scope of #7986. This PR in any case tightens the requirements for when a shooting unit should retreat.
from fheroes2.
I suppose that we can close this because #7986 addressed all the described misbehaviors:
fheroes2.engine.version_.1.0.9.2023-10-27.21-02-04.mp4
fheroes2.engine.version_.1.0.9.2023-10-27.21-03-52.mp4
from fheroes2.
@Branikolog , please check and close this issue is needed.
from fheroes2.
The problem of inadequate maneuvering of archers on the battlefield is no longer relevant.
Target selection is better now too.
Thanks, @oleg-derevenetz , for improving the battle AI! I'm pretty sure, a huge part of players are not even aware of using such tricks during battles. Auto battles will soon make manual battles redundant with such an efficacious logic. :)
from fheroes2.
Related Issues (20)
- AI attacks hero and ignores castle on day 7, letting the opponent reinforce
- AI uses non optimal path to capture several targets. HOT 6
- Assertion failure when opening a jail located next to another jail HOT 1
- Battle: improve behavior when ghosts are in the team
- Option to play music without interrupting castle music HOT 2
- Provide an option not to animate creatures on well screen HOT 9
- Add monster info popup in battle mode HOT 4
- Game exits (crashes) on right click on hero inside the enemy castle
- Battle: computer attacks me first and lose the battle HOT 16
- Teach AI to garrison slower troops in the castle at the end of turn HOT 9
- Adventure map: computer runs near me with weak army, he can see no danger HOT 1
- Incorrect scaling when Windows DPI is set to other than 100% HOT 3
- Add a popup window for hotkeys info/menu by pressing a keyboard key HOT 5
- Castle construction screen, statue description is not translated on all non-English languages HOT 3
- Add description of how much gold was paid to surrender in battle result dialog HOT 8
- Adventure map, fog of war generation issue
- Changing game resolution in the Editor gives unexpected with the side panel and map area HOT 4
- Combat, AI uses attacking spells to demolish a single creature HOT 10
- Build fails: "end-of-line within string" HOT 19
- Debian HOT 4
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from fheroes2.