Let the fleet grow past twenty vessels

max_fleet_size() clamped itself to DEFAULT_FORMATION.size(), so the ceiling
on the fleet was a property of the LAYOUT - the wedge ran out of authored
positions at twenty - rather than a rule anyone decided on. Capacity is the
supplied Fleet Offices and nothing else now.

Dropping the clamp alone would index off the end of the formation array, so
the wedge continues by rule instead of stopping: formation_slot() grows it
on demand, each further pair stepping 30 further out and 40 further back,
which is what the authored rows already do - the first twenty slots come
back unchanged. A grown slot is rotated by formation_rotation so a fleet
that outgrows the array after the player has pivoted does not sprout hulls
facing the original heading, and that angle is saved with the layout.

Two "fleet is full" messages pointed at the vanished ceiling. Both now say
what actually buys a berth, and the hangar's stops claiming it is research,
which it has not been since #219.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01QR2Mdk42ghEpeyXPe4UFyn
This commit is contained in:
Loïc Wisniewski 2026-09-12 19:06:03 +02:00
commit 93bfe62e76
7 changed files with 113 additions and 23 deletions

View file

@ -951,11 +951,16 @@ func _advance_fleet_office_upkeep(delta: float) -> void:
fleet_upkeep_failed.emit(i + BASE_FLEET_SIZE, vessel_type)
# However many berths the fleet offices are keeping supplied, with no
# ceiling above them: a player who builds and feeds fifty offices flies
# fifty vessels. There used to be one at DEFAULT_FORMATION.size(), which was
# a limit of the LAYOUT rather than a rule of the game - the wedge simply ran
# out of authored positions at twenty. It now continues by rule instead (see
# formation_slot), so there is nothing left for the cap to protect.
func max_fleet_size() -> int:
if intro_fleet_size > 0:
return mini(intro_fleet_size, DEFAULT_FORMATION.size())
return mini(BASE_FLEET_SIZE + supplied_fleet_office_count(),
DEFAULT_FORMATION.size())
return intro_fleet_size
return BASE_FLEET_SIZE + supplied_fleet_office_count()
func reset_progression() -> void:
@ -2798,11 +2803,11 @@ func get_mothership_position() -> Variant:
# capacity upgrade is researched, but they are defined up front so the wedge
# keeps a deliberate shape as it grows rather than having positions invented
# at unlock time.
# Twenty slots, because max_fleet_size() caps itself on this array's length -
# so the wedge has to be long enough for every doctrine to be worth buying.
# Each further pair continues the same V rather than starting a new shape:
# the rows step 30 out and 40 back, which is the rule the first ten already
# followed, so the wedge that arrives at twenty is the one that left at three.
# Twenty slots are AUTHORED. They are not a cap: the fleet grows as far as
# the offices supply it, and formation_slot() continues the wedge past the
# end of this array by the same rule the rows here already follow - each
# further pair steps 30 further out and 40 further back, so the wedge that
# arrives at fifty is the one that left at three.
const DEFAULT_FORMATION: Array = [
Vector2(0, -48), Vector2(-30, -8), Vector2(30, -8), Vector2(-60, 32), Vector2(60, 32),
Vector2(-90, 72), Vector2(90, 72), Vector2(0, 56),
@ -2814,9 +2819,43 @@ const DEFAULT_FORMATION: Array = [
var formation: Array = DEFAULT_FORMATION.duplicate()
# Which way the wedge currently faces. Kept because slots are grown on
# demand: one that appears after the player has pivoted has to arrive
# already turned, or a fleet that outgrows the authored twenty would sprout
# hulls pointing back along the formation's original heading.
var formation_rotation: float = 0.0
# The rule the wedge continues by past the authored slots. Pairs start at
# index 8 - the point where the hand-placed rows settle into a regular
# V - with the even index on the left, and each pair after that steps out
# and back by FORMATION_PAIR_STEP.
const FORMATION_PAIR_FIRST: int = 8
const FORMATION_PAIR_ORIGIN: Vector2 = Vector2(120.0, 112.0)
const FORMATION_PAIR_STEP: Vector2 = Vector2(30.0, 40.0)
func reset_formation() -> void:
formation = DEFAULT_FORMATION.duplicate()
formation_rotation = 0.0
# Where one slot sits, growing the wedge if the fleet has outgrown the
# positions stored so far. Every reader asks through this rather than
# indexing `formation` directly, because with no cap on fleet size there is
# no index the array is guaranteed to already hold.
func formation_slot(index: int) -> Vector2:
if index < 0:
return Vector2.ZERO
while formation.size() <= index:
formation.append(_grown_formation_slot(formation.size()).rotated(formation_rotation))
return formation[index]
func _grown_formation_slot(index: int) -> Vector2:
var pair: int = (index - FORMATION_PAIR_FIRST) / 2
var out: float = FORMATION_PAIR_ORIGIN.x + FORMATION_PAIR_STEP.x * float(pair)
return Vector2(out if index % 2 == 1 else -out,
FORMATION_PAIR_ORIGIN.y + FORMATION_PAIR_STEP.y * float(pair))
func rotate_formation(radians: float) -> void:
@ -2824,6 +2863,7 @@ func rotate_formation(radians: float) -> void:
# and only changing which way it faces.
for i in range(formation.size()):
formation[i] = formation[i].rotated(radians)
formation_rotation = wrapf(formation_rotation + radians, -PI, PI)
# --- Extractors ------------------------------------------------------------

View file

@ -47,7 +47,7 @@ const FIELDS: Array = [
"unlocked", "research_points", "vessel_levels",
# The fleet itself.
"fleet_position", "fleet_vessel_types", "surviving_ship_count",
"surviving_vessel_types", "formation", "stored_vessels",
"surviving_vessel_types", "formation", "formation_rotation", "stored_vessels",
"vessel_targets", "vessel_deliveries", "repair_drones",
"max_fleet_speed_multiplier", "fleet_speed_multiplier", "build_time_scale",
# The world as the player has seen it.