Expand description
Replay system: input recording, deterministic playback, scrubbing, ghost.
§Architecture
InputRecorder— captures every input event with frame-accurate timestampsReplayFile— compact binary format: header + seed + input streamReplayPlayer— plays back a replay at configurable speedReplayScrubber— seeks to arbitrary points via state snapshotsGhostReplay— semi-transparent replay alongside live playReplayExporter— serialize replay to bytes / upload URLReplayVerifier— checksum validation against stored hash
§Determinism contract
The game must use only the provided RNG seed and recorded inputs. Any external randomness (system time, thread ID, etc.) breaks determinism.
§File format (little-endian binary)
Header (128 bytes):
magic: [u8; 4] = b"PRFE"
version: u16
flags: u16
seed: u64
frame_count: u32
duration_ms: u32
score: i64
checksum: [u8; 32] (SHA-256 of seed + input stream)
metadata: [u8; 64] (null-padded JSON: class, floor, build)
Input stream:
for each event:
frame: u32
kind: u8
payload: [u8; 8]Re-exports§
pub use rollback::RollbackSession;pub use rollback::PlayerInput;pub use rollback::FrameInput;pub use rollback::GameState;pub use rollback::NetworkStats;
Modules§
- rollback
- Rollback networking support — deterministic state snapshots, input prediction, and reconciliation for peer-to-peer fighting/action games.
Structs§
- Ghost
Replay - Plays a replay alongside live gameplay, representing a “ghost” opponent.
- Input
Event - A single recorded input event.
- Input
Recorder - Records inputs during gameplay.
- Replay
File - A complete recorded replay.
- Replay
Metadata - Replay
Player - Plays back a ReplayFile, emitting input events frame by frame.
- Replay
Snapshot - Replay
Verifier - Validates a replay file’s integrity.
Enums§
- Input
Kind - Compressed input event kind byte.
- Playback
State - Verify
Result