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
Improve AI squad pathing and regrouping behavior. #20228
Conversation
I think I have a more performance friendly (maybe) and simple idea: (1). Leader won't change until its death. Therefore, we don't have to calculate group center every time. There are some shortcomings for (2) on my own application when at tunnel and overpass bridge, which may need some techniques on making leader to see if the squad is stuck. There is some code related. |
3ea1983
to
b9aeec5
Compare
@dnqbob I implemented your first suggestion to keep the leader. This is nice as we don't have to dig into the remaining length in Move activites any more either which simplifies this change. Since you mentioned issues with the second item I will leave that out for now. I have checked that this still resolves #17327 on the provided test case map. |
b9aeec5
to
123bc46
Compare
123bc46
to
c9b74ed
Compare
needs a rebase |
Ensure the target location can be pathed to by all units in the squad, so the squad won't get stuck if some units can't make it. Improve the choice of leader for the squad. We attempt to a choose a leader whose locomotor is the most restrictive in terms of passable terrain. This maximises the chance that the squad will be able to follow the leader along the path to the target. We also keep this choice of leader as the squad advances, this avoids the squad constantly switching leaders and regrouping backwards in some cases.
c9b74ed
to
30a5bff
Compare
Rebased |
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.
The Ai's squads still seem to be acting very incorrectly. See submarines and cruisers in this replay
This fixes #17327 (comment), but I can't see any fixes to any of the other aforementioned issues, including #21046 Fixing #21046 will likely be quite a bit of scope creep is I'm fine with merging this now |
Depends on #20227. Fixes #17327 and #17327 (comment). Fixes #3763.
Ensure the target location can be pathed to by all units in the squad, so the squad won't get stuck if some units can't make it. Improve the choice of leader for the squad. We attempt to a choose a leader whose locomotor is the most restrictive in terms of passable terrain. This maximises the chance that the squad will be able to follow the leader along the path to the target.
We also choose a leader based on the remaining movement length to the target rather than by physical distance. This avoids the squad regrouping backwards and getting stuck if the squad has to move away from the target to go around an obstacle.We also keep this choice of leader as the squad advances, this avoids the squad constantly switching leaders and regrouping backwards in some cases.