Opened 9 years ago

Closed 9 years ago

Last modified 8 years ago

#3376 closed defect (fixed)

[PATCH] Units stuck at obstruction corners

Reported by: Itms Owned by: Itms
Priority: Must Have Milestone: Alpha 19
Component: Core engine Keywords: patch
Cc: silure Patch:

Description

Moving silure's report from #3363 to here. This is a discrepancy between short and long pathfinder. I'm investigating to find a way to fix that.


After chasing a camel the unit get stuck at CC, this happens only with Mauryans (r16927).

Attachments (4)

commands_reachcc.txt (4.5 KB ) - added by Itms 9 years ago.
use_passability_grid.patch (1.9 KB ) - added by Itms 9 years ago.
commands1.txt (8.0 KB ) - added by silure 9 years ago.
commands2.txt (4.3 KB ) - added by silure 9 years ago.

Download all attachments as: .zip

Change History (16)

by Itms, 9 years ago

Attachment: commands_reachcc.txt added

comment:1 by Itms, 9 years ago

Cc: silure added

comment:2 by Itms, 9 years ago

Keywords: patch review added

The attached patch fixes the problem. It makes the unit motion use the passability grid instead of the obstruction shapes, else it gets less permissive than the long-range pathfinder and units get stuck.

However, this patch actually reverts r16869, so it might not be so good. As the CheckLineMovement algorithm was fixed in r16918, reverting that commit is not equivalent to putting the game in the same state as before and it is still possible that problems don't arise.

It would be great if people could test that patch in game and tell me if it breaks things :)

comment:3 by Itms, 9 years ago

Summary: Units stuck at obstruction corners[PATCH] Units stuck at obstruction corners

by Itms, 9 years ago

Attachment: use_passability_grid.patch added

comment:4 by gameboy, 9 years ago

I tested your patch and found a problem. When the Roman cavalry hunt Gaia, after the attacks for the first time, when Gaia runs away, Roman cavalry choirs are not pursued immediately, but where do attack action.

Last edited 9 years ago by gameboy (previous) (diff)

comment:5 by Itms, 9 years ago

Thanks for reporting that, but that's a different problem. Did you experience units getting stuck with the patch?

comment:6 by silure, 9 years ago

Tested the patch and it works for this special case (r16970). Also noticed that some units get stuck on structures before and after building. Don't know if it's an issue with corners but it was already there before the patch.

by silure, 9 years ago

Attachment: commands1.txt added

by silure, 9 years ago

Attachment: commands2.txt added

in reply to:  6 comment:7 by Itms, 9 years ago

Replying to silure:

Also noticed that some units get stuck on structures before and after building. Don't know if it's an issue with corners but it was already there before the patch.

Yes, this is #3372. Thanks for testing, I will commit this patch as it doesn't seem to break everything. :)

comment:8 by Itms, 9 years ago

Resolution: fixed
Status: newclosed

In 16971:

Revert most of r16869 which was actually bad. It caused units to get stuck because the obstructions won't block the same paths when rasterized on the grid and when directly tested for collisions.

As a general rule, pathfinding-blocking shapes should not be tested against for movements. Only the passability grid should be considered. As the algorithm which tests paths on this grid was fixed in r16918, it can be safely used.

Fixes #3376.

comment:9 by Itms, 9 years ago

In 16986:

Revert my experimental changes from the previous days. Hopefully I can design something that doesn't introduce a ton of new issues. Refs #3376

comment:10 by Itms, 9 years ago

Keywords: review removed
Resolution: fixed
Status: closedreopened

comment:11 by Itms, 9 years ago

Resolution: fixed
Status: reopenedclosed

In 16998:

Based on previous experimental changes, major update to the unit motion.

With this change, units will not check their movement against all obstructions when moving: terrain and static obstructions are assumed to be handled by the long-range pathfinder.
However, when static obstructions are changed, the paths have to be invalidated. In order to minimize the performance impact, units will check for obstructions when they move after a passability change. If they collide with something, they will recompute a path that will take into account the new passability map.

Also includes some code cleanup. This patch should not change performance a lot: the lower number of checks should give a small performance improvement while using the message broadcasting system should hurt it a bit.

Fixes #3376, #3337, #1914.

comment:12 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

Note: See TracTickets for help on using tickets.