Class FormationGeometry

java.lang.Object
megamek.client.bot.princess.FormationGeometry

public final class FormationGeometry extends Object
Where a force's formation is and how wide it may be: the shape arithmetic both halves of the Mutual Support doctrine measure against.

MutualSupportDeployment uses it to order candidate hexes as a force forms up, and MutualSupportPathRanker uses it to judge whether a path leaves the force behind. Both must get the same answer to the same question - two definitions would let a force deploy into a formation its own movement code then judges to be broken - so the arithmetic lives here rather than in either of them.

See Also:
  • Method Details

    • formationRadius

      public static int formationRadius(List<Entity> force, double mutualSupportMultiplier)
      How far from its centre of mass a force may spread, in hexes.

      One figure for the whole force, so the formation is a single shape rather than a set of nested per-unit discs. It is sized from the force's own guns: the mean SupportEnvelope.effectiveRange() of every unit that has any, halved, so that at the default setting the formation's diameter comes out at the average effective range. That is mutual support in the literal sense - any two units in the formation are within supporting range of each other, not merely of the centre. Taking the radius as the full average instead would let a company spread to twice its own supporting range, which is the dispersion this rule exists to fix.

      The multiplier is the player's mutual support setting, and it divides rather than multiplies: asking for more mutual support pulls the formation in. At the lowest setting the radius grows past any real deployment zone and the rule stops constraining anything, which reproduces stock scattered deployment.

      Parameters:
      force - the units forming up, deployed or not; a whole command, so the figure is stable across the deployment phase instead of drifting as units land
      mutualSupportMultiplier - the player's mutual support setting; higher means a tighter formation
      Returns:
      the formation radius in hexes, never below MINIMUM_SPACING_HEXES