code wiki / (root) / nx_netpredict.nx

nx_netpredict.nx

buildroot/runtime/nx_netpredict.nx

1858 B28 linesdepth 0pulls 0 transitivereach 1 importersview sourcekind library
docsdependenciesstructsconstsfunctions

about

nx_netpredict.nx -- CLIENT-SIDE PREDICTION + SERVER RECONCILIATION, the warzone-netcode core that hides RTT. The client applies local input IMMEDIATELY (predicts) so its own creature responds in <100ms regardless of the 150ms ocean RTT; it tags each input with a sequence number and sends them to the authoritative server. The server returns its authoritative state stamped with the last input it processed; the client snaps to that and REPLAYS the still- pending (un-acked) inputs on top (reconciliation). If the prediction was right, reconciled == predicted -> no visible correction. If the server diverged (an event the client couldn't predict), reconciliation converges the client to the authoritative truth. Client predict, client replay, and the server all run the SAME deterministic step. Cited model: Valve/Gambetta/Overwatch. Pure integer. license_tier: ORIGINAL

dependencies 0 imports · 1 importers

nx_netpredict.nx nx_netpredict_gate.nx

imports: none

imported by: nx_netpredict_gate.nx

structs

none

consts

none

functions

11func np_step(pos: i64, input: i64) -> i64 { return pos + input }
called by 1: np_apply
14func np_apply(pos: i64, inputs: *i64, from: i64, to: i64) -> i64
called by 2: np_predictnp_reconcile calls 1: np_step
22func np_predict(confirmed_pos: i64, inputs: *i64, total: i64) -> i64
called by 1: main calls 1: np_apply
26func np_reconcile(auth_pos: i64, acked: i64, inputs: *i64, total: i64) -> i64
called by 1: main calls 1: np_apply