Conceptually, how does replay work in a game?
stackoverflow.com
Conceptually, how does replay work in a game?
1–10 of 15 posts
Re: Conceptually, how does replay work in a game?
#2One of my games allowed people to save replays and levels to the web. The online infrastructure, creation of the editor and debugging of replays dwarfed the time taken to create the game in the first place, making the game take over 4x as long as it otherwise would have. (Note the levels and replays list is only from the last day, never got around to doing an all time best.)
Re: Conceptually, how does replay work in a game?
#3The same way macros and undo functions work.
Re: Conceptually, how does replay work in a game?
#4Starcraft 2 introduced replay rewinding which I think is even more interesting.
I guess that it loads a replay at the time you're watching it simply by replaying the game with the help of actions and at the same time it stores states of the game and then if you rewind (you can't continuously rewind like a VCR, you pick a state in the past and you go on from there) it loads that state.
It sounds so easy when you write it like this but I'm sure it's a lot harder than it sounds.
Re: Conceptually, how does replay work in a game?
#5Re: Conceptually, how does replay work in a game?
#6Having worked in both games and the desktop world, implementing replays is a lot like implementing undo/redo, and they're both an immense time-suck. It's easy for developers on the different sub-systems to create something that on the surface seems complete but is doing a bad job of recording and responding to the needed events. Inevitably either the original developer or the poor sucker tasked with implementing undo…
Luckily, determinism is something that you can verify with an automated process. After each checkin, run some automated tests on a server farm. Run them twice. During the first run, take a full game world state snapshot periodically. During the second run, verify that the world state is identical since the first run. If it isn't, re-run the test twice. Take snapshots more frequently during the interval where determinism broke. Recurse like a binary search. You can automatically pin-point the exact frame where the simulations diverge.
One you have a replay file and the exact frame, you have the best bug report on the planet. "This replay is build 12345 and crashes on frame 54321". Fire it up in the debugger, run a system command "fast forward to frame 54321" and then just start stepping. Oh, it crashes on that line? Let's drill into that: restart replay, set breakpoint, run to frame 54321, step-in. Freaking beautiful.
Re: Conceptually, how does replay work in a game?
#7IIRC, the Starcraft 2 beta keeps old versions of the game engine around to let you play back older replays.
A similar technique is occasionally used in non-server-based multiplayer games - here's a Gamasutra post-mortem for _X-Wing vs. TIE Fighter_ where sending inputs across machines is discussed: http://www.gamasutra.com/view/feature/3374/the_internet_suck...
Re: Conceptually, how does replay work in a game?
#8This method of storing replays frequently leads to brokenness when the game logic updates due to patches. IL2: Sturmovik had replays like this and if you ran an old replay on a newer version, the replay planes would end up running off the runway or similar. IIRC, the Starcraft 2 beta keeps old versions of the game engine around to let you play back older replays. A similar technique is occasionally used in non-server…
Early on, Supreme Commander was great at putting out balance changes and hotfixes. Unfortunately, every single patch would completely empty the online database and would also break any replays you stored on your computer! People managed to hack together a version switcher eventually, but I still ended up losing lots of awesome replays.