Hey guys,
So i’m making a little game which will support a basic replay system. My plan is to basically save each frame of input into a file and then read it back when replaying the game.
This has a problem though in that if i save the input each frame then the file would become humongous if the user plays the game at 300fps or whatever.
I’ve looked into polling for input in FixedUpdate but this leads to loss of input.
I should also mention that my input isn’t just buttons, it’s also the analog stick.
Do you guys have ideas on how to fix this issue? Cheers!!
Here’s a high-level overview of the kind of things you should be looking at when implementing replay recording. This is for immediate rewind and playback, so there’s some things that won’t apply to you, but there’s still a lot of relevant info:
TL;DW:
- Serializing the entire world state is a more robust solution than just serializing inputs. Unless your game is entirely deterministic, which by default Unity is not, you can get desync.*
- Compression
- Save only what changes
*partially depends on the kind of game you’re making. If you’re making a game that has a ton of dynamic entities (like a bullet hell for example), it might be a more viable solution for you to simply make the engine deterministic and save inputs.