• Advertisement
Sign in to follow this  

Rewind!

This topic is 3315 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

How do games like Halo 3 implement rewindable replays? I've searched Google but I can't find any technical information on it. Do the games constantly buffer game-states as the replay is played? Wouldn't that use a tremendous amount of space?

Share this post


Link to post
Share on other sites
Advertisement
Really, they just store non-deterministic information like user input, random number seeds, etc. They then re-run the game loop using that data to present the replay, buffering data samples so you can rewind. This is generally how it's done, and not a specific commentary on Halo or any other game.

Share this post


Link to post
Share on other sites
Sometimes they also store entire snapshots of everything periodically, for the same reason that video codecs have keyframes - it takes too long to start from the beginning if you only record the deltas.

This is usually only necessary for replays where you're allowed to rewind or skip time using a seek-bar. If you only allow for replay acceleration (2x, 4x, etc) you can get away without "keyframes".

Share this post


Link to post
Share on other sites
I would guess that what Halo 3 does is as you play the game, it records the locations of all the objects and all the actions occurring in the scene every frame, and it saves all of those frames in the order they occurred into a "film". When you want to re-play the "film", it would open a new scene and use the objects and locations from that "film" and update the scene as the frames progress. To rewind, rather then it going to currentFrame + 1 and updating the scene to that, it would go to currentFrame - 1 and update the scene to that information.

Just a guess though :P

Share this post


Link to post
Share on other sites
Quote:
Original post by Tenac
I would guess that what Halo 3 does is as you play the game, it records the locations of all the objects and all the actions occurring in the scene every frame, and it saves all of those frames in the order they occurred into a "film".

No point in re-recording properties that haven't changed.

Share this post


Link to post
Share on other sites
Everyone, thank you for your replies! :)

Oluseyi, I'm aware that many games store replies as a series of player-action/input, but I don't quite understand how the buffering part is done. It can't simply be snapshots because that wouldn't allow for smooth rewinding.

Share this post


Link to post
Share on other sites
Quote:
Original post by Oluseyi
Quote:
Original post by Tenac
I would guess that what Halo 3 does is as you play the game, it records the locations of all the objects and all the actions occurring in the scene every frame, and it saves all of those frames in the order they occurred into a "film".

No point in re-recording properties that haven't changed.

I would be sure they have a lot of built in optimizations where they could, but are you suggesting that they rather record the changes every frame rather than re-recording everything in the frame?

Share this post


Link to post
Share on other sites
Quote:
Original post by Tenac
I would be sure they have a lot of built in optimizations where they could, but are you suggesting that they rather record the changes every frame rather than re-recording everything in the frame?

No. I'm saying that if an object's properties haven't changed, don't record it at all. Playback mode can be trivially designed/instrumented to persist previous values, so unless they are explicitly overridden. But that's just for playback. To enable seamless rewind, you want to record data that can be smoothly interpolated, so that advance/retreat is just a variation in the interpolation factor (tween).

Quote:
Original post by iaminternets
Oluseyi, I'm aware that many games store replies as a series of player-action/input, but I don't quite understand how the buffering part is done. It can't simply be snapshots because that wouldn't allow for smooth rewinding.

Replay mode, which allows rewinding, is a dedicated mode - it's not a part of the normal play mode. During normal play, you just record user input and random seeds. On playback, you rerun all that data through the simulation and rendering engine, which will yield the exact same experience sans interaction.

During playback (or while rendering ahead for playback), record keyframe data to allow for easy interpolation backward and forward.

Share this post


Link to post
Share on other sites
could the program look like this?
(hehe i have no experience in 3d games so no hate if there is)



//pogram: game

loadStuff();

whileLoop()
{

draw();

input();

collisions();

//records all object positions for example a crate
//item crate#1:102,324,223,662,234,643, etc...;
//item crate#2:110,551,734,356,772,334, etc...;
// etc...;
recordPos();

}
//end of program 1


then for the theater



//program 2

loadRecordFile();
loadStuff();

//reads record file and sets values, makes objects,and objects positions
readRecordFile();

whileLoop()
{

//draw whatever was read from the file, into the loaded map
draw();

//theater input, including camera
input();

setNewValues();

}


setValues funtions sets the next position of every object, and if rewind is on it will set whatever value is behind the value it's on now, for example

#item crate#1:102,442,552,343,(from here) 123,422,533,443(to here), etc...;

then when it rewinds it goes to the last set of values

#item crate#1:(from here)102,442,552,343(to here) ,123,422,533,443, etc...;

the draw funtion in program #2 draws the map, and objects the readRecordFiles funtion set to



Share this post


Link to post
Share on other sites
Quote:
Original post by nuclearfission
could the program look like this?
(hehe i have no experience in 3d games so no hate if there is)...



You don't want to record positions every frame. This is too intensive. Once the random number generator is seeded, the only variable in a game is user input, therefore, the only thing you really need to record per-frame is user input or action (either or, same thing really). This can then be used to re-run the simulation.

You'd probably want to do a keyframe each time new things are loaded (i.e. reaching the next area). Keyframes would also help with debugging as it can allow you to see how far off (if at all) your interpolated frame at that time is from the keyframe (which would reflect the actual game state at that time when recording).

As for rewind, does Halo 3 even allow smooth rewinding? I play (or used to play) a lot of Halo and I only remember being able to rewind to specific key frames.

Share this post


Link to post
Share on other sites
The way computers work is very predictable. When provided with the same input they will always react in the same way (random numbers unaccounted for). The main thing that needs to be done is record the input from all users, when this input is saved and run back through the engine, the exact same series of events will unfold. As far as randomness goes, you can probably just record the seed used from the beginning of the gameplay session.

More:

Instant Replay: Building a Game Engine with Reproducible Behavior

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement