Initial commit: SpaceshipTest, a top-down space RTS in Godot 4.7.1
A fleet of neon-outlined ships explores a procedurally generated, seeded
infinite world: tap/joystick steering, pinch zoom, formation pivoting,
planet landings, an ore economy with extractors and haulers, and player
built structures (mothership, ship crafter, command centre).
All art is hand-drawn with draw_* calls rather than textures, and the
backgrounds are camera-relative shaders so they stay precise at large
world coordinates.
Includes a 35-test headless suite (tests/run_tests.sh) plus screenshot
tooling that renders real frames through Xvfb and Mesa softpipe, since
--headless has no GPU.
Excluded from version control: .godot/ (import cache, and it holds
export credentials), builds/, android/build/ and packaged APKs - all
regenerable, and ~325 MB combined.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
2026-08-10 18:41:58 +02:00
|
|
|
extends Node2D
|
|
|
|
|
|
2026-08-14 16:05:32 +02:00
|
|
|
const SURFACE_PROFILES = preload("res://PlanetSurfaceProfiles.gd")
|
2026-08-14 16:13:24 +02:00
|
|
|
const PLANET_DEFINITIONS = preload("res://PlanetDefinitions.gd")
|
2026-08-15 14:41:37 +02:00
|
|
|
const PLANET_SETUPS = preload("res://PlanetSetups.gd")
|
|
|
|
|
const SETUP_HOST_SCENE: PackedScene = preload("res://PlanetSetupHost.tscn")
|
2026-08-14 16:05:32 +02:00
|
|
|
|
2026-08-14 23:15:12 +02:00
|
|
|
# Bootstraps the surviving fleet, including each vessel type, on this scene's
|
|
|
|
|
# own startup (from GameState, since this is a fresh scene tree - nothing here
|
|
|
|
|
# carries over automatically) and handles the always-available exit prompt that
|
Initial commit: SpaceshipTest, a top-down space RTS in Godot 4.7.1
A fleet of neon-outlined ships explores a procedurally generated, seeded
infinite world: tap/joystick steering, pinch zoom, formation pivoting,
planet landings, an ore economy with extractors and haulers, and player
built structures (mothership, ship crafter, command centre).
All art is hand-drawn with draw_* calls rather than textures, and the
backgrounds are camera-relative shaders so they stay precise at large
world coordinates.
Includes a 35-test headless suite (tests/run_tests.sh) plus screenshot
tooling that renders real frames through Xvfb and Mesa softpipe, since
--headless has no GPU.
Excluded from version control: .godot/ (import cache, and it holds
export credentials), builds/, android/build/ and packaged APKs - all
regenerable, and ~325 MB combined.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
2026-08-10 18:41:58 +02:00
|
|
|
# fades back out to Main.tscn, restoring the fleet at wherever it left
|
|
|
|
|
# space from.
|
|
|
|
|
|
|
|
|
|
@export var fade_duration: float = 0.4
|
|
|
|
|
|
|
|
|
|
@onready var fleet: Node2D = get_node("../Fleet")
|
|
|
|
|
@onready var camera: Camera2D = get_node("../Camera2D")
|
|
|
|
|
@onready var planet_name_label: Label = get_node("../UI/PlanetNameLabel")
|
|
|
|
|
@onready var exit_button: IconButton = get_node("../UI/ExitButton")
|
|
|
|
|
@onready var fade_rect: ColorRect = get_node("../FadeOverlay/FadeRect")
|
Share one backdrop between game and editor, and fix three input/economy bugs
The setup editor and the landed surface drew different backgrounds for the
same planet. Each scene carried its own hand-written ShaderMaterial, and only
the game side ever swapped in a profile's shader, so a gas giant authored in
the editor showed recoloured craters while the game showed cloud bands. Both
now instance one SurfaceBackground.tscn and configure it through one method,
and every profile names its own shader - the old "null means keep whatever
the scene already had" convention was the drift, since each scene "already
had" something different. The shared material is resource_local_to_scene, or
two live surfaces would repaint each other.
The gas giant's bands broke into disjoint segments once per cell: the second
turbulence octave doubled only the INTEGER half of a lattice coordinate,
which is a different point in every cell rather than the same point at twice
the frequency. Measured, the old form steps 0.153 at a cell boundary against
0.0002 now. A second discontinuity went with it - the camera cell index
arrives pre-wrapped, so hashing it raw rearranged the whole sky every 32
cells; hashes are now wrapped per octave and the field is exactly periodic.
Bands also gained low-frequency octaves and per-row differential drift.
WorldMap swallowed every touch in _input(), which runs before the GUI system,
so CloseButton never saw one: the map could be opened and not closed. Android
and desktop hid it behind Godot's emulated mouse event, which this never
swallowed; a phone browser gives no such second chance. Its test had been
closing the map by calling the method the button was failing to reach.
Construction now draws on the fleet hold as well as the bank. With an empty
starting bank and ore bankable only at a mothership, charging construction to
the bank alone made the first mothership cost ore that could not yet exist.
Also: a conquered planet no longer re-spawns its garrison (guarded on having
capture points, since a setup with none registers as vacuously conquered);
planets keep the map they drew, with the candidate list sorted rather than
left in filesystem order and assignments pruned rather than cleared on
rescan; and the map editor lists setups at a tappable size and can delete
one, as an explicit armed mode rather than a tap away from destroying work.
Full suite 106/106.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
2026-08-19 11:16:38 +02:00
|
|
|
@onready var background: ColorRect = get_node("../BackgroundLayer/Background")
|
2026-08-14 16:05:32 +02:00
|
|
|
@onready var feature_host: Node2D = get_node("../SurfaceFeatures")
|
Initial commit: SpaceshipTest, a top-down space RTS in Godot 4.7.1
A fleet of neon-outlined ships explores a procedurally generated, seeded
infinite world: tap/joystick steering, pinch zoom, formation pivoting,
planet landings, an ore economy with extractors and haulers, and player
built structures (mothership, ship crafter, command centre).
All art is hand-drawn with draw_* calls rather than textures, and the
backgrounds are camera-relative shaders so they stay precise at large
world coordinates.
Includes a 35-test headless suite (tests/run_tests.sh) plus screenshot
tooling that renders real frames through Xvfb and Mesa softpipe, since
--headless has no GPU.
Excluded from version control: .godot/ (import cache, and it holds
export credentials), builds/, android/build/ and packaged APKs - all
regenerable, and ~325 MB combined.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
2026-08-10 18:41:58 +02:00
|
|
|
|
|
|
|
|
var transitioning: bool = false
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
func _ready() -> void:
|
2026-08-14 16:13:24 +02:00
|
|
|
var planet_definition: Resource = PLANET_DEFINITIONS.get_definition(GameState.planet_definition_id)
|
|
|
|
|
_compose_surface(SURFACE_PROFILES.get_profile(planet_definition.surface_profile_id))
|
2026-08-14 23:15:12 +02:00
|
|
|
fleet.spawn_ships(GameState.surviving_ship_count, Vector2.ZERO,
|
|
|
|
|
GameState.surviving_vessel_types)
|
Initial commit: SpaceshipTest, a top-down space RTS in Godot 4.7.1
A fleet of neon-outlined ships explores a procedurally generated, seeded
infinite world: tap/joystick steering, pinch zoom, formation pivoting,
planet landings, an ore economy with extractors and haulers, and player
built structures (mothership, ship crafter, command centre).
All art is hand-drawn with draw_* calls rather than textures, and the
backgrounds are camera-relative shaders so they stay precise at large
world coordinates.
Includes a 35-test headless suite (tests/run_tests.sh) plus screenshot
tooling that renders real frames through Xvfb and Mesa softpipe, since
--headless has no GPU.
Excluded from version control: .godot/ (import cache, and it holds
export credentials), builds/, android/build/ and packaged APKs - all
regenerable, and ~325 MB combined.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
2026-08-10 18:41:58 +02:00
|
|
|
camera.position = Vector2.ZERO
|
|
|
|
|
camera.zoom = Vector2(GameState.return_camera_zoom, GameState.return_camera_zoom)
|
|
|
|
|
planet_name_label.text = GameState.planet_name
|
|
|
|
|
exit_button.pressed.connect(_on_exit_pressed)
|
|
|
|
|
|
|
|
|
|
fade_rect.color.a = 1.0
|
|
|
|
|
var tween: Tween = create_tween()
|
|
|
|
|
tween.tween_property(fade_rect, "color:a", 0.0, fade_duration)
|
|
|
|
|
|
|
|
|
|
|
2026-08-14 16:05:32 +02:00
|
|
|
func _compose_surface(profile: Resource) -> void:
|
Share one backdrop between game and editor, and fix three input/economy bugs
The setup editor and the landed surface drew different backgrounds for the
same planet. Each scene carried its own hand-written ShaderMaterial, and only
the game side ever swapped in a profile's shader, so a gas giant authored in
the editor showed recoloured craters while the game showed cloud bands. Both
now instance one SurfaceBackground.tscn and configure it through one method,
and every profile names its own shader - the old "null means keep whatever
the scene already had" convention was the drift, since each scene "already
had" something different. The shared material is resource_local_to_scene, or
two live surfaces would repaint each other.
The gas giant's bands broke into disjoint segments once per cell: the second
turbulence octave doubled only the INTEGER half of a lattice coordinate,
which is a different point in every cell rather than the same point at twice
the frequency. Measured, the old form steps 0.153 at a cell boundary against
0.0002 now. A second discontinuity went with it - the camera cell index
arrives pre-wrapped, so hashing it raw rearranged the whole sky every 32
cells; hashes are now wrapped per octave and the field is exactly periodic.
Bands also gained low-frequency octaves and per-row differential drift.
WorldMap swallowed every touch in _input(), which runs before the GUI system,
so CloseButton never saw one: the map could be opened and not closed. Android
and desktop hid it behind Godot's emulated mouse event, which this never
swallowed; a phone browser gives no such second chance. Its test had been
closing the map by calling the method the button was failing to reach.
Construction now draws on the fleet hold as well as the bank. With an empty
starting bank and ore bankable only at a mothership, charging construction to
the bank alone made the first mothership cost ore that could not yet exist.
Also: a conquered planet no longer re-spawns its garrison (guarded on having
capture points, since a setup with none registers as vacuously conquered);
planets keep the map they drew, with the candidate list sorted rather than
left in filesystem order and assignments pruned rather than cleared on
rescan; and the map editor lists setups at a tappable size and can delete
one, as an explicit armed mode rather than a tap away from destroying work.
Full suite 106/106.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
2026-08-19 11:16:38 +02:00
|
|
|
# Shared with PlanetSetupEditor, deliberately: the backdrop is one
|
|
|
|
|
# instanced scene configured through one method, so what an author sees
|
|
|
|
|
# while placing markers is what a player sees after landing. See the
|
|
|
|
|
# header of SurfaceBackground.gd.
|
|
|
|
|
background.apply_profile(profile)
|
2026-08-15 21:22:10 +02:00
|
|
|
for caption_path in ["../UI/BankCaption", "../UI/FleetCaption", "../UI/CaptureLabel"]:
|
2026-08-14 16:05:32 +02:00
|
|
|
var caption: Label = get_node(caption_path)
|
|
|
|
|
caption.add_theme_color_override("font_color", profile.caption_color)
|
|
|
|
|
caption.add_theme_color_override("font_outline_color", profile.caption_outline_color)
|
2026-08-15 14:41:37 +02:00
|
|
|
if profile.features_scene != null:
|
|
|
|
|
var features: Node = profile.features_scene.instantiate()
|
|
|
|
|
feature_host.add_child(features)
|
|
|
|
|
|
|
|
|
|
var setup: Resource = PLANET_SETUPS.setup_for_planet(GameState.planet_id, profile.profile_id)
|
|
|
|
|
if setup != null:
|
|
|
|
|
# Untyped on purpose: a static PlanetSetupHost annotation here would
|
|
|
|
|
# need the global class_name cache to already know about it, which
|
|
|
|
|
# is only true after an editor/import pass has run (see #31/#35's
|
|
|
|
|
# load-order notes) - a plain Node reference plus duck-typed
|
|
|
|
|
# apply_setup() sidesteps that entirely, same as BuildingDefinitions
|
|
|
|
|
# and VesselDefinitions already do for their own resource types.
|
|
|
|
|
var setup_host: Node = SETUP_HOST_SCENE.instantiate()
|
|
|
|
|
feature_host.add_child(setup_host)
|
|
|
|
|
setup_host.apply_setup(setup)
|
2026-08-16 13:13:38 +02:00
|
|
|
else:
|
|
|
|
|
# No PlanetSetup exists for this profile at all (#55: "void" has
|
|
|
|
|
# none authored) - register zero required points directly, rather
|
|
|
|
|
# than leaving this planet's conquest state unregistered forever.
|
|
|
|
|
# capture_state()'s fallback for an unregistered planet_id defaults
|
|
|
|
|
# to conquered=false (see test_planet_conquest_gate.gd's own "a
|
|
|
|
|
# fresh planet reported conquered" check), which would otherwise
|
|
|
|
|
# permanently block extractor placement here - register_capture_
|
|
|
|
|
# points() treats a total of 0 as vacuously already conquered.
|
|
|
|
|
GameState.register_capture_points(GameState.planet_id, 0)
|
2026-08-14 16:05:32 +02:00
|
|
|
|
|
|
|
|
|
Initial commit: SpaceshipTest, a top-down space RTS in Godot 4.7.1
A fleet of neon-outlined ships explores a procedurally generated, seeded
infinite world: tap/joystick steering, pinch zoom, formation pivoting,
planet landings, an ore economy with extractors and haulers, and player
built structures (mothership, ship crafter, command centre).
All art is hand-drawn with draw_* calls rather than textures, and the
backgrounds are camera-relative shaders so they stay precise at large
world coordinates.
Includes a 35-test headless suite (tests/run_tests.sh) plus screenshot
tooling that renders real frames through Xvfb and Mesa softpipe, since
--headless has no GPU.
Excluded from version control: .godot/ (import cache, and it holds
export credentials), builds/, android/build/ and packaged APKs - all
regenerable, and ~325 MB combined.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
2026-08-10 18:41:58 +02:00
|
|
|
func _on_exit_pressed() -> void:
|
|
|
|
|
if transitioning:
|
|
|
|
|
return
|
|
|
|
|
transitioning = true
|
|
|
|
|
|
|
|
|
|
GameState.surviving_ship_count = fleet.ships.size()
|
2026-08-14 23:15:12 +02:00
|
|
|
GameState.surviving_vessel_types = fleet.vessel_types()
|
Initial commit: SpaceshipTest, a top-down space RTS in Godot 4.7.1
A fleet of neon-outlined ships explores a procedurally generated, seeded
infinite world: tap/joystick steering, pinch zoom, formation pivoting,
planet landings, an ore economy with extractors and haulers, and player
built structures (mothership, ship crafter, command centre).
All art is hand-drawn with draw_* calls rather than textures, and the
backgrounds are camera-relative shaders so they stay precise at large
world coordinates.
Includes a 35-test headless suite (tests/run_tests.sh) plus screenshot
tooling that renders real frames through Xvfb and Mesa softpipe, since
--headless has no GPU.
Excluded from version control: .godot/ (import cache, and it holds
export credentials), builds/, android/build/ and packaged APKs - all
regenerable, and ~325 MB combined.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
2026-08-10 18:41:58 +02:00
|
|
|
|
|
|
|
|
var tween: Tween = create_tween()
|
|
|
|
|
tween.tween_property(fade_rect, "color:a", 1.0, fade_duration)
|
|
|
|
|
tween.tween_callback(_return_to_space)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
func _return_to_space() -> void:
|
|
|
|
|
get_tree().change_scene_to_file("res://Main.tscn")
|