code wiki / (root) / nx_determinism.nx

nx_determinism.nx

buildroot/runtime/nx_determinism.nx

2811 B70 linesdepth 3pulls 3 transitivereach 1 importersview sourcekind library
docsdependenciesstructsconstsfunctions

about

nx_determinism.nx -- rollback SYNC-TEST harness (GGPO "1-frame rollback every frame"). PROVES simulation determinism instead of asserting it: every frame, snapshot -> advance -> rollback to the snapshot -> re- advance with the same input, and the re-simulated state checksum MUST equal both the advanced state AND the no-rollback run. Any divergence = a desync bug (the #1 rollback-netcode failure: state not captured in the snapshot). Integer-only sims are deterministic by construction (no float drift) -- this gate turns that structural property into a gated, verified one. Composes nx_crc32c for the state checksum (CLAUDE.md 15). Sovereign. license_tier: ORIGINAL

dependencies 1 imports · 1 importers

nx_crc32c.nx nx_determinism.nx nx_determinism_test.nx

imports: nx_crc32c.nx

imported by: nx_determinism_test.nx

structs

none

consts

none

functions

17func det_copy(dst: *i64, src: *i64, nwords: i64) -> i64
22func det_state_checksum(t: *i64, state: *i64, nwords: i64) -> i64
28func det_sim_step(state: *i64, nwords: i64, input: i64) -> i64
called by 1: det_rollback_verify
39func det_rollback_verify(t: *i64, state0: *i64, nwords: i64, inputs: *i64, nframes: i64) -> i64