Opened 7 years ago

Closed 5 years ago

#4473 closed defect (fixed)

Units stuck trying to garrison walls

Reported by: jerre365 Owned by: wraitii
Priority: Must Have Milestone: Alpha 24
Component: Simulation Keywords: pathfinding
Cc: Patch: Phab:D1424

Description (last modified by elexis)

The walls (especially the gates) create pathfinding issues for the units, which get stuck at a specific place or start to make loops (especially visible when gathering resources)

Plus if possible and when time permits I'd like a button "open to friendly units" for the gate

I love your game

https://trac.wildfiregames.com/raw-attachment/ticket/4473/walk.gif

Attachments (5)

commands.txt (6.4 KB ) - added by elexis 7 years ago.
Minimalistic replay on a random map for a unit that is stuck trying to garrison a wall turret
walk.gif (479.8 KB ) - added by elexis 7 years ago.
stuck_at_gate.jpg (307.3 KB ) - added by elexis 7 years ago.
commands_cav_stuck_gate_APPROACHING_COMBAT.txt (178.0 KB ) - added by elexis 7 years ago.
worksonfirstsight.patch (2.1 KB ) - added by elexis 6 years ago.

Download all attachments as: .zip

Change History (19)

comment:1 by elexis, 7 years ago

Keywords: pathfinding added

by elexis, 7 years ago

Attachment: commands.txt added

Minimalistic replay on a random map for a unit that is stuck trying to garrison a wall turret

by elexis, 7 years ago

Attachment: walk.gif added

comment:2 by elexis, 7 years ago

Description: modified (diff)

I didn't see any loops yet.

comment:3 by elexis, 7 years ago

Summary: pathfind errorUnits stuck trying to garrison walls

comment:4 by fatherbushido, 7 years ago

MoveToTarget (UnitMotion) returns true but will never complete the movement (I guess because the tower is a control group of the wall segment). An hack would be to use a garrison loading range of the wall tower to 6.

Last edited 7 years ago by fatherbushido (previous) (diff)

by elexis, 7 years ago

Attachment: stuck_at_gate.jpg added

comment:5 by elexis, 7 years ago

r19823 replay where two of borg-'s cavalry were stuck at a gate in INDIVIDUAL.COMBAT.APPROACHING state in the first 2 minutes.

https://trac.wildfiregames.com/raw-attachment/ticket/4473/stuck_at_gate.jpg

comment:6 by elexis, 6 years ago

similar report with palisade building #5034

comment:7 by elexis, 6 years ago

Priority: Should HaveMust Have

by elexis, 6 years ago

Attachment: worksonfirstsight.patch added

comment:9 by elexis, 6 years ago

Keywords: rfc removed
Milestone: BacklogAlpha 23
Patch: Phab:D1424

comment:10 by elexis, 6 years ago

Milestone: Alpha 23Backlog

comment:11 by Itms, 5 years ago

Milestone: BacklogAlpha 24

The patch looks ready (was accepted). elexis, do you want someone to commit it, or to take a fresh look at it? If needed, temple should be available for renewing his green light if you PM him.

comment:12 by Imarok, 5 years ago

Component: UI & SimulationSimulation

Move tickets to Simulation as UI & Simulation got some sub components.

comment:13 by wraitii, 5 years ago

Owner: set to wraitii

comment:14 by wraitii, 5 years ago

Resolution: fixed
Status: newclosed

In 22533:

UnitMotion - Fix a rare pathfinding issues where units tried going straight through walls, and make sure a long path is computed even when the target is within short path or direct path range.

This fixes a regression introduced by rP22464: when an entity is ordered to move to a target within short path distance (or direct path distance), it no longer computed at least one long path, which meant it could be stuck forever if the target was not actually reachable (such as behind a wall).
To fix this, compute a long path after 3 failed computations, which should result in a delay of 1-3 turns. The previous code did this after 1 failed try - the decision to make it 3 is mostly based on the idea that in most cases, being stuck means we ran into units, not that we were ordered somewhere close. Should there be complaints, it could be lowered to 2 or 1.

This fixes a second issue, reported in #4473: units sometimes get stuck, particularly when trying to garrison a turret from 'inside' the walls. The issue is that the turret is not accessible via the inside as its obstruction + garrison range is blocked by the surrounding walls.
However, as introduced by rP17154, TryGoingStraightToTargetEntity ignores all entities with the obstruction group of the target (the reason for this being that otherwise it would never succeed, since the line towards the target would likely go through the target).
For walls and formations, this means ignoring possibly too many entities, and in the case of #4473, ignoring wall pieces. The unit thus mistakenly thought it could direct-path to the turret, and got stuck.

To fix this, we can ignore specifically the targeted entity's obstruction tag. This can be considered a fix to rP17154.

temple accepted an earlier version of this patch (specifically elexis' version).

Fixes #4473

Based on a patch by: elexis

Differential Revision: https://code.wildfiregames.com/D1424

Note: See TracTickets for help on using tickets.