chore(multiplayer): Phase 0 refactors + graphics/perf settings groundwork

Lands the non-networked Phase 0 tasks from multiplayer-todo.md (ship/camera/
arena refactors, sim constants, background FPS handling) plus a first pass
at exposing graphics/performance settings (presets, resolution scaling,
vsync, FPS cap, perf overlay) and a GPU profiling harness for the
real-hardware follow-up in task 0.15b.
This commit is contained in:
Josh Creek
2026-08-19 22:37:17 +01:00
parent 88591e031f
commit 04691aaa48
29 changed files with 2212 additions and 134 deletions
+16 -3
View File
@@ -34,6 +34,10 @@ const DIFFICULTIES := [
func _ready() -> void:
# An idle menu has no reason to render past the display's own refresh
# rate; gameplay scenes are uncapped again by _leave_to_gameplay below.
var refresh_rate := DisplayServer.screen_get_refresh_rate()
Engine.max_fps = int(refresh_rate) if refresh_rate > 0 else 0
_populate_difficulty_dropdown()
_populate_arena_dropdown()
dev_section.visible = OS.is_debug_build()
@@ -115,10 +119,19 @@ func _selected_path(dropdown: OptionButton) -> String:
return ""
# The menu's own refresh-rate fps cap (see _ready) is a menu-only concern;
# gameplay scenes respect the player's own VideoSettings fps cap instead
# (task 0.17), which only actually caps anything when vsync is Disabled and a
# divisor is chosen — otherwise this uncaps exactly like the old hardcoded 0.
func _leave_to_gameplay(scene_path: String) -> void:
VideoSettings.apply_fps_cap()
get_tree().change_scene_to_file(scene_path)
func _on_free_play_pressed() -> void:
var chosen: Dictionary = ArenaRegistry.ARENAS[0] if arena_dropdown.selected < 0 else ArenaRegistry.ARENAS[arena_dropdown.selected]
GameSettings.selected_arena_path = chosen["path"]
get_tree().change_scene_to_file("res://scenes/free_play.tscn")
_leave_to_gameplay("res://scenes/free_play.tscn")
func _on_match_pressed() -> void:
@@ -134,7 +147,7 @@ func _on_match_pressed() -> void:
GameSettings.selected_bot_path = override_path
GameSettings.selected_bot_reaction_ticks = -1
GameSettings.selected_bot_action_noise = -1.0
get_tree().change_scene_to_file("res://scenes/match.tscn")
_leave_to_gameplay("res://scenes/match.tscn")
func _on_settings_pressed() -> void:
@@ -144,4 +157,4 @@ func _on_settings_pressed() -> void:
func _on_spectate_pressed() -> void:
GameSettings.spectate_bot_a_path = _selected_path(bot_a_dropdown)
GameSettings.spectate_bot_b_path = _selected_path(bot_b_dropdown)
get_tree().change_scene_to_file("res://scenes/spectate.tscn")
_leave_to_gameplay("res://scenes/spectate.tscn")