Skip to content
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

Handle the AI hero's patrol mode in the AI pathfinder #9016

Merged
merged 6 commits into from
Jul 31, 2024

Conversation

oleg-derevenetz
Copy link
Collaborator

@oleg-derevenetz oleg-derevenetz commented Jul 30, 2024

fix #9015

Currently in the master branch, the "patrol mode" is implemented as follows: objects outside the patrol radius are simply not considered as targets for the hero in "patrol mode". This leads to the possibility of behavior like this:

fheroes2.engine.version_.1.1.1.2024-07-30.19-06-10.mp4

This hero has the patrol mode enabled and a patrol radius of 4 tiles, thus, the artifact is "sort of" in this radius, so he does not hesitate to simply run through the already-explored territory to this object, even along a trajectory that is outside the patrol zone. I believe something similar could have happened in #9015, just on a larger scale.

With this PR:

fheroes2.engine.version_.1.1.1.2024-07-30.19-11-41.mp4

Also, this PR removes any restrictions on the use of any adventure spells by heroes in patrol mode to pave the way. For instance, now such heroes can use Town Portal to teleport to any town or castle within their patrol radius.

@oleg-derevenetz oleg-derevenetz marked this pull request as draft July 30, 2024 14:11
@oleg-derevenetz oleg-derevenetz added bug Something doesn't work AI Artificial intelligence behaviour labels Jul 30, 2024
@oleg-derevenetz oleg-derevenetz added this to the 1.1.2 milestone Jul 30, 2024
@oleg-derevenetz oleg-derevenetz marked this pull request as ready for review July 30, 2024 20:50
@ihhub
Copy link
Owner

ihhub commented Jul 31, 2024

I believe this PR should also fix #2315.

@ihhub ihhub merged commit 6e5d73f into ihhub:master Jul 31, 2024
20 checks passed
@ihhub
Copy link
Owner

ihhub commented Jul 31, 2024

@oleg-derevenetz , many thanks for this improvement!

@ihhub
Copy link
Owner

ihhub commented Jul 31, 2024

Hi @oleg-derevenetz , could you please manage the project for a while as I need to solve many personal issues at the moment?

@oleg-derevenetz oleg-derevenetz deleted the ai-patrol-mode-fix branch July 31, 2024 14:31
@oleg-derevenetz
Copy link
Collaborator Author

Hi @ihhub

could you please manage the project for a while as I need to solve many personal issues at the moment?

Yes, of course. But I am not very familiar with some parts of the project, for example, the Editor. I hope you will be back soon.

@ihhub
Copy link
Owner

ihhub commented Jul 31, 2024

@oleg-derevenetz , thank you so much!

@oleg-derevenetz
Copy link
Collaborator Author

oleg-derevenetz commented Aug 2, 2024

I believe this PR should also fix #2315.

Well, AI heroes of patrol will not return to the "starting point", because this point doesn't have any "special value" for them (and, to be honest, I don't see any reason why it should - why it should be somehow "better" than any other tile in the patrol zone). But of course they will perform a fog discovery within their patrol area (see the video in the PR description), visit castles, regularly hire troops in the external dwellings and so on.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
AI Artificial intelligence behaviour bug Something doesn't work
Projects
None yet
Development

Successfully merging this pull request may close these issues.

AI is ignoring patrol limit
2 participants