Replay with seeds¶
To reproduce a game sequence, keep its starting state and the ordered list of moves and payloads. Run those moves again with the same randomness inputs. HyperToken records successful dispatches in the Engine's in-memory history and provides seeded randomness through mulberry32 and shuffleArray. A seeded shuffle reproduces the order only if the input order is also the same.
If a handler also depends on generated IDs, time, or outside input, record or control those values as well. Include agent decisions in your recording. Remote document changes are not part of the local dispatch log, and network arrival order can change results. Save your own action log if you need to replay it later.
Undo, saving, and compaction are different from replay. Local undo uses checkpoints every 50 actions, with at most five retained. It restores an available checkpoint, not the exact state before each move, and is disabled while networking or sync is attached. persist() and resume() save and restore the game document, not the action log. compact() retains current state while discarding prior Automerge history.