[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"skill:01M7E6GFCPY4M19PD9VJJ88FY2":3,"skill-same:01M7E6GFCPY4M19PD9VJJ88FY2":47},{"skillNo":4,"name":5,"nameZh":6,"description":7,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":16,"categories":17,"keywords":18,"publishedAt":19,"linkOnly":20,"markdownContent":21,"markdownBody":22,"frontMatter":23,"refName":24,"commitSha":25,"skillDirectory":26,"forksCount":27,"repositoryHtmlUrl":28,"repositoryHomepageUrl":29,"ownerHtmlUrl":30,"ownerBlogUrl":31,"ownerDescription":6,"updatedAt":32,"install":33,"resources":46},"01M7E6GFCPY4M19PD9VJJ88FY2","determinism",null,"Use when a Godot game's simulation must give the same state from the same inputs, for replays, time rewind, rollback or lockstep netcode or server-side score checks, or when a replay or rolled-back session goes out of sync.","nick-vas\u002Fhyperdot","nick-vas","https:\u002F\u002Favatars.githubusercontent.com\u002Fu\u002F7181961?v=4","01M7E6F6F0BQ49V0JZHX9BXCBD","Nikolaos Vasilikiotis","01M7E6F6FZW8SW1AJ1S7ARFE89",1,"Apache-2.0","https:\u002F\u002Fgithub.com\u002Fnick-vas\u002Fhyperdot\u002Fblob\u002Fmain\u002F.agents\u002Fskills\u002Fdeterminism\u002FSKILL.md",[],[],"2026-11-15 14:19:17",false,"---\nname: determinism\ndescription: Use when a Godot game's simulation must give the same state from the same inputs, for replays, time rewind, rollback or lockstep netcode or server-side score checks, or when a replay or rolled-back session goes out of sync.\n---\n\n# Deterministic simulation in Godot 4 (C#)\n\nA simulation is deterministic when the same start state and the same inputs give the same state, bit for bit. Replays,\nrollback and lockstep netcode, replay-checked leaderboards and \"send me your replay\" bug reports all depend on it. It\nbreaks quietly, so test it in CI from the first day. Every figure here was measured on Godot 4.7.2 and .NET 8 (x64);\nsources: `${CLAUDE_PLUGIN_ROOT}\u002Fdocs\u002Fdeterminism.md`.\n\n## 1. How far it must reach\n\n| Need | Must match | Floats acceptable? |\n|---|---|---|\n| Replays, bug repro, tests | The same build on the same machine | Yes |\n| Rollback between identical clients | The same build and platform | Yes, with the traps below avoided |\n| Lockstep or replay checks across PCs, Macs, phones | Every platform | Integers or fixed-point; floats are unproven in .NET |\n\n## 2. What .NET actually does (measured)\n\n- Scalar `float` and `double` code gave identical bits in Debug and Release, with tiered compilation, PGO, quick JIT,\n  FMA, AVX2, AVX-512 and all hardware intrinsics on or off. The JIT does not fuse `a*b+c` into one FMA, on x64 (tested)\n  or Arm64 (dotnet\u002Fruntime #64591).\n- Across machines, three things change results:\n  - **`Vector\u003CT>` and SIMD reductions**: its width is 8 floats with AVX2 and 4 without, so a sum differs. Any change in\n    summation order does (`Parallel.For`, a different loop shape).\n- List the simulation folders in `architecture.json` (`\"simulation\": [\"sim\"]`) and the `architecture` runner's\n  `nondeterministic-sim` rule flags the calls below there (set it to `error` for lockstep or rollback).\n  - **`Math.Sin`, `Cos`, `Tan`, `Atan2`, `Pow`, `Exp`** (and the `MathF` versions) come from each OS's C library and can differ\n    in the last bit between Windows, Linux and macOS. `Sqrt` and `+ - * \u002F` are exact everywhere.\n  - **Text**: `float.Parse(\"0.5\")` returns 5 on a German system and throws on a French one, inside Godot too. Use\n    `CultureInfo.InvariantCulture` everywhere, or never let numbers pass through text.\n- Per process: `HashCode.Combine` and `string.GetHashCode()` change every run. Never hash or sort by them in the\n  simulation.\n- `Dictionary` and `HashSet` order depends on the history of adds and removes. Iterate a sorted list of ids.\n- `System.Random(seed)` repeated across runs, but Microsoft does not promise it across .NET versions, and its state\n  cannot be saved, which rules out rollback. Use a generator whose state lives in the simulation state:\n  The C# example's `DeterministicRandom` (xorshift64*, `State` is a `ulong`) or Godot's `RandomNumberGenerator` (`Seed`, `State`).\n- Never in the simulation: `DateTime.Now`, `Time.GetTicksMsec()`, `GD.Randf()`, `GD.Randi()`, `delta` from `_Process`,\n  static mutable fields, threads and `Parallel` (their order varies), `async` continuations.\n- Nor engine completion signals: `AudioStreamPlayer.Finished`, `AnimationPlayer.AnimationFinished`, `Tween.Finished`.\n  A one-second sound finished on physics tick 56 to 62 over 20 real-time runs, and never within 200,000 ticks under\n  `--fixed-fps 60` (audio follows the wall clock); the animation on tick 60 or 61. Store the length in ticks, count it\n  down in `Step`, and fire your own event at zero.\n- One random stream for the simulation (in its state), and separate ones for ambient audio and effects, outside it:\n  more sparks or a new ambient sound then leave old replays playing (`CosmeticRandomDrawsDoNotChangeTheReplay`).\n- Every call to the simulation's generator advances it, even for a range of one value. Spelunky 2's returned the\n  minimum without drawing when max \u003C= min: an online desync QA could not reproduce for a month, found in six hours from\n  a player's replay (`ARangeOfOneValueStillAdvancesTheGenerator`).\n\n## 3. Godot's physics\n\n- GodotPhysics and Jolt repeated exactly on one machine, also across 4.6.1 and 4.7.2, mono and standard builds, and with\n  a separate physics thread.\n- Adding the same bodies in a different order changed the result in both engines. In GodotPhysics one unrelated body far\n  away also changed it; Jolt was unaffected.\n- Godot builds Jolt without its cross-platform determinism option, and nothing promises GodotPhysics across machines.\n- Godot has no API to save and restore physics state (contacts, sleep, solver caches), so setting positions and\n  velocities back does not repeat a step: neither engine can roll back.\n- So: gameplay that must be deterministic runs in your own C# (integer positions, circles and boxes, a fixed tick), and\n  Godot draws it; Godot physics only for effects that do not matter (debris, ragdolls). Spawn in a fixed order.\n\n## 4. Integers and fixed-point\n\n- Integers are exact on every platform and as fast as floats. The C# example's determinism tests use positions and\n  velocities in thousandths of a pixel.\n- `(long)Math.Sqrt((double)x)` is exact for `x` below 2^52, so integer distance checks stay deterministic; better,\n  compare squared distances.\n- Fixed-point libraries: FixedMathSharp (MIT, .NET 8, Q32.32, vectors and quaternions) or FixedMath.NET (Apache-2.0,\n  unmaintained since 2021). Measured cost: arithmetic is 3 to 6 times float, `Sqrt` and `Sin` about 50 to 60 times, a\n  whole physics-like step 60 to 74 times. Avoid square roots and trigonometry per unit per tick: use squared distances,\n  lookup tables and integer angles (0 to 65535).\n- Convert tunables to fixed-point once at load, from invariant-culture text.\n\n## 5. The toolkit (Example.Core, `Determinism\u002FReplay.cs`)\n\n```csharp\npublic interface IDeterministic\u003CTState, TInput>\n{\n    TState Save();            \u002F\u002F a full copy: everything Step reads or writes, the random state included\n    void Load(TState state);\n    void Step(TInput input);  \u002F\u002F one fixed tick\n    ulong Checksum();         \u002F\u002F over sorted state, float bits not strings\n}\n\nvar replay = DeterminismCheck.Record(sim, inputs, interval: 60);      \u002F\u002F a checksum every 60 ticks\nDivergence? d = DeterminismCheck.Verify(sim, replay);                  \u002F\u002F null, or the first tick that differs\nDivergence? s = DeterminismCheck.SyncTest(sim, inputs, depth: 7);      \u002F\u002F GGPO's test: every tick, re-run the last 7 and compare\nulong h = DeterminismCheck.Fnv1a(DeterminismCheck.Fnv1a(14695981039346656037, x), y);   \u002F\u002F stable across processes\n```\n\n- A replay holds the seed, the inputs and checkpoints; ship the build id and a digest of the game data with it, or an\n  old replay against new balance numbers diverges. Add the list of mods (or its digest) to replays and to the session\n  handshake: mods caused two of Spelunky 2's first three long hard-desync hunts.\n- Record every session, always (Retro City Rampage): `InputLog` (`Determinism\u002FInputLog.cs`) keeps a header, one\n  run-length stream per button and per axis and a checksum byte, under zlib. Ten busy minutes took 9,651 bytes (25,139 as\n  raw frames under the same zlib), small enough to attach to a bug report or a leaderboard entry.\n\n```csharp\nvar log = new InputLog(new InputLogHeader(seed, buildId, Rules: 3, Options: \"scheme=b\", ChecksumInterval: 60));\nlog.Record(sim, frame);                  \u002F\u002F every tick: steps the sim with the quantised InputFrame and keeps it\nlog.Save(path);                          \u002F\u002F on quit and from your Logger's _LogError: write to a temp file, then move\nDivergence? d = InputLog.Load(path).Play(sim, toTick: n);   \u002F\u002F null, or the first tick whose checksum byte differs\n```\n\n- Build the `InputFrame` after reading the devices and before the game uses it, quantised; record and playback go\n  through the same `Record` and `Play`, so they cannot drift apart.\n- Save on `NotificationWMCloseRequest` and from a `Logger` (`game-telemetry`'s `ErrorCapture`): C# exceptions in\n  callbacks never reach `AppDomain.UnhandledException`. A `Logger` runs on the failing thread, so globalize\n  `user:\u002F\u002Freplays\u002Flast.replay` once at start; `InputLog` locks, so saving from there is safe.\n- A checksum byte every tick in development finds the very tick of a desync; every 60 ticks in a shipped build (a\n  byte a tick is 36 KB per ten minutes, and does not compress).\n- When a fix changes gameplay, bump `Rules` and keep the old branch (`if (rules \u003C 3) ...`), so recorded logs keep\n  playing (`AnOldLogPlaysUnderTheRulesItWasRecordedWith`); still refuse one whose data digest differs.\n- Record even when the game is not fully deterministic yet: a log that reproduces a bug half the time beats a tester\n  replaying an hour by hand.\n- On a desync, both sides dump the state at the first bad tick as sorted text and diff it; it is usually one variable\n  (Factorio's workflow).\n- For rollback, record the remote inputs with the tick each arrived on: the match then replays on one machine with the\n  same rollbacks, as often as needed, with more logging each time (NetherRealm's desync workflow, under 0.1% desyncs).\n- `depth` is the rollback window. Depth 1 misses state that goes stale over several ticks: a value refreshed every few\n  ticks into a field `Save()` leaves out (gameplay reading a pose or joint position back from animation) re-runs the\n  same for one tick and differently across a refresh. `RollbackTests` plants exactly that; depth 7 finds it.\n- Rollback libraries: Backdash (MIT, GGPO-style, has a SyncTest session); its 0.8 preview needs .NET 10, so pin 0.3.x\n  on .NET 8.\n\n## 6. Tests to run in CI\n\n- [ ] a pinned checksum: a fixed seed and input log for 1000 ticks gives a committed value, updated in the same commit as\n      an intended change (as `TheRandomSequenceIsFixedForever` pins the generator)\n- [ ] `DeterminismCheck.SyncTest` over a recorded session, at depth 1 and at the rollback window: catches state kept\n      outside `Save()`\n- [ ] the same replay in two processes (catches per-process hashes and statics); `TheChecksumIgnoresTheProcess`\n- [ ] the replay test again with `LANG=de_DE.UTF-8` and with `DOTNET_EnableAVX2=0`\n- [ ] if machines must agree: the replay checksum printed on windows-latest, ubuntu-latest and macos-latest (Arm64) and\n      compared across the jobs\n- [ ] a code review of the simulation folder for the \"never\" list in section 2\n- [ ] an `InputLog` saved, loaded and played to the end and to a middle tick gives the live checksums\n      (`SkipToFrameReachesTheSameChecksum`); one recorded on the previous release still plays\n\n## 7. Time rewind\n\nBraid's rules (`${CLAUDE_PLUGIN_ROOT}\u002Fdocs\u002Fgdc\u002Frewind-in-braid.md`), built as the C# example's `RewindLog` (`Determinism\u002FRewind.cs`):\n\n- Record the state, every frame, always. Input replays break across builds; reversible simulation doubles the\n  gameplay code and cannot jump 10,000 frames back; dropped or interpolated frames are inexact, and in a puzzle game an\n  inexact rewind is an exploit.\n- Keep out what never changes (collision, decoration: one copy for all frames) and what can be recomputed: cosmetic\n  particles as a closed-form function of seed, parameters and time.\n- A keyframe every 120 frames stores each entity's fields that differ from a default-constructed one; other frames store\n  the fields that differ from their keyframe, as absolute values, never deltas, so nothing accumulates. A seek decodes\n  the keyframe and the target frame: two frames, wherever it lands. An entity born after a keyframe is stored once in\n  that keyframe's birth list; a dead one simply is not in the target frame.\n- Forget in chunks of whole keyframe intervals (Braid: 24 s), oldest first, so the oldest frame kept is a keyframe.\n  Braid gave rewind 40 MB of the Xbox 360's 512 MB: 30 to 60 minutes on most levels, with no entropy coding.\n- Sounds are entities in the state; an audio layer starts and stops streams to match them each frame. End a sound on\n  the game clock (its length plus about 10%), never on an audio-hardware callback, or a replayed stretch differs.\n- Compare floats by their bits (`RewindLog.FloatBits`): `-0f == 0f`, and a missed change is a wrong rewind.\n\nThe log owns the state; nodes only draw it, and the simulation resumes from the decoded frame:\n\n```csharp\npublic override void _PhysicsProcess(double delta)          \u002F\u002F a fixed 60 Hz tick\n{\n    if (Input.IsActionPressed(\"rewind\"))\n    {\n        if (_frame > _log.FirstFrame) Present(_log.Seek(--_frame));\n        _rewound = true;\n        return;                                              \u002F\u002F the simulation does not step while rewinding\n    }\n    if (_rewound) { _world.Load(_log.Seek(_frame)); _rewound = false; }\n    _world.Step(ReadInput());\n    _log.Record(++_frame, _world.Entities());                \u002F\u002F a frame already held drops the old future\n    Present(_world.Entities());\n}\n\nvoid Present(IReadOnlyList\u003CRewindEntity> state)   \u002F\u002F not \"Draw\": CanvasItem has a Draw signal\n{\n    var alive = state.Select(e => e.Id).ToHashSet();\n    foreach (int id in _nodes.Keys.Where(id => !alive.Contains(id)).ToList()) { _nodes[id].QueueFree(); _nodes.Remove(id); }\n    foreach (var e in state)\n    {\n        if (!_nodes.TryGetValue(e.Id, out var node)) AddChild(_nodes[e.Id] = node = Spawn(e));\n        node.Position = new Vector2(RewindLog.FromBits(e.Fields[X]), RewindLog.FromBits(e.Fields[Y]));\n    }\n}\n```\n","# Deterministic simulation in Godot 4 (C#)\n\nA simulation is deterministic when the same start state and the same inputs give the same state, bit for bit. Replays,\nrollback and lockstep netcode, replay-checked leaderboards and \"send me your replay\" bug reports all depend on it. It\nbreaks quietly, so test it in CI from the first day. Every figure here was measured on Godot 4.7.2 and .NET 8 (x64);\nsources: `${CLAUDE_PLUGIN_ROOT}\u002Fdocs\u002Fdeterminism.md`.\n\n## 1. How far it must reach\n\n| Need | Must match | Floats acceptable? |\n|---|---|---|\n| Replays, bug repro, tests | The same build on the same machine | Yes |\n| Rollback between identical clients | The same build and platform | Yes, with the traps below avoided |\n| Lockstep or replay checks across PCs, Macs, phones | Every platform | Integers or fixed-point; floats are unproven in .NET |\n\n## 2. What .NET actually does (measured)\n\n- Scalar `float` and `double` code gave identical bits in Debug and Release, with tiered compilation, PGO, quick JIT,\n  FMA, AVX2, AVX-512 and all hardware intrinsics on or off. The JIT does not fuse `a*b+c` into one FMA, on x64 (tested)\n  or Arm64 (dotnet\u002Fruntime #64591).\n- Across machines, three things change results:\n  - **`Vector\u003CT>` and SIMD reductions**: its width is 8 floats with AVX2 and 4 without, so a sum differs. Any change in\n    summation order does (`Parallel.For`, a different loop shape).\n- List the simulation folders in `architecture.json` (`\"simulation\": [\"sim\"]`) and the `architecture` runner's\n  `nondeterministic-sim` rule flags the calls below there (set it to `error` for lockstep or rollback).\n  - **`Math.Sin`, `Cos`, `Tan`, `Atan2`, `Pow`, `Exp`** (and the `MathF` versions) come from each OS's C library and can differ\n    in the last bit between Windows, Linux and macOS. `Sqrt` and `+ - * \u002F` are exact everywhere.\n  - **Text**: `float.Parse(\"0.5\")` returns 5 on a German system and throws on a French one, inside Godot too. Use\n    `CultureInfo.InvariantCulture` everywhere, or never let numbers pass through text.\n- Per process: `HashCode.Combine` and `string.GetHashCode()` change every run. Never hash or sort by them in the\n  simulation.\n- `Dictionary` and `HashSet` order depends on the history of adds and removes. Iterate a sorted list of ids.\n- `System.Random(seed)` repeated across runs, but Microsoft does not promise it across .NET versions, and its state\n  cannot be saved, which rules out rollback. Use a generator whose state lives in the simulation state:\n  The C# example's `DeterministicRandom` (xorshift64*, `State` is a `ulong`) or Godot's `RandomNumberGenerator` (`Seed`, `State`).\n- Never in the simulation: `DateTime.Now`, `Time.GetTicksMsec()`, `GD.Randf()`, `GD.Randi()`, `delta` from `_Process`,\n  static mutable fields, threads and `Parallel` (their order varies), `async` continuations.\n- Nor engine completion signals: `AudioStreamPlayer.Finished`, `AnimationPlayer.AnimationFinished`, `Tween.Finished`.\n  A one-second sound finished on physics tick 56 to 62 over 20 real-time runs, and never within 200,000 ticks under\n  `--fixed-fps 60` (audio follows the wall clock); the animation on tick 60 or 61. Store the length in ticks, count it\n  down in `Step`, and fire your own event at zero.\n- One random stream for the simulation (in its state), and separate ones for ambient audio and effects, outside it:\n  more sparks or a new ambient sound then leave old replays playing (`CosmeticRandomDrawsDoNotChangeTheReplay`).\n- Every call to the simulation's generator advances it, even for a range of one value. Spelunky 2's returned the\n  minimum without drawing when max \u003C= min: an online desync QA could not reproduce for a month, found in six hours from\n  a player's replay (`ARangeOfOneValueStillAdvancesTheGenerator`).\n\n## 3. Godot's physics\n\n- GodotPhysics and Jolt repeated exactly on one machine, also across 4.6.1 and 4.7.2, mono and standard builds, and with\n  a separate physics thread.\n- Adding the same bodies in a different order changed the result in both engines. In GodotPhysics one unrelated body far\n  away also changed it; Jolt was unaffected.\n- Godot builds Jolt without its cross-platform determinism option, and nothing promises GodotPhysics across machines.\n- Godot has no API to save and restore physics state (contacts, sleep, solver caches), so setting positions and\n  velocities back does not repeat a step: neither engine can roll back.\n- So: gameplay that must be deterministic runs in your own C# (integer positions, circles and boxes, a fixed tick), and\n  Godot draws it; Godot physics only for effects that do not matter (debris, ragdolls). Spawn in a fixed order.\n\n## 4. Integers and fixed-point\n\n- Integers are exact on every platform and as fast as floats. The C# example's determinism tests use positions and\n  velocities in thousandths of a pixel.\n- `(long)Math.Sqrt((double)x)` is exact for `x` below 2^52, so integer distance checks stay deterministic; better,\n  compare squared distances.\n- Fixed-point libraries: FixedMathSharp (MIT, .NET 8, Q32.32, vectors and quaternions) or FixedMath.NET (Apache-2.0,\n  unmaintained since 2021). Measured cost: arithmetic is 3 to 6 times float, `Sqrt` and `Sin` about 50 to 60 times, a\n  whole physics-like step 60 to 74 times. Avoid square roots and trigonometry per unit per tick: use squared distances,\n  lookup tables and integer angles (0 to 65535).\n- Convert tunables to fixed-point once at load, from invariant-culture text.\n\n## 5. The toolkit (Example.Core, `Determinism\u002FReplay.cs`)\n\n```csharp\npublic interface IDeterministic\u003CTState, TInput>\n{\n    TState Save();            \u002F\u002F a full copy: everything Step reads or writes, the random state included\n    void Load(TState state);\n    void Step(TInput input);  \u002F\u002F one fixed tick\n    ulong Checksum();         \u002F\u002F over sorted state, float bits not strings\n}\n\nvar replay = DeterminismCheck.Record(sim, inputs, interval: 60);      \u002F\u002F a checksum every 60 ticks\nDivergence? d = DeterminismCheck.Verify(sim, replay);                  \u002F\u002F null, or the first tick that differs\nDivergence? s = DeterminismCheck.SyncTest(sim, inputs, depth: 7);      \u002F\u002F GGPO's test: every tick, re-run the last 7 and compare\nulong h = DeterminismCheck.Fnv1a(DeterminismCheck.Fnv1a(14695981039346656037, x), y);   \u002F\u002F stable across processes\n```\n\n- A replay holds the seed, the inputs and checkpoints; ship the build id and a digest of the game data with it, or an\n  old replay against new balance numbers diverges. Add the list of mods (or its digest) to replays and to the session\n  handshake: mods caused two of Spelunky 2's first three long hard-desync hunts.\n- Record every session, always (Retro City Rampage): `InputLog` (`Determinism\u002FInputLog.cs`) keeps a header, one\n  run-length stream per button and per axis and a checksum byte, under zlib. Ten busy minutes took 9,651 bytes (25,139 as\n  raw frames under the same zlib), small enough to attach to a bug report or a leaderboard entry.\n\n```csharp\nvar log = new InputLog(new InputLogHeader(seed, buildId, Rules: 3, Options: \"scheme=b\", ChecksumInterval: 60));\nlog.Record(sim, frame);                  \u002F\u002F every tick: steps the sim with the quantised InputFrame and keeps it\nlog.Save(path);                          \u002F\u002F on quit and from your Logger's _LogError: write to a temp file, then move\nDivergence? d = InputLog.Load(path).Play(sim, toTick: n);   \u002F\u002F null, or the first tick whose checksum byte differs\n```\n\n- Build the `InputFrame` after reading the devices and before the game uses it, quantised; record and playback go\n  through the same `Record` and `Play`, so they cannot drift apart.\n- Save on `NotificationWMCloseRequest` and from a `Logger` (`game-telemetry`'s `ErrorCapture`): C# exceptions in\n  callbacks never reach `AppDomain.UnhandledException`. A `Logger` runs on the failing thread, so globalize\n  `user:\u002F\u002Freplays\u002Flast.replay` once at start; `InputLog` locks, so saving from there is safe.\n- A checksum byte every tick in development finds the very tick of a desync; every 60 ticks in a shipped build (a\n  byte a tick is 36 KB per ten minutes, and does not compress).\n- When a fix changes gameplay, bump `Rules` and keep the old branch (`if (rules \u003C 3) ...`), so recorded logs keep\n  playing (`AnOldLogPlaysUnderTheRulesItWasRecordedWith`); still refuse one whose data digest differs.\n- Record even when the game is not fully deterministic yet: a log that reproduces a bug half the time beats a tester\n  replaying an hour by hand.\n- On a desync, both sides dump the state at the first bad tick as sorted text and diff it; it is usually one variable\n  (Factorio's workflow).\n- For rollback, record the remote inputs with the tick each arrived on: the match then replays on one machine with the\n  same rollbacks, as often as needed, with more logging each time (NetherRealm's desync workflow, under 0.1% desyncs).\n- `depth` is the rollback window. Depth 1 misses state that goes stale over several ticks: a value refreshed every few\n  ticks into a field `Save()` leaves out (gameplay reading a pose or joint position back from animation) re-runs the\n  same for one tick and differently across a refresh. `RollbackTests` plants exactly that; depth 7 finds it.\n- Rollback libraries: Backdash (MIT, GGPO-style, has a SyncTest session); its 0.8 preview needs .NET 10, so pin 0.3.x\n  on .NET 8.\n\n## 6. Tests to run in CI\n\n- [ ] a pinned checksum: a fixed seed and input log for 1000 ticks gives a committed value, updated in the same commit as\n      an intended change (as `TheRandomSequenceIsFixedForever` pins the generator)\n- [ ] `DeterminismCheck.SyncTest` over a recorded session, at depth 1 and at the rollback window: catches state kept\n      outside `Save()`\n- [ ] the same replay in two processes (catches per-process hashes and statics); `TheChecksumIgnoresTheProcess`\n- [ ] the replay test again with `LANG=de_DE.UTF-8` and with `DOTNET_EnableAVX2=0`\n- [ ] if machines must agree: the replay checksum printed on windows-latest, ubuntu-latest and macos-latest (Arm64) and\n      compared across the jobs\n- [ ] a code review of the simulation folder for the \"never\" list in section 2\n- [ ] an `InputLog` saved, loaded and played to the end and to a middle tick gives the live checksums\n      (`SkipToFrameReachesTheSameChecksum`); one recorded on the previous release still plays\n\n## 7. Time rewind\n\nBraid's rules (`${CLAUDE_PLUGIN_ROOT}\u002Fdocs\u002Fgdc\u002Frewind-in-braid.md`), built as the C# example's `RewindLog` (`Determinism\u002FRewind.cs`):\n\n- Record the state, every frame, always. Input replays break across builds; reversible simulation doubles the\n  gameplay code and cannot jump 10,000 frames back; dropped or interpolated frames are inexact, and in a puzzle game an\n  inexact rewind is an exploit.\n- Keep out what never changes (collision, decoration: one copy for all frames) and what can be recomputed: cosmetic\n  particles as a closed-form function of seed, parameters and time.\n- A keyframe every 120 frames stores each entity's fields that differ from a default-constructed one; other frames store\n  the fields that differ from their keyframe, as absolute values, never deltas, so nothing accumulates. A seek decodes\n  the keyframe and the target frame: two frames, wherever it lands. An entity born after a keyframe is stored once in\n  that keyframe's birth list; a dead one simply is not in the target frame.\n- Forget in chunks of whole keyframe intervals (Braid: 24 s), oldest first, so the oldest frame kept is a keyframe.\n  Braid gave rewind 40 MB of the Xbox 360's 512 MB: 30 to 60 minutes on most levels, with no entropy coding.\n- Sounds are entities in the state; an audio layer starts and stops streams to match them each frame. End a sound on\n  the game clock (its length plus about 10%), never on an audio-hardware callback, or a replayed stretch differs.\n- Compare floats by their bits (`RewindLog.FloatBits`): `-0f == 0f`, and a missed change is a wrong rewind.\n\nThe log owns the state; nodes only draw it, and the simulation resumes from the decoded frame:\n\n```csharp\npublic override void _PhysicsProcess(double delta)          \u002F\u002F a fixed 60 Hz tick\n{\n    if (Input.IsActionPressed(\"rewind\"))\n    {\n        if (_frame > _log.FirstFrame) Present(_log.Seek(--_frame));\n        _rewound = true;\n        return;                                              \u002F\u002F the simulation does not step while rewinding\n    }\n    if (_rewound) { _world.Load(_log.Seek(_frame)); _rewound = false; }\n    _world.Step(ReadInput());\n    _log.Record(++_frame, _world.Entities());                \u002F\u002F a frame already held drops the old future\n    Present(_world.Entities());\n}\n\nvoid Present(IReadOnlyList\u003CRewindEntity> state)   \u002F\u002F not \"Draw\": CanvasItem has a Draw signal\n{\n    var alive = state.Select(e => e.Id).ToHashSet();\n    foreach (int id in _nodes.Keys.Where(id => !alive.Contains(id)).ToList()) { _nodes[id].QueueFree(); _nodes.Remove(id); }\n    foreach (var e in state)\n    {\n        if (!_nodes.TryGetValue(e.Id, out var node)) AddChild(_nodes[e.Id] = node = Spawn(e));\n        node.Position = new Vector2(RewindLog.FromBits(e.Fields[X]), RewindLog.FromBits(e.Fields[Y]));\n    }\n}\n```\n",{"name":5,"description":7},"main","5fa4c2262d814d50f72198a95b8c483ff195f90f",".agents\u002Fskills\u002Fdeterminism",0,"https:\u002F\u002Fgithub.com\u002Fnick-vas\u002Fhyperdot","https:\u002F\u002Fnick-vas.github.io\u002Fhyperdot\u002F","https:\u002F\u002Fgithub.com\u002Fnick-vas","https:\u002F\u002Fcommon-beef.itch.io\u002F","2026-11-13 18:55:29",{"source":8,"skillName":5,"commands":34,"prompt":44,"zipAvailable":45},[35,38,41],{"tool":36,"command":37},"npx","npx skills add nick-vas\u002Fhyperdot --skill determinism",{"tool":39,"command":40},"bunx","bunx skills add nick-vas\u002Fhyperdot --skill determinism",{"tool":42,"command":43},"pnpm","pnpm dlx skills add nick-vas\u002Fhyperdot --skill determinism","安装技能，技能地址：https:\u002F\u002Fgithub.com\u002Fnick-vas\u002Fhyperdot\u002Fblob\u002Fmain\u002F.agents\u002Fskills\u002Fdeterminism\u002FSKILL.md",true,[],[48,55,61,68,75,82],{"skillNo":49,"name":50,"nameZh":6,"description":51,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":52,"categories":53,"keywords":54,"publishedAt":19},"01M7E6RF2S03S92PB9RZB4S4W0","over-budget","Use when a fixture exceeds the size budget.","https:\u002F\u002Fgithub.com\u002Fnick-vas\u002Fhyperdot\u002Fblob\u002Fmain\u002Ftests\u002Fskill-fixtures\u002Fover-budget\u002FSKILL.md",[],[],{"skillNo":56,"name":57,"nameZh":6,"description":6,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":58,"categories":59,"keywords":60,"publishedAt":19},"01M7E6RBY8SDNMA3ZARE8MAH0G","bad-yaml","https:\u002F\u002Fgithub.com\u002Fnick-vas\u002Fhyperdot\u002Fblob\u002Fmain\u002Ftests\u002Fskill-fixtures\u002Fbad-yaml\u002FSKILL.md",[],[],{"skillNo":62,"name":63,"nameZh":6,"description":64,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":65,"categories":66,"keywords":67,"publishedAt":19},"01M7E6R9S9YHTC552SR41RQAJ1","bad-workflow-description","Use when testing; runs the kit and then reads the JSON.","https:\u002F\u002Fgithub.com\u002Fnick-vas\u002Fhyperdot\u002Fblob\u002Fmain\u002Ftests\u002Fskill-fixtures\u002Fbad-workflow-description\u002FSKILL.md",[],[],{"skillNo":69,"name":70,"nameZh":6,"description":71,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":72,"categories":73,"keywords":74,"publishedAt":19},"01M7E6R6CWSAN48C80130CM1AK","bad-version","Use when a fixture quotes a stale package version.","https:\u002F\u002Fgithub.com\u002Fnick-vas\u002Fhyperdot\u002Fblob\u002Fmain\u002Ftests\u002Fskill-fixtures\u002Fbad-version\u002FSKILL.md",[],[],{"skillNo":76,"name":77,"nameZh":6,"description":78,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":79,"categories":80,"keywords":81,"publishedAt":19},"01M7E6R2C0E24TC133ESHKZT9R","bad-value","Use when a fixture passes a value outside a parameter's set.","https:\u002F\u002Fgithub.com\u002Fnick-vas\u002Fhyperdot\u002Fblob\u002Fmain\u002Ftests\u002Fskill-fixtures\u002Fbad-value\u002FSKILL.md",[],[],{"skillNo":83,"name":84,"nameZh":6,"description":85,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":86,"categories":87,"keywords":88,"publishedAt":19},"01M7E6QYM81V061X7DSQ94CZRP","bad-trigger","Helps with Godot tests.","https:\u002F\u002Fgithub.com\u002Fnick-vas\u002Fhyperdot\u002Fblob\u002Fmain\u002Ftests\u002Fskill-fixtures\u002Fbad-trigger\u002FSKILL.md",[],[]]