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(): computemaxPtsfromstate.tracerDurationSecandstate.tickRate(same formula asupdateMyShipTracer), replacing the staticMAX_TRACE_POINTScap.updateMyShipTracer(): remove the 60000 hard cap onmaxPts. Allocate the Float32Array buffer tomaxPts * 3instead of60000 * 3.- Both functions: reallocate the buffer if
maxPtschanges (user changes duration setting at runtime).
state.js
- Remove
MAX_TRACE_POINTSexport.
cockpitSettings.js / index.html
- Remove the
max="3600"cap on the HTML input and the JSMath.min(3600, ...)clamp. Keepmin="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