Planet setups as authored resources #42
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Part of #40. #40 requires enemy/point layouts to be hand-authored and chosen from a list, not procedural, and stored in the game as dedicated resources rather than in a save file. This ticket adds that data format, its registry, and the surface-side host. The editor that writes these files is a later ticket; here they are written by hand.
Scope
PlanetSetupSpawn.gd-class_name PlanetSetupSpawn extends Resource,@export var enemy_id: String,@export var position: Vector2. (A sub-resource rather than aDictionary, soResourceSaverround-trips it cleanly for the editor later.)PlanetSetup.gd-class_name PlanetSetup extends Resource:@export var setup_id: String@export var display_name: String@export var surface_profile_id: String = "rocky"- which surface profile this setup is authored for (PlanetSurfaceProfilesids:"rocky","gas").@export var capture_points: PackedVector2Array- surface-local positions.@export var enemy_spawns: Array[Resource]-PlanetSetupSpawnentries.PlanetSetups.gd- registry mirroringPlanetDefinitions.gd:static func all() -> Arraystatic func setups_for_profile(profile_id: String) -> Arraystatic func setup_for_planet(planet_id: String, profile_id: String) -> Resource- deterministic pick:RandomNumberGeneratorseeded withhash(planet_id), indexing intosetups_for_profile. Same planet always gets the same setup, from anywhere, without storing anything - the patternWorldGen.planet_data_at_chunkalready uses.res://PlanetSetups/withDirAccessat first use rather than a hardcodedpreloaddictionary, so adding a.tresfile is the only step needed to add a setup. (In an exported buildDirAccessoverres://sees exactly the files packed at export time, which is the desired behaviour.)Ship two starter setups committed under
res://PlanetSetups/:rocky_default.tres(3 capture points, a couple of chaser spawns) andgas_default.tres(4 capture points). Positions should be a few hundred to ~1500 units from the origin, where the fleet lands.PlanetSetupHost.tscn+PlanetSetupHost.gd- aNode2Dthat takes aPlanetSetupand instantiates its contents. In this ticket it may spawn simple placeholder markers for capture points; the realCapturePointscene arrives with the capture ticket and enemy spawning with the enemy-foundation ticket. Keep the seam (func apply_setup(setup: Resource) -> void) stable so those tickets only fill it in.PlanetSurfaceController._compose_surface()- after the existingprofile.features_sceneinstantiation, resolvePlanetSetups.setup_for_planet(GameState.planet_id, profile.profile_id)and add a configuredPlanetSetupHostunderSurfaceFeatures.Constraints
No planet-type string comparisons anywhere - the profile id selects the setup list, exactly as #31 established.
PlanetSurfaceController.gdmust stay free of"rocky"/"gas_giant"literals.Acceptance criteria
setup_for_planetreturns the same setup for the sameplanet_idacross repeated calls and across fresh processes, and only ever returns setups whosesurface_profile_idmatches the one asked for..tresintores://PlanetSetups/makes it appear insetups_for_profilewith no other code change.bash tests/run_tests.sh atmospherestill passes (the landing transition is what this hooks into).Tests
tests/test_planet_setups.gd- determinism, profile filtering, registry pickup, and host instantiation on landing.bash tests/run_tests.sh setup.Repo notes (read before starting)
/storage/emulated/0/GodotProjects/SpaceshipTest.touchon it. Android FUSE does not bump mtime under~/storage/shared, and Godot's import cache will silently keep serving the old version, making a correct fix look like it did nothing.bash tests/run_tests.sh <substring>; full suite with no argument. Tests areSceneTreescripts printingTEST_NAME: PASS/TEST_NAME: FAIL (reason)and callingquit(0|1)- copy the shape oftests/test_gas_bomber_cooldowns.gd.bash tests/screenshot.sh <res://Scene.tscn> <out.png> <frames> 720x1280. Use few frames (~10-20); the software rasterizer is slow.--headlessrenders nothing at all, so it cannot validate visuals.NeonDraw/NeonPiece; do not introduce a different visual idiom.*Definitionresources plus capability component scenes. Do not addif type == "..."branches.FileAccess, nouser://anywhere outside this ticket's explicit scope).GameStateis an in-memory autoload. Do not invent a save system.Implemented and pushed as
5326852.PlanetSetup/PlanetSetupSpawnresources,PlanetSetupsregistry that scansres://PlanetSetups/at first use (not a hardcoded preload table) so a new.tresneeds no code change, and resolves the same setup deterministically perplanet_id- same pattern asWorldGen.planet_data_at_chunk.PlanetSurfaceControllercomposes aPlanetSetupHostonto the landed surface, alongside the existing resource-provider feature scene, with no planet-type string checks.rocky_default.tres,gas_default.tres.New test
tests/test_planet_setups.gdcovers determinism, profile filtering, registry pickup (drops a scratch.tres, rescans, confirms it's found and rescans clean), and landing composition on both profiles. Verified visually at 720x1280 - capture-point markers render as clean cyan rings against both surfaces.Markers are placeholders; #43 replaces them with the real
CapturePointscene through the sameapply_setup()entry point, which is why that method exists as a stable seam already.