Sharpen fleet handling, widen the laser, and fix the map editor's file identity

The fleet had a second of inertia in it: every vessel's acceleration sat at
roughly its own top speed, so flipping the stick while cruising took 0.58s to
take effect and let go coasted 222 units, while the formation anchor the ships
chase turns instantly. Acceleration is now ~3x top speed, chosen by measuring
rather than taste - past 3x the reversal time stops improving because
max_speed becomes the limit. Measured after: 0.18s and 23 units.
test_fleet_agility guards all three numbers and proves the bounds discriminate
by re-running the same measurement at the old value.

The laser reaches 1450 instead of 950 and strikes 38 units either side instead
of 22. Its drawn width is now derived from the hit width: the two were
independent numbers that had drifted, so the beam killed things it visibly
missed. LaserController's aim range also stopped hardcoding a second copy of
950. Tapping the laser button without dragging used to do nothing at all - the
press was claimed, the aim begun, then thrown away on release. It now fires at
the nearest enemy in range; dragging still aims precisely. That lives in the
shared aimed-ability controller, so the gas bomb gains it too.

Planets sat one per ~29 chunks - some 35,000 units of nothing between them.
Now one per ~12, measured over 14,641 chunks. The two thresholds moved by
different amounts deliberately: every SPACE-biome planet is a gas giant, so
lowering both equally would have tripled the gas-giant share as well. This
changes how often you find a planet, not what you find. Extractors produce
half as fast to match, so expanding is what grows the economy.

The research screen gave its tree 386px of 1280 and the text below it 520.
The text is now at the bottom, the tree has 550, and the resource table has
room and legible type - and its LOCAL column is no longer hidden behind the
close button.

Two map-editor bugs turned out to be one cause: a setup's id and its FILENAME
are not the same thing, and both save and delete rebuilt the path from the id.
ResearchLabSetup.tres holds setup_id "research_lab_1", so deleting it looked
for a file that does not exist and silently refused - which read as "the first
item in the list cannot be deleted" - while saving it wrote a second file
under the derived name and left the original behind, so the pool served the
stale twin. A third bug hid behind those: rescan() re-read through Godot's
resource cache and handed back pre-save values even when the file on disk was
correct. All three present to a player as "my change was not saved".

Research labs no longer grant a point of their own; what conquering one is
worth comes entirely from its authored map, as asked. The shipped lab map
carries 1 so the balance is unchanged - only where it is configured moved.

Suite 109/109. Four tests changed because the behaviour they pinned changed:
the joystick coast is now derived from cruise_speed^2/(2*acceleration) rather
than a constant tuned to one acceleration; the extractor wait derives from
EXTRACTOR_RATE; the research-point test asserts the delegation; and the black
hole test no longer assumes nobody will ever author a void-profile map.
test_planet_setups and test_planet_map_assignment stopped depending on which
maps happen to be in the content folder, which was making them fail when maps
were added or deleted elsewhere.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
Loïc Wisniewski 2026-08-20 09:55:11 +02:00
commit 8ba2cca6b6
37 changed files with 954 additions and 273 deletions

View file

@ -64,6 +64,10 @@ const PALETTE_STEP: float = 92.0
@onready var delete_map_button: IconButton = $UI/LoadPanel/DeleteMapButton
var current_setup: Resource
# The file the open setup was loaded from, or "" for one that has never been
# saved. Saving writes HERE rather than to a path derived from setup_id - see
# PlanetSetups.path_for_id for why deriving it forks a duplicate.
var current_setup_path: String = ""
var selected_palette: String = "capture_point"
var selected_item: Dictionary = {}
var _profile_ids: Array = []
@ -120,6 +124,7 @@ func _ready() -> void:
func new_setup(setup_id: String, display_name: String, profile_id: String) -> void:
current_setup = PLANET_SETUP_SCRIPT.new()
current_setup_path = ""
current_setup.setup_id = setup_id
current_setup.display_name = display_name
current_setup.surface_profile_id = profile_id
@ -145,6 +150,10 @@ func load_setup(setup_id: String) -> bool:
# registry entry (which other code may be reading) until an
# explicit save.
current_setup = setup.duplicate(true)
# duplicate() deliberately has no resource_path of its own, so the
# source file is remembered separately - saving must go back to
# the file this was opened from.
current_setup_path = String(setup.resource_path)
selected_item = {}
_refresh_selected_label()
_profile_cursor = maxi(_profile_ids.find(current_setup.surface_profile_id), 0)
@ -164,10 +173,12 @@ func save_setup() -> Dictionary:
return {"ok": false, "message": "Name the setup before saving."}
if not OS.has_feature("editor"):
return {"ok": false, "message": "Setups can only be saved when running from the project."}
var path: String = "res://PlanetSetups/%s.tres" % current_setup.setup_id
var path: String = current_setup_path if current_setup_path != "" \
else "res://PlanetSetups/%s.tres" % current_setup.setup_id
var err: int = ResourceSaver.save(current_setup, path)
if err != OK:
return {"ok": false, "message": "Save failed (error %d)." % err}
current_setup_path = path
PlanetSetups.rescan()
return {"ok": true, "message": "Saved '%s'." % current_setup.setup_id}
@ -180,7 +191,11 @@ func delete_setup(setup_id: String) -> Dictionary:
return {"ok": false, "message": "No setup to delete."}
if not OS.has_feature("editor"):
return {"ok": false, "message": "Setups can only be deleted when running from the project."}
var path: String = "res://PlanetSetups/%s.tres" % setup_id
# Asked of the registry, not assembled from the id - see
# PlanetSetups.path_for_id. A setup whose filename differs from its id
# could not be deleted at all before this, which is why the first entry in
# the list appeared to be undeletable: it is the one with the mismatch.
var path: String = PlanetSetups.path_for_id(setup_id)
if not ResourceLoader.exists(path):
return {"ok": false, "message": "No setup file for '%s'." % setup_id}
var err: int = DirAccess.remove_absolute(ProjectSettings.globalize_path(path))
@ -196,6 +211,10 @@ func delete_setup(setup_id: String) -> Dictionary:
# the next save silently recreate the file the player just removed.
if current_setup != null and String(current_setup.setup_id) == setup_id:
new_setup("untitled", "Untitled", _profile_ids[_profile_cursor])
elif current_setup_path == path:
# Same file under a different id - the open copy has nowhere to go
# back to either.
current_setup_path = ""
return {"ok": true, "message": "Deleted '%s'." % setup_id}