Skip to content

Improve AI squad pathing and regrouping behavior. #20228

Merged
PunkPun merged 1 commit into
OpenRA:bleedfrom
RoosterDragon:ai-squads
Sep 11, 2023
Merged

Improve AI squad pathing and regrouping behavior. #20228
PunkPun merged 1 commit into
OpenRA:bleedfrom
RoosterDragon:ai-squads

Conversation

@RoosterDragon

@RoosterDragon RoosterDragon commented Aug 28, 2022

Copy link
Copy Markdown
Member

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

dnqbob commented Aug 30, 2022

Copy link
Copy Markdown
Contributor

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
Copy Markdown
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.

@RoosterDragon RoosterDragon marked this pull request as ready for review July 20, 2023 18:17
@PunkPun

PunkPun commented Sep 7, 2023

Copy link
Copy Markdown
Member

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
Copy Markdown
Member Author

Rebased

@PunkPun PunkPun left a comment

Copy link
Copy Markdown
Member

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

PunkPun commented Sep 11, 2023

Copy link
Copy Markdown
Member

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

PunkPun commented Sep 11, 2023

Copy link
Copy Markdown
Member

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