Skip to content

Hunter: Use GetPointsInRadius() instead of square - #1948

Open
morganchristiansson wants to merge 6 commits into
Return-To-The-Roots:masterfrom
morganchristiansson:hunter-radius
Open

morganchristiansson wants to merge 6 commits into
Return-To-The-Roots:masterfrom
morganchristiansson:hunter-radius

Conversation

@morganchristiansson

Copy link
Copy Markdown
Contributor

Hunter currently uses square, comments says it should be circle.
Update it to use new GetPointsInRadius() pattern from nofSkinner.cpp to find animals.
Also extract ANIMAL_RADIUS to shared constant used by Hunter, AI Hunter builder and Skinner.

This supports #1946 which displays building radius as outline.

Comment thread libs/s25main/figures/nofHunter.cpp
Comment thread libs/s25main/ai/aijh/AIPlayerJH.cpp Outdated
Comment thread libs/s25main/gameData/GameConsts.h Outdated
@morganchristiansson
morganchristiansson force-pushed the hunter-radius branch 2 times, most recently from 5cf72c5 to e641dee Compare June 16, 2026 09:06
@morganchristiansson

Copy link
Copy Markdown
Contributor Author

Need some help here.
Test is failing on auto replay tests where AI behaviour has changed due to square->radius.

AI started bumping replay versions to keep legacy square for backwards compatibility. Is that a solution? But then we leave the old ugly square code in place.
https://github.com/Return-To-The-Roots/s25client/actions/runs/27752624950/job/82121998496?pr=1948

@morganchristiansson
morganchristiansson marked this pull request as ready for review June 18, 2026 15:41
@Flamefire

Copy link
Copy Markdown
Member

AI started bumping replay versions to keep legacy square for backwards compatibility. Is that a solution? But then we leave the old ugly square code in place.

I'd prefer that, it is valuable to keep replay working to recreate failures

@morganchristiansson

Copy link
Copy Markdown
Contributor Author

Ran the auto replay test locally and it passes now.
Not entirely happy about adding GameWorldBase::GetReplayMinorVersion() but some method to make current replay file version available is needed.

Comment thread libs/s25main/world/GameWorldBase.h Outdated
Comment thread tests/s25Main/autoplay/main.cpp Outdated
@morganchristiansson

Copy link
Copy Markdown
Contributor Author

Also, my memory may be wrong, but I recall original S2 the hunter would approach prey to within ~2 tiles and shoot at close range.
Observing the hunter in RttR he can be quite far away when shooting. Code says 4 tiles. It's not always clear which animal he's shooting, and sometimes there's other animals closer.

Not really in scope, except changing this might also affect replay compatibility.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants