Hitmark Range: Crosshairs, Hit Markers, Damage Numbers and Nameplates
README.md
timeline
What keeps every machine's screen on the same moment of the match, as pure Luau with no engine calls. MatchFlow uses it on every machine, the one in charge included, and the test suite drives it with simulated latency.
newClock()/ownClock(),addSample(clock, t0, theirs, t1),guessandslewmatch this machine's clock to the match clock of the machine in charge from ping round trips. The quickest recent trip sets the offset, and the first one replaces the initial guess outright. Later corrections run the shown clock at most 5% fast or slow (SLEW_RATE), so it never jumps.clock.rttMax, the slowest recent trip, is what a machine reports so that the delay can be sized.delayFor(rtts)picks how far every screen trails the machine in charge: half the slowest round trip plus 0.1 s (MARGIN: one sync tick, a frame either side and a little clock error), from 0.15 to 0.6 s.graceFor(delay, rtts)gives how long a timed round stays open after 0:00, so late-arriving reports made before the end still count.delayAt(ramp, now)andretarget(ramp, to, now)handle a published delay{ from, to, at }. A new delay startsRAMP_LEAD(0.5 s) after it is published and slides atRAMP_RATE(0.2 s per second), so every machine's delay moves at the same instant and rate. A plain number is read as a fixed delay.new(),push(tl, snapshot)andpick(tl, t)hold the recent snapshots and pick the one standing at a shared time. A snapshot carriesev, how far into its phase the latest change was made, so one that arrives a sync tick late is still shown from the moment of its change.show(view, snapshot, t)turns a snapshot into the state to draw at timet. The clocks run on from the snapshot, and the clock never runs backwards within a phase.