Rework how a game starts: dev mode, a bare opening, and fleet growth

Adds a Dev Mode entry to the main menu and takes the play-testing
conveniences out of a normal game, which turn out to be the same change
from two directions.

DEV MODE. Banks 2000 of every resource, grants 500 research points, and
plants one of each planet type in the chunks around the spawn. Built ON TOP
of reset_new_game() rather than beside it, so a dev game is a normal game
plus a stock rather than a second definition of "fresh game" to keep in
sync. Offered only when running from Godot - OS.has_feature("editor"), the
tag an export clears - as is the map editor. Hidden AND guarded: pressing
either anyway is refused, because visibility is presentation and the rule is
the rule.

The menu now lays its stack out in code. Hiding two of four entries with
scene-authored offsets would leave holes in a shipped build - the same
failure the HUD columns had - so it measures the entries that actually exist
and centres on them.

A NORMAL GAME NOW HANDS OVER NOTHING. No 500 banked ore (removed from both
reset_new_game and the autoload's own default, so the two cannot disagree),
and no gas giant guaranteed in the origin chunk. Both were play-testing
conveniences that had become part of the real world's shape: every player
got the same landmark in the same place. Play-testing wanted all four planet
types anyway, and a normal game wanted none of them - different needs, now
different mechanisms.

WorldGen cannot read GameState back (an autoload is not resolvable as a
global identifier that early, the hazard PlanetSetups.gd already works
around), so GameState.dev_mode's setter PUSHES the flag down. World
generation stays static and dependency-free, GameState stays the single
source of truth, and dev planting is applied after every rng draw so a dev
world and a normal one differ only in those four chunks.

FLEET SIZE. BASE_FLEET_SIZE was doing two jobs - how many slots exist AND
how many ships you start with - which forced a new game to open with a full
fleet, leaving the first ship crafter nothing to do. Split into
BASE_FLEET_SIZE (3 slots) and STARTING_SHIP_COUNT (1 vessel), so the opening
has two empty slots to fill. A third copy of the old value turned up in
PlanetAtmosphereController, hardcoded as spawn_ships(5) and silently
degraded into "however many slots exist" once max_fleet_size() clamped it.

The doctrine branch now runs 3 -> 10 slots. Wing (30 -> 15) and Squadron
(70 -> 35, 2 -> 1 points) are cut hardest: they are no longer a mid-game
luxury but the ordinary way out of the opening, and pricing them as a luxury
made the early game feel stuck. Armada follows at 90/2. Two new tiers,
Battlegroup and Grand Fleet, grant +2 each - seven single-vessel nodes in
one lane would be a long monotonous chain for a branch that only ever does
one thing. DEFAULT_FORMATION grows to 10 slots, because max_fleet_size()
clamps to its length and a doctrine past that would charge real resources
for nothing; test_fleet_growth.gd asserts that invariant directly.

TEST FALLOUT, all of it from the deliberate change rather than a defect:

- Tests that silently inherited the old 5-ship default now ask for the fleet
  they need. Several had to crew it from their first frame rather than
  _initialize(), where the engine's deferred tree-entry finalization undoes
  it - the same hazard those tests already documented for set_process(false).
- test_planet_landing_proximity and test_return_position_matches_planet take
  the FIRST chunk holding a planet and land there. The guaranteed gas giant
  had been masking that this can now be a black hole, which destroys ships on
  contact. They exclude it, and clear the asteroids the field already placed.
- test_pivot_controls measured rotation with angle_difference, which wraps at
  +/-pi, so a hold that turned a full circle read as no rotation. Latent
  flakiness that only ever showed under load; it now reads the controller's
  unwrapped pivot_hold_amount.
- test_research_points was failing on ore, not points: can_unlock() checks
  the ore price too, and a fresh game banks nothing now.
- test_gas_system's "a reachable gas source near the spawn" premise moved to
  dev mode, which is where that guarantee now lives.

Full suite green at 97/97.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
Loïc Wisniewski 2026-08-18 12:10:14 +02:00
commit a3c6316676
19 changed files with 663 additions and 35 deletions

152
tests/test_dev_mode.gd Normal file
View file

@ -0,0 +1,152 @@
extends SceneTree
# Headless test: run with
# godot --headless -s res://tests/test_dev_mode.gd
# A "Dev Mode" start for play-testing: one of every planet type next to the
# spawn, every resource banked, and research points to spend. Offered by the
# main menu only when the game is run from Godot, alongside the map editor.
#
# The same change took the training wheels off a NORMAL game: no 500 free
# ore, and no gas giant guaranteed in the origin chunk. Both of those were
# play-testing conveniences that had become part of the real game, so this
# test covers both sides - what dev mode hands you, and what a normal game
# no longer does.
#
# Covers:
# A. a dev game banks every resource type and research points
# B. a dev game is a normal game PLUS that, not a separate definition
# C. one of each planet type sits within a chunk or two of the spawn
# D. none of that leaks into a normal game, and starting one clears it
# E. a normal game starts with an empty bank
# F. the menu gates dev mode and the map editor on the same rule
var game_state: Node
var menu: Node
var stage: int = 0
var elapsed: float = 0.0
func _initialize() -> void:
game_state = root.get_node("GameState")
func _process(delta: float) -> bool:
elapsed += delta
match stage:
0:
# --- E. a normal game hands over nothing ----------------------
game_state.reset_new_game()
if game_state.rocks != 0:
return _fail("a normal game started with %d ore banked" % game_state.rocks)
for resource_type in game_state.resource_types():
if game_state.banked_resource(resource_type) != 0:
return _fail("a normal game started with %s banked" % resource_type)
if game_state.research_points != 0:
return _fail("a normal game started with research points")
if game_state.dev_mode:
return _fail("a normal game started in dev mode")
print("normal game starts with an empty bank and no research points")
# --- D. no dev planets in a normal game -----------------------
# The dev arrangement must not survive into a normal world. Noise
# could coincidentally place a planet in one of these chunks, so
# what is asserted is that the ARRANGEMENT is not reproduced, not
# that each chunk is empty.
var reproduced: bool = true
for chunk in WorldGen.DEV_PLANET_CHUNKS:
var expected: String = String(WorldGen.DEV_PLANET_CHUNKS[chunk])
var data: Dictionary = WorldGen.planet_data_at_chunk(chunk)
if not WorldGen.has_planet_at_chunk(chunk) or String(data.get("definition_id", "")) != expected:
reproduced = false
if Vector2(data.get("local_pos", Vector2.ZERO)) == WorldGen.DEV_PLANET_LOCAL_POS:
return _fail("a normal game placed a planet at dev mode's fixed in-chunk position, in chunk %s" % chunk)
if reproduced:
return _fail("a normal game reproduced dev mode's whole planet arrangement")
print("normal game does not carry dev mode's planets")
# --- A + B. what a dev game hands over ------------------------
game_state.add_building(GameState.BUILDING_MOTHERSHIP, Vector2.ZERO)
game_state.planet_capture["chunk:9:9"] = {"captured": [true], "conquered": true}
game_state.start_dev_game()
if not game_state.dev_mode:
return _fail("start_dev_game() did not set dev_mode")
for resource_type in game_state.resource_types():
var banked: int = game_state.banked_resource(resource_type)
if banked != GameState.DEV_RESOURCE_AMOUNT:
return _fail("dev game banked %d of %s, expected %d" \
% [banked, resource_type, GameState.DEV_RESOURCE_AMOUNT])
if game_state.research_points != GameState.DEV_RESEARCH_POINTS:
return _fail("dev game granted %d research points, expected %d" \
% [game_state.research_points, GameState.DEV_RESEARCH_POINTS])
# B: it still went through reset_new_game, so a dirty run is gone.
if not game_state.buildings.is_empty() or not game_state.planet_capture.is_empty():
return _fail("a dev game did not reset the previous run - it must be a fresh game plus a stock")
print("dev game banks %d of each resource and %d research points, from a clean slate" \
% [GameState.DEV_RESOURCE_AMOUNT, GameState.DEV_RESEARCH_POINTS])
# --- C. one of each planet type, close by ---------------------
var found: Dictionary = {}
for chunk in WorldGen.DEV_PLANET_CHUNKS:
if not WorldGen.has_planet_at_chunk(chunk):
return _fail("dev mode chunk %s holds no planet" % chunk)
var data: Dictionary = WorldGen.planet_data_at_chunk(chunk)
var definition_id: String = String(data.get("definition_id", ""))
if definition_id != String(WorldGen.DEV_PLANET_CHUNKS[chunk]):
return _fail("dev mode chunk %s holds a %s, expected a %s" \
% [chunk, definition_id, WorldGen.DEV_PLANET_CHUNKS[chunk]])
found[definition_id] = true
# "Near the start" is the whole point - a play-tester should
# reach any of them in seconds, not go exploring.
var world_pos: Vector2 = WorldGen.chunk_origin(chunk) + Vector2(data.local_pos)
if world_pos.length() > WorldGen.CHUNK_SIZE * 2.5:
return _fail("dev mode's %s spawned %.0f units away, too far to be 'near the start'" \
% [definition_id, world_pos.length()])
for definition_id in [PlanetDefinitions.ROCKY_ID, PlanetDefinitions.GAS_GIANT_ID,
PlanetDefinitions.BLACK_HOLE_ID, PlanetDefinitions.RESEARCH_LAB_ID]:
if not found.has(definition_id):
return _fail("dev mode is missing a %s - it must plant one of EVERY planet type" % definition_id)
print("dev mode plants all %d planet types within %.0f units of the spawn" \
% [found.size(), WorldGen.CHUNK_SIZE * 2.5])
# --- D. starting a normal game clears it ----------------------
game_state.reset_new_game()
if game_state.dev_mode:
return _fail("starting a normal game after a dev one left dev_mode set")
if game_state.rocks != 0 or game_state.research_points != 0:
return _fail("starting a normal game after a dev one kept the dev stock")
print("starting a normal game afterwards clears dev mode entirely")
menu = load("res://MainMenu.tscn").instantiate()
root.add_child(menu)
current_scene = menu
elapsed = 0.0
stage = 1
return false
1:
# --- F. the menu gates both on the same rule ------------------
if elapsed < 0.1:
return false
var developing: bool = menu.is_developer_build()
if menu.dev_button.visible != developing:
return _fail("the dev mode button's visibility did not follow is_developer_build()")
if menu.editor_button.visible != developing:
return _fail("the map editor button's visibility did not follow is_developer_build()")
if menu.play_button.visible != true or menu.quit_button.visible != (not OS.has_feature("web")):
return _fail("gating the development entries also hid an entry a player needs")
# Hiding is presentation; pressing it anyway must still be refused.
if not developing:
menu._on_dev_mode_pressed()
if game_state.dev_mode:
return _fail("dev mode started outside a developer build")
print("dev mode and the map editor are both gated on is_developer_build() (%s here)" % developing)
print("TEST_DEV_MODE: PASS")
quit(0)
return true
return false
func _fail(message: String) -> bool:
print("TEST_DEV_MODE: FAIL (%s)" % message)
quit(1)
return true

View file

@ -32,6 +32,13 @@ func _physics_process(delta: float) -> bool:
# happens strictly after _ready(). Here, at the point _ready() is
# already confirmed complete, it's safe.
main_scene.get_node("EnemySpawner").set_process(false)
# Crew the fleet HERE, not in _initialize(), for the same reason the
# set_process(false) call above lives here: work done in _initialize()
# can be undone by the engine's deferred tree-entry finalization. A
# new game flies one vessel into three slots now, and this test needs
# a full one.
root.get_node("GameState").unlocked.append_array(["wing", "squadron", "armada"])
fleet.spawn_ships(5, Vector2.ZERO)
target_ship = fleet.ships[0]
var enemy_scene: PackedScene = load("res://Enemy.tscn")
enemy = enemy_scene.instantiate()

View file

@ -32,6 +32,13 @@ func _physics_process(delta: float) -> bool:
# happens strictly after _ready(). Here, at the point _ready() is
# already confirmed complete, it's safe.
main_scene.get_node("EnemySpawner").set_process(false)
# Crew the fleet HERE, not in _initialize(), for the same reason the
# set_process(false) call above lives here: work done in _initialize()
# can be undone by the engine's deferred tree-entry finalization. A
# new game flies one vessel into three slots now, and this test needs
# a full one.
root.get_node("GameState").unlocked.append_array(["wing", "squadron", "armada"])
fleet.spawn_ships(5, Vector2.ZERO)
var enemy_scene: PackedScene = load("res://Enemy.tscn")
enemy = enemy_scene.instantiate()
enemy.position = fleet.get_centroid() + SPAWN_OFFSET

View file

@ -54,6 +54,9 @@ var elapsed: float = 0.0
func _initialize() -> void:
game_state = root.get_node("GameState")
beam_script = load("res://EnemyBigLaserBeam.gd")
# Four vessels are crewed below, past BASE_FLEET_SIZE's 3 slots, so the
# capacity doctrines are granted rather than assumed.
game_state.unlocked.append_array(["wing", "squadron", "armada"])
main = load("res://Main.tscn").instantiate()
root.add_child(main)
fleet = main.get_node("Fleet")

139
tests/test_fleet_growth.gd Normal file
View file

@ -0,0 +1,139 @@
extends SceneTree
# Headless gameplay test: run with
# godot --headless -s res://tests/test_fleet_growth.gd
# A new game opens with a SINGLE vessel and three slots, and the fleet grows
# from there through the doctrine branch of the skill tree.
#
# BASE_FLEET_SIZE used to be both "how many slots exist" and "how many ships
# you start with", which forced a new game to open with a full fleet - there
# was nowhere to put a vessel until a doctrine was researched, so the first
# ship crafter had nothing to do. The two are now separate constants, and
# this test pins the distinction.
#
# Covers:
# A. a new game starts with one vessel and three slots
# B. the fleet really spawns one ship, and can be grown into its slots
# C. every doctrine raises the ceiling by its own stated bonus
# D. the doctrine branch is a chain, in increasing cost order
# E. the tree cannot promise a slot the formation has no room for - the
# invariant that made extra doctrines silently worthless
const DOCTRINE_CHAIN: Array = ["wing", "squadron", "armada", "battlegroup", "grand_fleet"]
var game_state: Node
var scene: Node
var fleet: Node
var stage: int = 0
var elapsed: float = 0.0
func _initialize() -> void:
game_state = root.get_node("GameState")
game_state.reset_new_game()
func _process(delta: float) -> bool:
elapsed += delta
match stage:
0:
# --- A. the opening position ---------------------------------
if GameState.STARTING_SHIP_COUNT != 1:
return _fail("a new game starts with %d vessels, expected 1" % GameState.STARTING_SHIP_COUNT)
if GameState.BASE_FLEET_SIZE != 3:
return _fail("the fleet has %d slots by default, expected 3" % GameState.BASE_FLEET_SIZE)
if game_state.surviving_ship_count != GameState.STARTING_SHIP_COUNT:
return _fail("reset_new_game left %d surviving ships" % game_state.surviving_ship_count)
if game_state.max_fleet_size() != GameState.BASE_FLEET_SIZE:
return _fail("an unresearched fleet caps at %d, expected %d" \
% [game_state.max_fleet_size(), GameState.BASE_FLEET_SIZE])
print("new game: %d vessel, %d slots" % [GameState.STARTING_SHIP_COUNT, GameState.BASE_FLEET_SIZE])
# --- C + D. the doctrine chain -------------------------------
var expected: int = GameState.BASE_FLEET_SIZE
var previous_cost: int = -1
var previous_points: int = -1
var previous_id: String = "coordination"
for id in DOCTRINE_CHAIN:
var node: Dictionary = game_state.skill_node(id)
if node.is_empty():
return _fail("no skill node '%s' - the doctrine chain is broken" % id)
var bonus: int = int(node.get("fleet_bonus", 0))
if bonus <= 0:
return _fail("'%s' is in the doctrine chain but grants no fleet_bonus" % id)
if String(node.get("requires", "")) != previous_id:
return _fail("'%s' requires '%s', expected it to follow '%s' - the branch is not one chain" \
% [id, node.get("requires", ""), previous_id])
# Later tiers must not be cheaper than earlier ones, or the
# order the player meets them stops matching what they cost.
var cost: int = int(node.get("cost", 0))
var points: int = int(node.get("research_points", 0))
if cost <= previous_cost:
return _fail("'%s' costs %d ore, not more than the tier before it (%d)" % [id, cost, previous_cost])
if points < previous_points:
return _fail("'%s' costs %d research points, fewer than the tier before it (%d)" \
% [id, points, previous_points])
previous_cost = cost
previous_points = points
previous_id = id
game_state.unlocked.append(id)
expected += bonus
if game_state.max_fleet_size() != expected:
return _fail("after researching '%s' the fleet caps at %d, expected %d" \
% [id, game_state.max_fleet_size(), expected])
print(" %-12s +%d -> %2d slots (%d ore, %d research)" % [id, bonus, expected, cost, points])
# --- E. no doctrine may be swallowed by the formation ---------
# max_fleet_size() clamps to the formation's length, so a doctrine
# added without extending DEFAULT_FORMATION would cost the player
# real resources and grant nothing.
if expected > GameState.DEFAULT_FORMATION.size():
return _fail("the doctrines promise %d slots but DEFAULT_FORMATION only defines %d - the last ones buy nothing" \
% [expected, GameState.DEFAULT_FORMATION.size()])
print("full doctrine chain reaches %d slots, with %d formation positions defined" \
% [expected, GameState.DEFAULT_FORMATION.size()])
# --- B. what actually flies ----------------------------------
game_state.reset_new_game()
scene = load("res://Main.tscn").instantiate()
root.add_child(scene)
fleet = scene.get_node("Fleet")
elapsed = 0.0
stage = 1
return false
1:
if elapsed < 0.3:
return false
scene.get_node("AsteroidField").set_process(false)
scene.get_node("EnemySpawner").set_process(false)
if fleet.ships.size() != GameState.STARTING_SHIP_COUNT:
return _fail("a fresh scene spawned %d vessels, expected %d" \
% [fleet.ships.size(), GameState.STARTING_SHIP_COUNT])
print("a fresh game really flies %d vessel" % fleet.ships.size())
# The two empty slots are what the opening is for, so they have to
# be fillable without researching anything.
for i in range(GameState.BASE_FLEET_SIZE - GameState.STARTING_SHIP_COUNT):
if not fleet.add_ship(GameState.VESSEL_INTERCEPTOR):
return _fail("could not crew slot %d of the starting fleet" % (i + 2))
if fleet.ships.size() != GameState.BASE_FLEET_SIZE:
return _fail("the fleet holds %d after filling its slots, expected %d" \
% [fleet.ships.size(), GameState.BASE_FLEET_SIZE])
# And the cap has to actually bite past that.
if fleet.add_ship(GameState.VESSEL_INTERCEPTOR):
return _fail("a %dth vessel joined an unresearched fleet of %d slots" \
% [fleet.ships.size(), GameState.BASE_FLEET_SIZE])
print("the starting slots fill to %d and refuse a %dth" \
% [GameState.BASE_FLEET_SIZE, GameState.BASE_FLEET_SIZE + 1])
print("TEST_FLEET_GROWTH: PASS")
quit(0)
return true
return false
func _fail(message: String) -> bool:
print("TEST_FLEET_GROWTH: FAIL (%s)" % message)
quit(1)
return true

View file

@ -20,15 +20,21 @@ func _initialize() -> void:
func _process(delta: float) -> bool:
elapsed += delta
if stage == 0:
var nearby_chunk: Vector2i = WorldGen.NEARBY_GAS_GIANT_CHUNK
# A guaranteed gas source near the spawn is now a DEV MODE guarantee
# rather than something every game gets - a normal game has to go and
# find one. Dev mode is therefore where this premise still holds, and
# where a play-tester reaching gas quickly still matters.
game_state.dev_mode = true
var nearby_chunk: Vector2i = Vector2i.ZERO
for chunk in WorldGen.DEV_PLANET_CHUNKS:
if String(WorldGen.DEV_PLANET_CHUNKS[chunk]) == "gas_giant":
nearby_chunk = chunk
var nearby_data: Dictionary = WorldGen.planet_data_at_chunk(nearby_chunk)
var nearby_position: Vector2 = WorldGen.chunk_origin(nearby_chunk) + nearby_data.local_pos
if not WorldGen.has_planet_at_chunk(nearby_chunk):
return _fail("nearby gas giant chunk does not contain a planet")
if WorldGen.biome_at_chunk(nearby_chunk) != WorldGen.Biome.SPACE:
return _fail("nearby gas giant is not in the normal space biome")
return _fail("dev mode's gas giant chunk does not contain a planet")
if String(nearby_data.get("definition_id", "")) != "gas_giant":
return _fail("nearby guaranteed planet is not a gas source")
return _fail("dev mode's guaranteed planet is not a gas source")
if nearby_position.length() > WorldGen.CHUNK_SIZE * 2.0:
return _fail("nearby gas giant spawned too far away: %s" % nearby_position)

View file

@ -35,6 +35,14 @@ func _process(delta: float) -> bool:
return false
if not menu.editor_button.enabled:
return _fail("map editor button is not enabled (#48 shipped)")
# Both development entries follow the same rule, and the rule is
# what is under test rather than the concrete boolean - this run
# is from Godot, so it exercises the "shown" branch.
var developing: bool = menu.is_developer_build()
if menu.editor_button.visible != developing or menu.editor_label.visible != developing:
return _fail("map editor entry visibility did not follow is_developer_build()")
if menu.dev_button.visible != developing or menu.dev_label.visible != developing:
return _fail("dev mode entry visibility did not follow is_developer_build()")
if menu.quit_button.visible != (not OS.has_feature("web")):
return _fail("quit button visibility did not follow OS.has_feature('web')")
@ -74,8 +82,10 @@ func _process(delta: float) -> bool:
if elapsed < 0.3:
return false
var on_main: bool = current_scene != null and current_scene.name == "Main"
var reset_ok: bool = game_state.rocks == 500 and game_state.buildings.is_empty() \
and game_state.surviving_ship_count == GameState.BASE_FLEET_SIZE \
# A normal game now starts with NOTHING banked - the opening
# mining run is the tutorial, and 500 free ore skipped it.
var reset_ok: bool = game_state.rocks == 0 and game_state.buildings.is_empty() \
and game_state.surviving_ship_count == GameState.STARTING_SHIP_COUNT \
and game_state.planet_capture.is_empty()
print("on_main=%s reset_ok=%s rocks=%d buildings=%d ship_count=%d" % [
on_main, reset_ok, game_state.rocks, game_state.buildings.size(),

View file

@ -19,6 +19,7 @@ var cw: IconButton
var stage: int = 0
var elapsed: float = 0.0
var angle_at_hold_start: float = 0.0
var hold_amount_at_start: float = 0.0
var angle_after_hold: float = 0.0
# GameState (an autoload) is not available as a bare identifier from a
# script that extends SceneTree - fetch it via the tree root instead.
@ -45,6 +46,13 @@ func _process(delta: float) -> bool:
0:
scene.get_node("AsteroidField").set_process(false)
scene.get_node("EnemySpawner").set_process(false)
# Crew the fleet HERE, not in _initialize(): work done there can
# be undone by the engine's deferred tree-entry finalization, the
# same reason the set_process(false) calls above sit at this
# point. A new game flies one vessel now, and the checks below
# index ships[1].
game_state.unlocked.append_array(["wing", "squadron", "armada"])
fleet.spawn_ships(5, Vector2.ZERO)
# Hold the button down without releasing it.
angle_at_hold_start = _angle()
cw.pressed_down = true
@ -127,6 +135,7 @@ func _process(delta: float) -> bool:
return true
angle_at_hold_start = _angle()
hold_amount_at_start = controller.pivot_hold_amount
elapsed = 0.0
stage = 2
return false
@ -135,7 +144,12 @@ func _process(delta: float) -> bool:
return false
# Both fingers still down: the formation must have kept turning
# while the stick kept re-issuing move orders every frame.
var turned_while_steering: float = absf(angle_difference(angle_at_hold_start, _angle()))
# The ACCUMULATED turn, not the angle difference. Comparing
# formation angles wraps at +/-pi, so a hold that happened to
# rotate a full turn read as no rotation at all - and how far it
# gets in 0.4s depends on frame times, so this failed only under
# load. pivot_hold_amount is the same quantity without the wrap.
var turned_while_steering: float = controller.pivot_hold_amount - hold_amount_at_start
print("turned %.3f rad while steering" % turned_while_steering)
if turned_while_steering < 0.05:
print("TEST_PIVOT_CONTROLS: FAIL (no rotation while the stick was held)")

View file

@ -64,6 +64,12 @@ func _initialize() -> void:
current_scene = main_scene
fleet = main_scene.get_node("Fleet")
# A new game now flies STARTING_SHIP_COUNT (1) vessel into BASE_FLEET_SIZE
# (3) slots. This test needs a crewed fleet, so it asks for one outright
# rather than inheriting whatever a fresh game happens to open with -
# which is exactly what changed underneath it.
root.get_node("GameState").unlocked.append_array(["wing", "squadron", "armada"])
fleet.spawn_ships(5, Vector2.ZERO)
planet_field = main_scene.get_node("PlanetField")
landing_controller = main_scene.get_node("LandingController")
asteroid_field_ref = main_scene.get_node("AsteroidField")

View file

@ -20,7 +20,13 @@ func _initialize() -> void:
for x in range(-15, 15):
for y in range(-15, 15):
var chunk: Vector2i = Vector2i(x, y)
if WorldGen.has_planet_at_chunk(chunk):
# Not a black hole: it destroys ships on contact, and this
# scan takes the FIRST planet it finds. That used to be the gas
# giant guaranteed in the origin chunk; with that guarantee gone
# the scan can land the fleet on something that kills it, which
# is not what either of these tests is about.
if WorldGen.has_planet_at_chunk(chunk) \
and String(WorldGen.planet_data_at_chunk(chunk).get("definition_id", "")) != "black_hole":
target_chunk = chunk
found = true
break
@ -57,6 +63,18 @@ func _process(delta: float) -> bool:
# complete (fleet.ships is reliably populated by now), it's safe.
main_scene.get_node("AsteroidField").set_process(false)
main_scene.get_node("EnemySpawner").set_process(false)
# Crew the fleet HERE rather than in _initialize(): work done
# there can be undone by the engine's deferred tree-entry
# finalization, the same reason the set_process(false) calls
# above live at this point. A new game flies one vessel now.
root.get_node("GameState").unlocked.append_array(["wing", "squadron", "armada"])
fleet.spawn_ships(5, Vector2.ZERO)
# Silencing the field does not remove what it already placed, and
# those keep drifting - a rock taking the fleet out mid-test reads
# here as a landing failure.
for rock in get_nodes_in_group("asteroids"):
if is_instance_valid(rock):
rock.queue_free()
# PlanetField only scans chunks near the fleet's CURRENT
# position, so it never even looks at target_chunk unless the

View file

@ -61,6 +61,10 @@ func _initialize() -> void:
# --- F. a fresh game still reaches a crafter and an extractor -------------
game_state.reset_new_game()
# can_unlock() also checks the ore price, and a new game now banks
# nothing - the opening mining run is the point. Stock the ore so this
# checks what it says it checks: reachability at ZERO RESEARCH POINTS.
game_state.rocks = 500
if not game_state.can_unlock("shipyards"):
return _fail("shipyards is not reachable with 0 research points")
game_state.unlock("shipyards")

View file

@ -55,6 +55,12 @@ func _initialize() -> void:
scene = load("res://Main.tscn").instantiate()
root.add_child(scene)
fleet = scene.get_node("Fleet")
# A new game now flies STARTING_SHIP_COUNT (1) vessel into BASE_FLEET_SIZE
# (3) slots. This test needs a crewed fleet, so it asks for one outright
# rather than inheriting whatever a fresh game happens to open with -
# which is exactly what changed underneath it.
root.get_node("GameState").unlocked.append_array(["wing", "squadron", "armada"])
fleet.spawn_ships(5, Vector2.ZERO)
controller = scene.get_node("BuildController")

View file

@ -104,6 +104,10 @@ func _process(delta: float) -> bool:
if elapsed < 0.3:
return false
# --- crafter adds a ship --------------------------------------
# Crafting adds a FOURTH vessel below, one past the 3 slots a
# new game has, so make room first - the subject here is the
# crafter, not the fleet cap.
game_state.unlocked.append_array(["wing", "squadron", "armada"])
fleet.spawn_ships(3, Vector2.ZERO)
var before_ships: int = fleet.ships.size()
var before_rocks: int = game_state.rocks

View file

@ -25,7 +25,13 @@ func _initialize() -> void:
for x in range(-15, 15):
for y in range(-15, 15):
var chunk: Vector2i = Vector2i(x, y)
if WorldGen.has_planet_at_chunk(chunk):
# Not a black hole: it destroys ships on contact, and this
# scan takes the FIRST planet it finds. That used to be the gas
# giant guaranteed in the origin chunk; with that guarantee gone
# the scan can land the fleet on something that kills it, which
# is not what either of these tests is about.
if WorldGen.has_planet_at_chunk(chunk) \
and String(WorldGen.planet_data_at_chunk(chunk).get("definition_id", "")) != "black_hole":
target_chunk = chunk
found = true
break
@ -53,6 +59,18 @@ func _process(delta: float) -> bool:
0:
main_scene.get_node("AsteroidField").set_process(false)
main_scene.get_node("EnemySpawner").set_process(false)
# Crew the fleet HERE rather than in _initialize(): work done
# there can be undone by the engine's deferred tree-entry
# finalization, the same reason the set_process(false) calls
# above live at this point. A new game flies one vessel now.
root.get_node("GameState").unlocked.append_array(["wing", "squadron", "armada"])
fleet.spawn_ships(5, Vector2.ZERO)
# Silencing the field does not remove what it already placed, and
# those keep drifting - a rock taking the fleet out mid-test reads
# here as a landing failure.
for rock in get_nodes_in_group("asteroids"):
if is_instance_valid(rock):
rock.queue_free()
var vicinity_pos: Vector2 = WorldGen.chunk_origin(target_chunk) + Vector2.ONE * WorldGen.CHUNK_SIZE * 0.5
for ship in fleet.ships:
ship.position = vicinity_pos