Recent Changes - Search:

Main.SideBar (edit)

PmWiki

UnitsInUnitsUnitStoragePlugin

This page belongs to the UnitsInUnits "use-case".

The UnitStoragePlugin complements the EnterUnitPlugin. The storage decides

  • which units may enter at a certain time
  • if a certain unit may at a certain time enter/leave (both can be denied!)
  • which path entering/leaving units must use inside the storage

The path a entering/leaving unit must use inside the storage is in particular important. The properties of a storage define a certain (finite!) set of paths, each may at any time be taken by at most one unit only. Once all paths are taken, the storage is "filled" and further units can enter only when a unit leaves the storage.

Paths

Paths are probably the most tricky part of the storage, as a lot of different things must be possible:

  • Land units and planes "enter" at the margin of the storage, i.e. pretty much on the bounding rectangle. helicopters might "enter" anywhere on the storage.
    • The same restrictions exist for "leaving"
  • Aircrafts must be able to "land" somewhere on the path
  • Once a unit is entering on a path, we must be able to find a path that leaves the unit again
  • When the "UnitWidth" or "UnitHeight" configuration is edited, the paths should automatically adjust themselves

As a consequence a path:

  • Always has a unittype assigned to it (Land/Helicopter/Plane/Ship)
  • Is defined by "pathpoints"
  • Always must start (if an enter path) or end (if a leave path) on the margin of the storage unit, unless the unittype of the path is Helicopter
  • Must always have at least two points (the point on the margin and one moving inside the storage), unless the unittype of the path is Helicopter
  • Has a "Leave" method that specifies how a unit on this particular path is meant to leave the storage again. Currently the only supported "Leave" method is "Reverse", meaning that the same path is used for leaving as for entering, just reversed.
  • Has "relative" points only, i.e. a point on the margin has either x or y either 0.0 or 1.0. All values in between 0.0 and 1.0 are inside the unit, all other values are not valid values for a pathpoint.

UnitStoragePlugin

The storage can (like the EnterUnitPlugin) be seen as a state machine:

Some comments:

  • Note that we probably need timeouts. This is not strictly required in the EnterUnitPlugin, but here it is: imagine a unit "decides" to abort entering, but never tells the storage (e.g. because the entering unit was destroyed). The storage would never wait for that unit forever, unless we have a timeout.
  • About the "Unit Entering/Leaving" state: an entering unit that is in "MovingToEP1/2" state, is not yet "entering/leaving" here. The moving to an enter point does not actually concern the storage, only the actual entering (i.e. once the unit is being stored by the storage) does. In particular the storage may release or take units while a unit that is still far away is moving to it's enter point.
Edit - History - Print - Recent Changes - Search
Page last modified on November 21, 2006, at 01:00