четверг, 18 октября 2012 г.

Gamedev - The Implementation of Rewind in Braid

I do some experiments and I want to cross usual runner game + Braid rewind technique. But the last is a really problem to code it.

There is a replay feature in Flixel framework (Yes, I use it), but It's not what I need.

I've found the audio recording from GDC 2010 by Jon Blow (the creator of Braid), but it's not for free :)
Fortunately, There is a review of GDC 2010 with some important points from each speech.

I copied it here.

When Blow began programming Braid, there were a few ways he thought about addressing it. Having a deterministic simulation is one way that would depend on the random number generator, particular algorithms used for the bunny AI, etc. This dependency would mean that every new build would potentially break the rewind mechanic, and as a lone developer, this wasn’t the best option in terms of developing a robust solution.

Another option would be to create a reversible simulation. Updating movement and AI code in this scheme would support negative time increments, returning objects to their prior state. But what about random access? Programming this would also be complex and potentially unfeasible.
Recording the world state is the final option that Blow considered. Tracking the entire world state for 60 frames per second would require a prohibitive amount of memory on a console. Only recording some frames and interpolating would reduce the robustness of the simulation, meaning that roundoff errors could open up potential exploits in the game.

Blow elected to choose the most robust solution: recording the world state without dropping frames. And the key to making this work is compressing information. Not recording static information was the easiest optimization to make, and another was to avoid recording changes from prior states. Instead, just record the new value for anything that changed. Doing so also works for base frames by recording the changes from the base object and the current state. And with this Braid can record at least 30–45 minutes of play for each level.