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

Improve AI squad pathing and regrouping behavior. #20228

Merged
merged 1 commit into from Sep 11, 2023

Conversation

RoosterDragon
Copy link
Member

@RoosterDragon RoosterDragon commented Aug 28, 2022

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.

@dnqbob
Copy link
Contributor

dnqbob commented Aug 30, 2022

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.
(2). All other units only regroup to leader instead of doing a long path finding. This should save some performances considering target is always far away for a bunch of units to path find.

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.

@RoosterDragon RoosterDragon marked this pull request as draft September 10, 2022 19:25
@RoosterDragon RoosterDragon force-pushed the ai-squads branch 3 times, most recently from 3ea1983 to b9aeec5 Compare July 20, 2023 18:14
@RoosterDragon
Copy link
Member Author

@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.

@PunkPun
Copy link
Member

PunkPun commented Sep 7, 2023

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.
@RoosterDragon
Copy link
Member Author

Rebased

Copy link
Member

@PunkPun PunkPun left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

MapAndReplays.zip

The Ai's squads still seem to be acting very incorrectly. See submarines and cruisers in this replay

@PunkPun
Copy link
Member

PunkPun commented Sep 11, 2023

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

@PunkPun PunkPun merged commit a67e85e into OpenRA:bleed Sep 11, 2023
3 checks passed
@PunkPun
Copy link
Member

PunkPun commented Sep 11, 2023

Changelog

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.

Bug Report on Computer Players Path Finding AI will try hunt down cloaked units it can't attack
4 participants