By: Michael Lynch <git@mtlynch.io>
Predict the local player between snapshots Rendering the local sprite only from server snapshots meant its position stepped at 20 Hz, and no client-side movement filled the frames between. The walk read as choppy compared to the client-only version on master. The sprite now runs on an Arcade Physics body driven by input velocity, so motion integrates at Phaser's fixed step. Server snapshots stash the divergence as a decaying correction rather than teleporting the sprite. Correction is only applied on axes the player isn't actively driving — on a driven axis the gap is expected RTT-worth of lag, and consuming it would visibly slow the sprite below its intended speed. The one architectural cost is that PLAYER_SPEED now lives on both sides of the wire again; a comment in game-scene.ts calls out the pairing with state.ex. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>