Provides high-level client prediction primitives including passive smoothing, server-reconciled rollback, and optimistic events for real-time multiplayer games.
// Source: https://github.com/colyseus/colyseus | License: MIT | Copyright 2015-2026 Endel Dreyer
// Provided via justclaw.it.com; keep this notice with the code.
/**
* High-level prediction primitives — passive smoothing, server-reconciled
* rollback, and optimistic discrete events — built on top of the SDK's
* `room.input()` / `room.clock` handshake.
*
* One `Predict` per room is the usual shape:
*
* import { Predict } from "@colyseus/sdk/predict";
* // (or `import { Predict } from "@colyseus/sdk"` — both reach the same
* // module; the subpath form is slightly more bundler-friendly.)
*
* const predict = Predict.get(room, { mode: "lerp", delay: 80 });
* predict.attachAll("players", { fields: ["x", "y"], mode: "damped" });
* const me = predict.rec
... (truncated -- full source via MCP)
See the full source, get the GitHub permalink, and search for more like it.
Get a free API key