Units Group

public class UnitsGroup

This class describes a group of units. It is used by SquadModule to group newly built combat units into attack squads. Utility class.

When not using role composition, a group’s target size (TargetGroupSize) is set once in its constructor and never changes afterwards - SquadModule rolls it (a fixed value, or a random one between SquadModuleData.GroupSize/GroupSizeMax - see Creating and extending AI) when the group is first created, so the threshold used by IsGroupNeedsUnits() stays stable for the group’s whole lifetime instead of being re-rolled on every check.

Once a group has attacked at least once (HasEngagedBefore), it’s allowed to attack again with whatever alive units it has left as soon as it’s free, without needing to be reinforced back to full composition/size first - that requirement only applies to a group’s very first attack.