Handmade Hero»Forums»Code
27 posts
Looped Recording: Why Record All 64MB Every Frame?
Edited by mojobojo on
I watched Handmade Hero Day 023 - Looped Live Code Editing and had me wondering why you would record the game state every frame? If you were to just record the initial 64MB game state then just record input for the rest of the recording wouldn't you get the same result when you play it back?
David Owens II
69 posts
A software engineer that enjoys living in enemy territory.
Looped Recording: Why Record All 64MB Every Frame?
That's what I'm doing. I have a snapshot.mem file that contains the initial state, then an input.mem that I append the input struct to every frame.
Casey Muratori
801 posts / 1 project
Casey Muratori is a programmer at Molly Rocket on the game 1935 and is the host of the educational programming series Handmade Hero.
Looped Recording: Why Record All 64MB Every Frame?
Err, that's what the codebase already does? Not sure what you guys are saying here... when you start a looped live code edit, it writes the mem block, and then for the rest of the frames, it just writes the input. That's exactly how it currently works.

- Casey
David Owens II
69 posts
A software engineer that enjoys living in enemy territory.
Looped Recording: Why Record All 64MB Every Frame?
Maybe the OP is not calling your Win32RecordInput(&Win32State, NewInput) in the game loop?

@mojobojo

Look here:

1
2
3
4
5
6
7
8
9
                        if(Win32State.InputRecordingIndex)
                        {
                            Win32RecordInput(&Win32State, NewInput);
                        }

                        if(Win32State.InputPlayingIndex)
                        {
                            Win32PlayBackInput(&Win32State, NewInput);
                        }
27 posts
Looped Recording: Why Record All 64MB Every Frame?
Edited by mojobojo on
cmuratori
Err, that's what the codebase already does? Not sure what you guys are saying here... when you start a looped live code edit, it writes the mem block, and then for the rest of the frames, it just writes the input. That's exactly how it currently works.

- Casey


I looked back at the video and it was just me misunderstanding what happened in the stream. When I saw that big file I thought it was because it was the entire state recorded every frame. I was unaware recording just the input was going to make a large file that quickly.
Casey Muratori
801 posts / 1 project
Casey Muratori is a programmer at Molly Rocket on the game 1935 and is the host of the educational programming series Handmade Hero.
Looped Recording: Why Record All 64MB Every Frame?
The file is large because it is actually saving all the memory that is allocated, not just the 64 megabytes. It has nothing to do with the input, the input is tiny.

- Casey
David Owens II
69 posts
A software engineer that enjoys living in enemy territory.
Looped Recording: Why Record All 64MB Every Frame?
Yeah, my input is 440bytes per frame. I haven't looked to see how big Casey's version is. But even after a few seconds of input recording, the input portion is still well below 100Kb.
27 posts
Looped Recording: Why Record All 64MB Every Frame?
cmuratori
The file is large because it is actually saving all the memory that is allocated, not just the 64 megabytes. It has nothing to do with the input, the input is tiny.

- Casey


I completely missed that, thank you for clearing that up.