Opened 13 years ago

Closed 13 years ago

#893 closed defect (fixed)

Unit spawning should respect passability class

Reported by: historic_bruno Owned by: historic_bruno
Priority: Should Have Milestone: Alpha 7
Component: UI & Simulation Keywords:
Cc: Patch:

Description (last modified by historic_bruno)

Unit spawning is broken because it only considers unit obstructions, meaning both trained and ungarrisoned units can be spawned on terrain that violates their passability class. This is one of the causes of "land ships", #771 and #818. I'm working on a fix for #804 which should also fix this (using the PassabilityClass defined in pathfinder.xml).

A few considerations:

  • The current behavior is bad, when spawning fails it just places the unit in the middle of the building which in the case of docks can expose a subtlety of the pathfinder: units on impassable border tiles (as between land and water) can move to other impassable tiles but not actually cross the boundary - meaning they get stuck as land ships if they move onto land.
  • Expand the search outward when spawning units, boats are large and docks have limited space to spawn units.
  • If a unit fails to spawn after training, it could be left blocking the training queue until it finds space or is cancelled. This will require some changes to the queue design and notification of the user.
  • If a unit fails to ungarrison, it could be left garrisoned unless the ejection is forced (e.g. a unit changes ownership while garrisoned)

Change History (5)

comment:1 by ben, 13 years ago

(In [9970]) Implements building restrictions (by terrain, territory, category, and distance). See #41. Fixes #804, #287. Implements build limits. See #687. Implements autorotation for dock placement. Fixes unit spawning to consider terrain passability. See #893. Adds new passability criteria based on distance from shore. Updates build restrictions on some templates. Changes unit spawning search to 4 tiles away from foundation. Changes garrison/training spawn failure to nicer UI notification.

comment:2 by historic_bruno, 13 years ago

Description: modified (diff)

comment:3 by ben, 13 years ago

(In [10020]) Fixes garrison behavior for ships - they no longer unload units underwater. See #893. Fixes behavior when ships are destroyed (garrisoned units at the time will also be killed). Updates ship templates accordingly.

comment:4 by historic_bruno, 13 years ago

Description: modified (diff)

comment:5 by ben, 13 years ago

Resolution: fixed
Status: newclosed

(In [10081]) Fixes training queue behavior when spawning fails due to lack of space (the queue will be blocked). Fixes #893. Changes training queue to support partial batch success and removal.

Note: See TracTickets for help on using tickets.