Hello acme_pjz,
acme_pjz {l Wrote}:I think it's a cool feature that you can save your game play to a record file after playing a level, and next time you can watch the replay and/or upload your play to the Internet
I have made some puzzle game before and some of them have game record support. I'd like to implement this feature in Meandmyshadow
Any suggestions?
This can indeed be a great addition.
I think we can use a similar approach as we use for the player recording for the shadow.
MeAndMyShadow runs at a constant 40fps meaning that storing the key presses are enough to replay a complete level.
This has some downsides, including that if the level changes the replay will be invalid.
To prevent this you can add the level file to the replay, if it is the replay will also work without the original level.
One problem that can't really be solved is that when the physics change the replays will be invalid.
But assuming this won't occur to often (and only between release) I think it's a good enough solution.
As for the system I think we should create a ReplayState that extends the Game state.
This state won't listen to player input, do the key presses every frame.
It can also be used to increase the play speed by calling logic twice before rendering.
Anyway, good luck!