Implement Replay Recording and Playback Engine#54
Open
mac-dubem wants to merge 1 commit into
Open
Conversation
- Add replay module at src/replay/mod.rs with ReplayEvent enum (HintReveal, AnswerAttempt, SessionStart, SessionEnd) - Events recorded with microsecond timestamps relative to session start - Completed replays serialized to .qreplay binary file via bincode - --playback <file> CLI flag loads and replays .qreplay files - --speed 1|2|4 flag controls playback speed (default 1x) - Replay files include puzzle content hash for integrity cross-check - Replay summary (total time, hints, attempts, score) printed at end - 10 unit tests covering recording, serialization, playback, integrity Closes MindFlowInteractive#47
Contributor
|
@mac-dubem please resolve conflict |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Build a replay system that records every player action during a session as a timestamped event log and supports deterministic playback of that log. Replays let players review their own solutions, serve as proof-of-solve for on-chain achievement verification, and provide debugging data for the puzzle design team. Replay files are compact, portable, and verifiable.
Changes
src/replay/mod.rs— New replay module with:ReplayEventenum:SessionStart,SessionEnd,HintReveal,AnswerAttempt { answer }ReplaySessionstruct for recording, saving (.qreplaybinary via bincode), loading, and playbacksrc/main.rs— Added--playback <file>and--speed <1|2|4>CLI flagsCargo.toml— Addedbincodedependency for binary serializationsrc/lib.rs— Registeredpub mod replayTests
10 unit tests covering:
bincodeserialization roundtrip.qreplayfilesAll 175 tests pass (the 1 pre-existing failure in
leaderboard::tests::replacement_when_fullis unrelated).Closes #47