Amazingly Fast Edit-and-Continue
Are you a C# or XNA developer who is insanely jealous of other development environments that allow you to see code changes instantly or almost-instantly? Have you been considering embedding a scripting language, only to realise that most scripting languages kinda suck?
Were you green with envy when you saw Bret Victor showing off his changes-as-you-type developer tools? (video here, it’s quite long, demo starts at 2:35)
(Or rather: you would have been green with envy… but that would have involved stopping executing, modifying your Colour parameter, recompiling, waiting, starting execution again, and getting back into the desired state. Only to discover you were the wrong shade of green.)
Well worry no longer! In this High Definition (seriously, watch it in 1080p so you can see the text) video demonstration, I’ll show you how you can get the same workflow using nothing but Visual Studio and perhaps a macro tool.
If you’d rather read about this trick than watch a video, I’ve described it in this answer on Stack Overflow.
Next week I’ll post a video that’s actually about the game itself 😉
Comments
Simon Moles
Nice post! I’d just been setting breakpoints to do this up till now. My mouse didn’t have a proper macro editor, so I created a VS plugin to do the job.
Details here: http://blog.simonmoles.com/post/25027251545/editandcontinue
Hassan Selim
I’m quite interested in your “SmoothStep” float Extension Method, because I’m about to implement something similar to that 😀
Do you mind if you share its code?
Andrew Russell
It’s pretty simple, here’s the code:
public static float SmoothStep(this float x) { return x * x * (3 – 2*x); }
SmoothStep is a standard function. There’s an implementation in XNA as well (MathHelper.SmoothStep). I just like using extension methods for this kind of thing (I have many more) because you can chain them together for nice, readable animation code.
Hassan Selim
Yeah I also like these kinds of extension methods and was willing to do some for animations because it makes it readable and simple, the only problem though is that it’s not possible to keep track of the previous values unless you use a hacky way which includes a static dictionary or something like that, and then you’ll need a way to dispose old unused animations :\
Andrew Russell
I’m not quite sure what you’re doing. Although I should say that these aren’t for providing the underlying animation – just for adding some “flavour” once you have a simple linear animation. Look up “easing functions”.