mirror of
https://github.com/jcreek/CosmicClash.git
synced 2026-09-13 04:32:06 +00:00
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:
@@ -7,6 +7,13 @@ extends Control
|
||||
# _process (smoothing 1-2 distinct fields) and _draw (entirely bespoke).
|
||||
|
||||
const SMOOTHING := 12.0
|
||||
# _draw does real work (text shaping, building point arrays); nobody can
|
||||
# perceive an instrument repainting faster than this, so redraws are paced
|
||||
# to it independently of the render frame rate — value smoothing itself
|
||||
# still runs every _process call, only the (expensive) repaint is throttled.
|
||||
const REDRAW_INTERVAL := 1.0 / 60.0
|
||||
|
||||
var _time_since_redraw := 0.0
|
||||
|
||||
|
||||
static func lerp_angle_deg(from: float, to: float, weight: float) -> float:
|
||||
@@ -23,3 +30,12 @@ static func angle_delta_deg(from: float, to: float) -> float:
|
||||
|
||||
func _smoothing_weight(delta: float) -> float:
|
||||
return 1.0 - exp(-SMOOTHING * delta) # frame-rate independent
|
||||
|
||||
|
||||
# Call instead of queue_redraw() directly once a subclass's _process has
|
||||
# decided the smoothed value moved enough to warrant a repaint.
|
||||
func _throttled_redraw(delta: float) -> void:
|
||||
_time_since_redraw += delta
|
||||
if _time_since_redraw >= REDRAW_INTERVAL:
|
||||
_time_since_redraw = 0.0
|
||||
queue_redraw()
|
||||
|
||||
Reference in New Issue
Block a user