Opened 4 years ago

Last modified 3 years ago

#5657 new defect

Starting cavalry hunting only the first 5 chicken

Reported by: elexis Owned by: Freagarach
Priority: Should Have Milestone: Work In Progress
Component: Simulation Keywords:
Cc: Patch: Phab:D2525

Description (last modified by elexis)

In this svn replay with r23293 (Phab:F1188774), nani's starting cavalry hunted the first 5 chicken and then went idle instead of progressing to the other 5 chicken.

As I've never encountered this behavior before, it might be a regression, but perhaps it is a map specificality that the chicken are further apart than usual.

However enabling the RangeOverlay in the DeveloperOverlay (with Alt+D) shows yellow lines between the cavalry and the chicken (as well as deer much further away), which seems to indicate that the RangeQuery of the cavalry should include those chicken.

(Also it seems the RangeQuery returns also animal resources for wood gatherers, which could be optimized out if that isn't a bug.)

cavalry has entityID 24554

Attachments (1)

screenshot1065.jpg (866.7 KB ) - added by elexis 4 years ago.
cavalry has entityID 24554

Download all attachments as: .zip

Change History (13)

by elexis, 4 years ago

Attachment: screenshot1065.jpg added

cavalry has entityID 24554

comment:1 by elexis, 4 years ago

Description: modified (diff)

comment:2 by Freagarach, 4 years ago

The chicken might be in the normal range query of the cavalry, but UnitAI uses some hardcoded values when looking for nearby resources.

comment:3 by elexis, 4 years ago

It's this one?

UnitAI.prototype.FindNearbyResource

let range = 64; TODO: what's a sensible number?

(If so it sounds large enough without having checked)

comment:4 by Freagarach, 4 years ago

Yeah, it seems to be that one. Sorry for not having looked for that myself (it indeed seems large enough).

[EDIT]: The range is too small. It queries as usual but does not find the chicken. We could use the vision range as a sensible number?

Last edited 4 years ago by Freagarach (previous) (diff)

comment:5 by nani, 4 years ago

Seen it happen in a23b some rare times when the two clupms of chickens are in opposites sides of the cc.

comment:6 by elexis, 4 years ago

Keywords: regression removed
Milestone: Alpha 24
Resolution: wontfix
Status: newclosed

I suppose closed as whatever

comment:7 by elexis, 4 years ago

I have trouble believing that the range is too short, judging from the screenshot that shows about 3 terrain tile distance, accounting for a factor 4 of pathfinder gridsize / terrainsize.

Perhaps it's rather the CheckTargetVisible condition that makes it exclude that chicken in which it's super-won't fix.

comment:8 by Freagarach, 4 years ago

Don't forget that the distance is measured from where it has slain the last chicken. (I will test when I can start the game again.)

(I've had it quite often actually, both in A23b and A24.)

Last edited 4 years ago by Freagarach (previous) (diff)

comment:9 by Freagarach, 4 years ago

Resolution: wontfix
Status: closedreopened

Increasing the range means the chicken on the other side of the CC are found just fine.

I understand that there is not really a "bug" now, but apparently this behaviour was unexpected, hence I reopen the ticket.

The range for auto-gathering was introduced in r7827. In r7904 that range was increased (doubled). Since both commits predate the ([EDIT]: currently public) IRC-logs and I haven't found any info on the forums, I could not find why the numbers were chosen, though they seem rather arbitrary.

My proposal would be to use the vision range for these kind of queries (auto-gathering and auto-building). That also has a nice meaning: if you can see another target, approach that. This will not solve all peculiarities, because one just shifts the problem -- from 64 m to whatever the vision range is -- but it will at least be less arbitrary and unexpected?

Last edited 4 years ago by Freagarach (previous) (diff)

comment:10 by elexis, 4 years ago

Milestone: Backlog

predate the IRC-logs

irclogs exist since 2003, the channel is public since the open-sourcing in july 2007, but the logs have not been published yet. I couldn't find anything in the 2010 folder for "range" and "gather" quickly, but I didn't really spend time on it.

(Also put every open ticket on a milestone and no closed tickets on the backlog milestone)

comment:11 by elexis, 4 years ago

Milestone: BacklogWork In Progress
Patch: Phab:D2525

comment:12 by Silier, 3 years ago

Owner: set to Freagarach
Status: reopenednew
Note: See TracTickets for help on using tickets.