Tracer Duration-Based Point Cap

Issue: #1008

Summary

Unify tracer point limiting: both my-ship and other-ship tracers use the same duration-based calculation from state.tracerDurationSec. Remove the hardcoded MAX_TRACE_POINTS constant and the 60000-point buffer cap.

Changes

tracers.js

  • updateShipTracer(): compute maxPts from state.tracerDurationSec and state.tickRate (same formula as updateMyShipTracer), replacing the static MAX_TRACE_POINTS cap.
  • updateMyShipTracer(): remove the 60000 hard cap on maxPts. Allocate the Float32Array buffer to maxPts * 3 instead of 60000 * 3.
  • Both functions: reallocate the buffer if maxPts changes (user changes duration setting at runtime).

state.js

  • Remove MAX_TRACE_POINTS export.

cockpitSettings.js / index.html

  • Remove the max="3600" cap on the HTML input and the JS Math.min(3600, ...) clamp. Keep min="10" as a floor.

Shared helper

Extract tracerMaxPoints() to avoid duplicating the formula:

function tracerMaxPoints() {
  const durSec = state.tracerDurationSec || 200;
  const tickRate = state.tickRate || 15;
  return Math.max(100, Math.round(durSec * tickRate));
}

Verification

  • Visual: tracers render at various duration settings (10s, 200s, 3600s)
  • Other ships’ tracers respect the same duration setting
  • Changing duration mid-flight reallocates buffer correctly

Back to top

Galaxy — Kubernetes-based multiplayer space game

This site uses Just the Docs, a documentation theme for Jekyll.