swarm-game / swarm

Resource gathering + programming game
Other
820 stars 51 forks source link

Recording and playback #1926

Open byorgey opened 3 weeks ago

byorgey commented 3 weeks ago

I was sad the other day when I did a mithril speedrun in 21:02 but it turned out the asciicast was too large to upload. Then today when thinking about benefits of determinism I realized that we could probably make a recording + playback feature without too much trouble.

The idea would be to record a sequence of input events (keypresses, mouse clicks, frame updates) with timestamps. Then we could play back a session by appropriately replaying the events and just simulating the game from scratch. Since the game is deterministic, replaying exactly the same events in the same sequence should yield the exact same results.

Probably this would be accomplished using command-line arguments like swarm -i some/scenario --record myspeedrun.sr to make a recording and swarm --replay myspeedrun.sr to replay. run introduces some difficulties, since the same files may not be available locally when playing back a recording. Perhaps this should wait until after we get #495 squared away.

kostmo commented 2 weeks ago

Being able to submit a replayable session to a central server for independent verification would mitigate most of the "cheating" concerns raised in #1797.

kostmo commented 2 weeks ago

1131 is a related suggestion