Has Day 23's Technique Been Documented Before?

I like how each component is easy to implement. When the jump code being edited was demo'ed it became apparent how useful this will be.

I'm not sure I understand the whole problem with function pointers, but couldn't we have a struct in the game memory that points to all functions we are interested in. Then any function pointers in our code point to the entries in this table instead of the actual function. When the DLL is reloaded, we just patch this table in the game memory struct. We'd have a double indirection, but its probably worth it for the convenience and speed of live tweaking.

Edited by Dejan on
The problem with function points is exactly what you just said :) You always have to go through a double-indirection. So basically, you can't ever use function pointers directly, you have to use something else, like an enum that says what the function is.

Thankfully, that's probably what we would have been using _anyway_ because usually I prefer switch statements to function pointers because I like to aggregate stuff and have premables/postambles. So not having function pointers per se is not going to be a problem for us, I don't think. But if you wanted to be able to use direct function pointers without going through some kind of secondary system, this technique wouldn't work. You have to have that extra layer of indirection.

- Casey
OrthoLabs
Edit: Here is something one of my friends found while I was talking with them about the same talk. Someone implementing what Bret Victor did, and giving their own input on it. http://www.chris-granger.com/2012/02/26/connecting-to-your-creation/

That is cool! I still think we are the first to show how to do this in C/C++ (which was mainly what I was talking about in terms of being first), but I actually hadn't ever seen anyone demo a real working version of it in any language at all, so that was a new video for me.

- Casey
This technique is essentially the core of re-recording emulators used by the TAS (Tool Assisted Speedruns) community. Given that those systems have much smaller memory footprints, the emulators can and do create a snapshot for each frame while recording to allow for single-frame step forward and backward and modifying the input parameters per frame to achieve the most optimal play though.

If you've never seen TAS runs go to http://tasvideos.org/ They're insane.
Reminds me of what Bret Victor shows in: http://vimeo.com/36579366
A couple years ago I wrote an Emacs mode called Skewer (demo video) for accomplishing the live editing part with JavaScript in a running browser page. I've used it in a number of projects to minimize refreshing/restarting during development, including two HTML5 games. Unfortunately live editing is not compatible with some giant client-side frameworks like Angular, which has limited its usefulness in that domain.

But I've never recorded and played back user input. Even though I've seen Bret Victor's stuff before, it never occurred to me until day 23!