While working on rktcr, I've spent a while thinking about how to checkpoint Box2D simulations so that one can rewind and play them back exactly.(Useful for replays, or time control when you really care about doing it right.)This turns out to be both harder and easier than one would expect:harder, because some of the simulation state (e.g. order of contact processing) is hard to access, much less properly save;easier, because one can hook memory allocations in Box2D and just save everything.This is one of those hacks where I'm very glad I use a language that can talk about memory.
I'm releasing this code as public domain -- you can find it from GitHub here.There is a small patch you'll need to apply to Box2D included.If you enjoy (or are confused), please let me know,