netsync — Luau Binding
require("netsync"): run a deterministic lockstep or rollback session — exchange inputs, drive the stage tick, and let the shared simulation stay in sync. The programmatic surface of the net-sync system. Every function is[antos].
Status: design — the horizon. Not built yet.
local netsync = require("netsync")
| Call | Returns | Does |
|---|---|---|
netsync.start(opts) |
session |
begin a session — opts = { mode = "lockstep" or "rollback", peers, seed, transport }. Takes over driving stage.tick |
netsync.input(local_snapshot) |
ok |
submit this machine's input snapshot for the current tick |
netsync.stop() |
ok |
end the session, hand the tick back to the OS |
netsync.stats() |
{ tick, latency, rollbacks, drift } |
link and sync health — rollbacks and drift are the numbers to watch |
local netsync = require("netsync")
netsync.start{ mode = "rollback", peers = { "10.0.0.2" }, seed = 12345 }
-- each tick: hand the engine our input; it predicts/rolls back the rest
netsync.input(input.snapshot())
Because the seed is fixed and shared and every machine runs the same deterministic core, the peers stay identical frame for frame — the whole point of syncing inputs instead of state.