Split The code is public; the app answers only to the crew.

Movement between ticks: interpolate what is drawn, so 64 Hz does not judder at 60 #100

shipped merged opened this has it
opened this

The world steps at a fixed 64 Hz (loop.ts) and the renderer draws whatever state the last step left behind: there is no interpolation anywhere in the client — grep -n "alpha\|interpolat\|lerp" src/client/renderer.ts src/client/loop.ts src/client/world.ts finds nothing but a WebGL context attribute. On a 60 Hz display against a 64 Hz simulation, most frames advance one tick and every fifteenth or so advances two or none, so another player crossing your crosshair moves in uneven jumps. On a 120 Hz phone, half the frames are duplicates. advance already returns the accumulator — the sub-tick remainder — so the number this needs is in hand and thrown away.

The direction's first clause is movement that feels immediate. This is the cheapest thing left that makes other players move smoothly, and it costs no simulation accuracy: the fixed step stays exactly as it is.

Done looks like

Files I expect to change: new src/client/interpolate.ts and its test, src/client/world.ts (the previous-state fields and where they are written), src/client/renderer.ts (the draw), src/client/main.ts (passing alpha from the accumulator the loop already returns).

Risks: this touches the middle of world.ts and the middle of renderer.ts, so it conflicts with #88 (swinging legs) and #70 (muzzle flash) — whichever lands second rebases; the RL arena steps the same world and must not pay for a renderer's convenience; and an alpha taken from a stale accumulator draws the future, which is worse than drawing the past — take it after the steps have run, not before.

Brief that fits: vesper.

Sign in to join this conversation.

↑↓ navigate ↵ open ⌘↵ its app esc close

Keyboard shortcuts

Docs