five-on-it / packages/net-client/src/input-history
packages/net-client/src/input-history
The client's last inputs, for its frames of inputs (@foi/protocol's kind 7): every tick the client sends its newest few inputs, newest first, so an input lost on a transport that drops frames comes again in the next ones (the server takes each once: apps/server/src/input-queue.ts), with the newest snapshot tick it applied as the acknowledgement the acked snapshots go onto. Over a WebSocket one input a frame is enough (INPUTS_PER_FRAME). A client that sends no inputs for a while (the room frozen for it in the pause menu) still acknowledges what it gets, alone, every IDLE_ACK_MS.
The inputs are numbered by the client's clock, and a stall's dropped ticks are never sent (Predictor.guess): an input's number in a frame is implied by its place, so the history keeps only inputs numbered one after the other, and a gap forgets those before it.