Opened 8 years ago

Closed 8 years ago

Last modified 5 years ago

#3505 closed defect (fixed)

Pathfinder - Units in formation stuck frequently

Reported by: elexis Owned by:
Priority: Release Blocker Milestone: Alpha 19
Component: Core engine Keywords: pathfinding
Cc: Patch:

Description (last modified by elexis)

Since formations were enabled again in r17028, units in formation are stuck frequently at obstructions, mostly at resources. They seem to become stuck once one of the units are stuck and don't retry finding a path. When using no formation, they are stuck rather rarerly.

Often many walk-orders are required to resolve it.

https://trac.wildfiregames.com/raw-attachment/ticket/3505/formation_stuck_in_metal.gif

https://trac.wildfiregames.com/raw-attachment/ticket/3505/stuck_without_obstruction.gif

This is probably the same bug as #3471, there is also a unit stuck without obstruction: https://trac.wildfiregames.com/raw-attachment/ticket/3471/stuck_cav.gif

https://trac.wildfiregames.com/raw-attachment/ticket/3505/choreography_lesson.gif

Attachments (8)

formation_stuck_in_metal.gif (760.2 KB ) - added by elexis 8 years ago.
commands.txt (15.2 KB ) - added by elexis 8 years ago.
Here a fairly small replay for r17117.
stuck_without_obstruction.gif (954.0 KB ) - added by elexis 8 years ago.
commands_stuck_without_obstruction.txt (398.6 KB ) - added by elexis 8 years ago.
The replay where those 5 units of the blue player from the gif got stuck. Notice they are not inside an obstruction and also don't touch one. The entity IDs of the units are 1149-1153 and they were stuck after a command ordered them to move on turn 2080 (17min 19sec).
commands_2_stuck_men.txt (5.8 KB ) - added by elexis 8 years ago.
Very short replay. Two men stuck after building houses. r17131
choreography_lesson.gif (209.5 KB ) - added by elexis 8 years ago.
Reproduce: Select 2 ranged + 2 melee units. Switch from line-closed to skirmish formation.
commands_stuck_female_min_12.20_ent4823.txt (336.4 KB ) - added by elexis 8 years ago.
r17181. Fast forward to minute 12:20, look at the storehouse of the black player at the top right and see this female (entity ID 4823) stuck at a birch tree. It looks exactly like #3530 #3539. She loops for at least three minutes there.
commands_stuck_tradecart_metal_min31.30_ent5477.txt (569.6 KB ) - added by elexis 8 years ago.
r17181. Here a metal cart of the blue player (entity id 5477) was stuck at the nearest metal of the green player's cc at minute 31.30. All trade carts bumped into the metal, but only this one got stuck there.

Change History (20)

by elexis, 8 years ago

comment:1 by elexis, 8 years ago

Description: modified (diff)

by elexis, 8 years ago

Attachment: commands.txt added

Here a fairly small replay for r17117.

by elexis, 8 years ago

comment:2 by elexis, 8 years ago

Description: modified (diff)

by elexis, 8 years ago

The replay where those 5 units of the blue player from the gif got stuck. Notice they are not inside an obstruction and also don't touch one. The entity IDs of the units are 1149-1153 and they were stuck after a command ordered them to move on turn 2080 (17min 19sec).

comment:3 by elexis, 8 years ago

Description: modified (diff)

The replay above is for r17131.

This ticket sounds like a duplicate of #3471 as units here are also stuck without touching any obstruction.


If you replace the construct order with an identical walk order in the minimal replay (attachment:commands.txt) then the units will not be stuck.

466c466
< cmd 1 {"type":"construct","template":"structures/ptol_house","x":854.0781860351562,"z":361.5915222167969,"angle":2.356194490192345,"actorSeed":34134,"entities":[10090,10091,10109,10110,10111,10112,10113,10114,10115,10116,10117,10118],"autorepair":true,"autocontinue":true,"queued":false}
---
> cmd 1 {"type":"walk","x":854.0781860351562,"z":361.5915222167969,"entities":[10090,10091,10109,10110,10111,10112,10113,10114,10115,10116,10117,10118],"queued":false}

So maybe it has something to do with new obstructions not being taken into account correctly.

by elexis, 8 years ago

Attachment: commands_2_stuck_men.txt added

Very short replay. Two men stuck after building houses. r17131

comment:4 by elexis, 8 years ago

By adding debug output and/or enabling the pathfinder-developer-overlay, you will see that those stuck units request tickets for computing a short path indefinitely. Each time zero waypoints are returned.

Reproduce stuck units::

  1. Have some units standing in formation (= our obstacle).
  2. Select one unit (without formation) or some units in formation and tell them to walk "inside" of the units in formation of 1.

The unit(s) will get close to the formation but never get inside. Yet they do a ComputeShortPath every turn, which returns 0 waypoints each time.

by elexis, 8 years ago

Attachment: choreography_lesson.gif added

Reproduce: Select 2 ranged + 2 melee units. Switch from line-closed to skirmish formation.

comment:5 by elexis, 8 years ago

Description: modified (diff)

comment:6 by Lionkanzen, 8 years ago

You try changing several formations with a mixed units, I was successful to un-stuck a units using testudo formation.

comment:7 by elexis, 8 years ago

Since r17132 you can't hunt chicken & deer anymore (unless you get #3410 by accident), no matter if you use cavalry, infantry or females. The unit will go close to the animal, kill it, and then loop as seen on the gifs above.

Seems to be the same bug as this one, respectively #3471.

This has the advantage that we can now reproduce this bug instantaneously without formation.

(moved to #3530)

Last edited 8 years ago by elexis (previous) (diff)

comment:8 by wraitii, 8 years ago

In 17161:

Fix more pathfinding issues.

Change the way the long-range pathfinder rasterisation works slightly so that we have a better compatibility with the short-range pathfinder. Should fix the "stuck units" issues, though I am not sure so I am not marking them as fixed so far. Refs #3471, #3505, and possibly #3292.

Caveat: I am now using clearance of 0.8 for "default" class, which might have side-effects: please report anything weird.

Also fix leftover style issues.

comment:9 by wraitii, 8 years ago

In 17166:

Make "no formation" the default setting but keep formations activated to help pathfinding in A19. Use at your own risk. Refs #3505 and #3565.

Also make rabbit, chicken and shark no longer obstruct movement, to further help with pathfinding. These may or may not be udpated later. Refs #3562. Fixes #3497.

by elexis, 8 years ago

r17181. Fast forward to minute 12:20, look at the storehouse of the black player at the top right and see this female (entity ID 4823) stuck at a birch tree. It looks exactly like #3530 #3539. She loops for at least three minutes there.

by elexis, 8 years ago

r17181. Here a metal cart of the blue player (entity id 5477) was stuck at the nearest metal of the green player's cc at minute 31.30. All trade carts bumped into the metal, but only this one got stuck there.

comment:10 by wraitii, 8 years ago

In 17191:

Changes to unitMotion.
Make sure we do not treat as circles entities that we really should treat as squares (such as trees). This fixes an issue reported by Stan.
Make sure we never forget about our destination if we are blocked by unit obstructions. This makes sure that units in a group but not in formation will not be blocked by the other units, and probably makes the general behavior more sane. Helps following [17166]

Refs #3505, #3471, #3376

comment:11 by wraitii, 8 years ago

Resolution: fixed
Status: newclosed

Testing no longer shows this issue, I believe I have fixed it for the most part, closing.

comment:12 by elexis, 5 years ago

Description: modified (diff)
Note: See TracTickets for help on using tickets.