Class MutualSupportDeployment

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

public final class MutualSupportDeployment extends Object
Deployment half of the Mutual Support doctrine: get a force onto the board as a formation rather than as a set of unrelated units.

What stock deployment does

Stock deployment ranks a hex on terrain hazard and on how much open ground surrounds it, and never once looks at where the rest of the force went. Worse, the candidate list arrives shuffled (BotClient.getStartingCoordsArray randomizes it to stop units piling into the upper-left corner of flat maps) and Princess.rankDeploymentCoords(Entity, List) then scans only the first twenty or so entries. Each unit is therefore choosing the best of a small random sample drawn from the whole deployment zone, which is close to an independent uniform draw per unit. Measured on a 32-wide board, a twelve-unit company lands about 26 hexes wide and never closes up.

The rule

A hex is in position when it satisfies both halves of a band:

  • At least FormationGeometry.MINIMUM_SPACING_HEXES from the nearest friend, so a force does not stack itself into one artillery template or block its own movement lanes. Measured against the nearest friend, because crowding is a local problem. This end of the band is best effort: it yields to support when a zone is too small to hold both (see isInPosition(megamek.common.board.Coords, megamek.common.board.Coords, java.util.List<megamek.common.board.Coords>, int)), which a shallow deployment strip routinely is.
  • Within the formation radius of the force's centre of mass, so every unit can contribute fire where the force is fighting. See FormationGeometry.formationRadius(List, double).

The upper bound is measured against the centre of mass, never against the nearest friend. This is the whole point. "Stay within supporting range of somebody" is satisfied by a chain, where each unit is close to one neighbour and the force as a whole is strung across the map - which is precisely the picket line this rule exists to break. A nearest-friend rule would rebuild it. Measuring against the centre forces the force to be compact rather than merely connected.

How it is applied

The fix is an ordering, not a score. Candidates are sorted by how badly they miss the band, so the capped scan sees hexes that keep the force together instead of a random spread. Everything already in position ties at zero and keeps its shuffled order, which leaves the existing hazard and open-ground ranking free to pick among them exactly as before. Cohesion decides which part of the zone to consider; terrain still decides the hex.

This cannot slow the advance, which is the standing constraint on the whole doctrine: it changes where a unit starts, never where it may move afterwards, and every legal hex remains reachable.

See Also:
  • Method Details

    • prioritize

      public static List<Coords> prioritize(Entity deployedUnit, List<Coords> candidates, List<Entity> friends, Game game, int formationRadius)
      Reorders candidate deployment hexes so the ones that keep the force together are scanned first.
      Parameters:
      deployedUnit - the unit being placed
      candidates - legal deployment hexes, in the order the caller would otherwise scan them
      friends - friendly units, deployed or not, from BotClient.getFriendEntities()
      game - the game, used to keep the anchor to units sharing a board with the deploying unit
      formationRadius - how far from the force's centre a unit may form up, from FormationGeometry.formationRadius(List, double)
      Returns:
      the candidates, reordered; the same list instance when there is nothing to reorder