-
-
Notifications
You must be signed in to change notification settings - Fork 359
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Properly evaluate potential attack positions for wide units #8036
Properly evaluate potential attack positions for wide units #8036
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Clang-Tidy
found issue(s) with the introduced code (1/1)
Hi, @oleg-derevenetz ! |
Hi @Branikolog
This question is not so easy to answer :) Currently in
cells adjacent to shooting units have better "value" than other cells, so AI prefers to use these cells to block archers, even if it doesn't want to attack them immediately, and this works just fine with non-wide attacking units (and with wide attacking units when potential targets are not so far away from each other). BUT, since "position" in
or this:
Although in both cases a wide unit is able to simultaneously attack one unit and block another, AI has no idea about that, because both units do not have common adjacent cells. That's why in your video AI is not able to block Trolls and attack Titans at the same time. With this PR, "position" means "position", i.e. a collection of one to two cells which an attacking unit may occupy, and not a "cell", so now AI understands that it can take a position like this (
to attack one unit and block another. I must say that although the observable behavior is improved only for wide units, the position evaluation logic has been heavily rewritten, so the changes will indirectly affect the non-wide units as well (but they just should work as before, i.e. there should be no obvious regressions). |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi @oleg-derevenetz , I left 2 comments here. Could you please take a look once you have free time?
Hi @drevoborod , if you have time could you please test these changes? @Branikolog is not available the next few days. |
Hi @ihhub there is no hurry with this PR, it is not planned for the upcoming release. |
Hi @oleg-derevenetz , this is true. @Branikolog is going to be busy with another side-tasks for a couple of days after the release. Moreover, I added 1.0.11 release as we are not ready to release 1.1.0 as the primary feature of the release is a working Editor. I am changing the target release for this PR for 1.0.11. |
At first glance, everything seems to be ok - the AI learned to block archers which are two or one cells away from meelee attackers in any direction. |
The logic for performing evaluations of this type is not currently implemented. And in any case, this is not trivial, because there certainly will be cases in which AI will have to make a choice between blocking archers (or dealing maximum damage to multiple enemy units with a penetrating attack) and protecting a nearby friendly unit from a retaliatory penetrating attack. |
If AI decided that it would be more profitable to attack your dragons at the moment, then it cannot block your shooters during this attack, because friendly dragons would be damaged by the penetrating attack from that angle. |
AI will not try to block shooters at all costs. If there is more dangerous unit far away from shooters, AI will attack that unit, trying to eliminate a bigger threat. Blocking of archers is not an end in itself, but a nice bonus to attacking the most threatening unit (it can be the archers himself or one of his neighbors). |
Yeah, there is already #7685 about that. |
Hi @drevoborod , are we good to go with this change? |
In my opinion, yes, we are. |
@oleg-derevenetz , huge thanks for this improvement! @drevoborod , thanks a lot for your help! |
fix #7786
fheroes2.engine.version_.1.0.9.2023-11-11.17-40-09.mp4