Opened 11 years ago
Closed 3 years ago
#1832 closed defect (fixed)
Entities should abandon chase if their target is in FOW
Reported by: | mimo | Owned by: | Freagarach |
---|---|---|---|
Priority: | Should Have | Milestone: | Alpha 25 |
Component: | Simulation | Keywords: | |
Cc: | knight.erraunt@… | Patch: |
Description (last modified by )
When you attack an dangerous animal, and then retreat, this animal will always chase you even if you flee to the opposite side of the map, completely out of its vision. There is a comment in the ShouldAbandonChase method saying that CCmpUnitMotion should take care to stop it if the target is lost in FoW, but this does not seem to work with animals. So here is a simple patch which stops the chase if the target is too far from the animal which chase it.
Attachments (1)
Change History (22)
by , 11 years ago
Attachment: | abandonchase.diff added |
---|
follow-up: 2 comment:1 by , 11 years ago
Keywords: | review removed |
---|
comment:2 by , 11 years ago
Replying to leper:
I took a look at it and the cause of this behaviour is that the "Attacked" handler for animals calls this.Attack() which issues a forced attack order, which shouldn't be used in this case.
I think something similar to Gather() and PerformGather() is the proper solution to this problem.
Yes, I've seen this.Attack() and also thought it was the reason. So I changed the force to false there and tried again, without success. So I thought from it that may-be the notion of FoW would not apply to gaia ?
comment:3 by , 11 years ago
I just tested it and it works just fine with force set to false in Attack(), there are some small issues with ranged units though (as the animal vision range isn't huge and the attacker could be to far away).
FoW does apply to gaia, but as there are gaia entities all over the map that isn't really useful. The vision range limitation in ShouldAbandonChase() applies however.
comment:4 by , 11 years ago
Of course, I mixed the problems, sorry. I tested again and you are right. But I was not satisfied with the version without the force because these poor animals would not be allowed to defend themselves against range unit : The typical vision range of animals is 15-20, while we would need something at least 60 to cover all range attacks. And I'm not sure that such a big change would not have other side effect elsewhere.
But I agree my solution could look more as a patch than a proper fix. So let's keep this ticket open, only as a bug report.
comment:5 by , 11 years ago
Keywords: | patch removed |
---|---|
Summary: | [PATCH] Animals should abandon chase if their target is too far → Animals should abandon chase if their target is too far |
comment:6 by , 11 years ago
I think having them move to the last known position first would be a sane thing to do. (That way we don't have to increase the vision range, and this behaviour would work for units too (where force should also be false IMO))
comment:7 by , 11 years ago
Keywords: | patch added; animal removed |
---|---|
Milestone: | Backlog → Alpha 13 |
comment:8 by , 11 years ago
Milestone: | Alpha 13 → Alpha 14 |
---|---|
Summary: | Animals should abandon chase if their target is too far → [PATCH] Animals should abandon chase if their target is too far |
comment:9 by , 11 years ago
Milestone: | Alpha 14 → Alpha 15 |
---|
comment:10 by , 11 years ago
Keywords: | patch removed |
---|---|
Milestone: | Alpha 15 → Backlog |
Summary: | [PATCH] Animals should abandon chase if their target is too far → Animals should abandon chase if their target is too far |
comment:12 by , 8 years ago
Summary: | Animals should abandon chase if their target is too far → Entities should abandon chase if their target is in FOW |
---|
comment:13 by , 8 years ago
Ok, I have investigated and a very simple fix - changing if (!this.GetStance().respondChaseBeyondVision) to
this.IsAnimal()) |
seems to solve the problem for animals - at least it seems like it works. There is no problem with the archers outranging the animals vision sight as the command issued on attacked animals is APPROACHING and not CHASING. Nevertheless I kind of dislike the fact that so many things are solved by hard coded if's for animals, and the amount seems to grow - I recently made a patch (#3444) which is solved in a similar manner. I wonder if it was possible to separate the AI of animals from that of other units? It would probably introduce code duplication, could someone of the architects/experience developers comment on this? As for #3394 - judging from the code it appears that CCmpUnitMotion should take care of it, will try to look at it.
comment:14 by , 8 years ago
Cc: | added |
---|---|
Keywords: | rfc patch added |
Milestone: | Backlog → Alpha 21 |
comment:15 by , 8 years ago
Keywords: | rfc patch removed |
---|---|
Milestone: | Alpha 21 → Backlog |
comment:16 by , 8 years ago
The change mentioned by me above does not solve the problem. As animals are approaching the target in the FOW, and we cannot change that due to the reasons mentioned in the posts above.
comment:18 by , 4 years ago
Component: | Core engine → Simulation |
---|
Would be fixed by #5593, Phab:D2646.
comment:20 by , 3 years ago
Milestone: | Backlog → Alpha 25 |
---|---|
Owner: | set to |
I took a look at it and the cause of this behaviour is that the "Attacked" handler for animals calls this.Attack() which issues a forced attack order, which shouldn't be used in this case.
I think something similar to Gather() and PerformGather() is the proper solution to this problem.