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>
70 lines
2.5 KiB
GDScript
70 lines
2.5 KiB
GDScript
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
|
|
|
|
var packed: PackedScene = load("res://Main.tscn")
|
|
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
|