Opened 9 years ago

Closed 9 years ago

#3294 closed defect (fixed)

Obstruction size issues breaking naval trade (carthaginians)

Reported by: serveurix Owned by: Itms
Priority: Should Have Milestone: Alpha 19
Component: Core engine Keywords: pathfinding
Cc: Patch:

Description

Carthaginian merchant ships can't trade, they just go to the dock target and stand there, not going back to their second dock target. Apparently (as sanderd17 said on IRC), it's related to obstruction : carthaginians have an obstruction of 6 when others like romans have an obstruction of 8, so carthaginian ships get stuck against the dock because they can't get close enough of it. As mentioned by sanderd17 on IRC, this obstruction problem can happen for other units too, so it need to be solved on a general level.

Change History (7)

comment:1 by Itms, 9 years ago

Keywords: pathfinding added; obstruction trade removed

comment:2 by sanderd17, 9 years ago

There are some ways to solve this:

  • Ensure in some way that the unit obstruction is never smaller than the pathfinder class clearance for that unit (with nice error reporting when loading the template)
  • Don't define unit obstruction size in the obstruction template, but only define that it's a unit, and report the pathfinder clearance back as obstruction size.
  • Change the components that use obstruction (Trader, ResourceGatherer, Builder, ...) to use pathfinder clearance instead of obstruction size.

IMO, unit obstruction sizes aren't very important anymore, as it only determines inter-unit behaviour, and not unit-to-building behaviour. It would look nice enough if our land units will be subdivided into 2 classes: regular and big. so we can use the pathfinder clearance directly as unit obstruction.

comment:3 by mimo, 9 years ago

Milestone: BacklogAlpha 19

Pushing it as we should fix it before A19. Option 2 proposed by sanderd17 looks good to me.

comment:4 by Itms, 9 years ago

Owner: set to Itms

Sounds like a good idea. I can take care of that.

comment:5 by Itms, 9 years ago

In 16867:

Use the terrain-only grid for terrain edges in the short pathfinder algorithm. This grid is updated on each terrain change, whereas the passability grid is updated once a turn. This caused OOS on rejoin, fixes #3292.

However, using the terrain-only grid reveals one discrepancy between the short pathfinder (which uses unit radii) and the long one (which uses unit clearances). So I implemented the change proposed by sanderd17 in #3294, which is removing unit radius and using only the pathfinder clearance. Refs #3294
Now some tweaking has to be done in the templates, so that units get a passability class suited to their apparent size. In the meantime the unit motion is quite bugged.

comment:6 by Itms, 9 years ago

Committing a fix later today (this commit was huge enough). You shouldn't try to play on r16867 IMO ;)

comment:7 by Itms, 9 years ago

Resolution: fixed
Status: newclosed

In 16868:

Update templates to reflect the recent obstruction changes for units.
Fixes #3294.

Note: See TracTickets for help on using tickets.