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 SceneTree
|
|
|
|
|
|
|
|
|
|
# Headless gameplay test: run with
|
|
|
|
|
# godot --headless -s res://tests/test_no_popin_on_load.gd
|
|
|
|
|
# Verifies AsteroidField/PlanetField populate the area around the fleet's
|
|
|
|
|
# STARTING position immediately (synchronously, during Main.tscn's own
|
|
|
|
|
# _ready() chain), not only after their ~1s check_interval timer first
|
|
|
|
|
# elapses - otherwise the world visibly pops in a beat after the screen
|
|
|
|
|
# is already visible (most noticeable right after returning from a
|
|
|
|
|
# planet's surface, which is what this simulates via GameState).
|
|
|
|
|
|
|
|
|
|
var main_scene: Node
|
|
|
|
|
var asteroid_field: Node
|
|
|
|
|
var planet_field: Node
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
func _initialize() -> void:
|
|
|
|
|
var target_chunk: Vector2i = Vector2i.ZERO
|
|
|
|
|
var found: bool = false
|
|
|
|
|
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):
|
|
|
|
|
target_chunk = chunk
|
|
|
|
|
found = true
|
|
|
|
|
break
|
|
|
|
|
if found:
|
|
|
|
|
break
|
|
|
|
|
|
|
|
|
|
if not found:
|
|
|
|
|
print("FAIL: could not find any chunk with a planet to test with")
|
|
|
|
|
quit(1)
|
|
|
|
|
return
|
|
|
|
|
|
|
|
|
|
# GameState (an autoload) isn't accessible as a bare global identifier
|
|
|
|
|
# from a script that extends SceneTree directly - that auto-injection
|
|
|
|
|
# only applies to Node-derived scripts (e.g. everything inside
|
|
|
|
|
# main_scene). Fetch it explicitly via the tree root instead.
|
|
|
|
|
var game_state: Node = root.get_node("GameState")
|
|
|
|
|
game_state.has_return_position = true
|
|
|
|
|
game_state.surviving_ship_count = 5
|
|
|
|
|
game_state.return_world_position = WorldGen.chunk_origin(target_chunk) + Vector2.ONE * WorldGen.CHUNK_SIZE * 0.5
|
|
|
|
|
game_state.return_camera_zoom = 1.0
|
|
|
|
|
|
#84: move 215 root files into a folder hierarchy
Everything lived in one flat directory, so a diff gave no clue what area it
touched and finding the file you wanted meant knowing its exact name. Twelve
folders now, grouped by what a thing IS rather than what type it is - a
vessel's definition, its component scenes and its upgrade resources sit
together, because that is the set you read when you change one of them.
buildings core controllers enemies logistics planets
resources shaders surface ui vessels vfx world
332 files moved and every res:// reference rewritten - 306 files touched,
including the autoload and main-scene paths in project.godot. Nothing renamed:
this is purely where files sit, so the diff is a pile of pure moves and no
behaviour is buried in it. ui_theme.tres, icon.svg and web_shell.html stay at
the root, where Godot and the export preset expect them.
Verified three ways, because a suite alone would not have caught all of it:
the full 117 pass, the web export builds clean, and the game renders.
The export is why that matters. The FIRST export after the move failed with
"Attempt to open script 'res://GameState.gd'" - the old path - while
project.godot on disk plainly said res://core/GameState.gd. That is this
project's documented Android FUSE mtime trap: Godot served a cached copy of a
file whose content had changed. A `touch` fixed it. Nothing in the test suite
would have found that, because the suite runs from a copy on a native
filesystem - the one place the bug cannot happen.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
2026-08-21 19:44:14 +02:00
|
|
|
var packed: PackedScene = load("res://world/Main.tscn")
|
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
|
|
|
main_scene = packed.instantiate()
|
|
|
|
|
root.add_child(main_scene)
|
|
|
|
|
asteroid_field = main_scene.get_node("AsteroidField")
|
|
|
|
|
planet_field = main_scene.get_node("PlanetField")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
func _process(_delta: float) -> bool:
|
|
|
|
|
# Check on literally the FIRST frame after the scene has entered the
|
|
|
|
|
# tree and _ready() chains have run - no waiting for any spawner's
|
|
|
|
|
# own check_interval timer.
|
|
|
|
|
var asteroids_populated: bool = not asteroid_field.populated_chunks.is_empty()
|
|
|
|
|
var planet_populated: bool = not planet_field.populated_chunks.is_empty()
|
|
|
|
|
|
|
|
|
|
print("asteroids_populated=%s (chunks=%d) planet_populated=%s (chunks=%d)" % [
|
|
|
|
|
asteroids_populated, asteroid_field.populated_chunks.size(),
|
|
|
|
|
planet_populated, planet_field.populated_chunks.size()
|
|
|
|
|
])
|
|
|
|
|
|
|
|
|
|
if asteroids_populated and planet_populated:
|
|
|
|
|
print("TEST_NO_POPIN_ON_LOAD: PASS")
|
|
|
|
|
quit(0)
|
|
|
|
|
else:
|
|
|
|
|
print("TEST_NO_POPIN_ON_LOAD: FAIL")
|
|
|
|
|
quit(1)
|
|
|
|
|
return true
|