Looped live code editing

Sounds like a complex freak of nature stuff or at least it did to me when I fist saw the title in HandmadeHero. I can't say this enough, if you have never watched the series and you are a programmer, I urge to give it a try, you'll never look at programming the same way again. Casey does an amazing job of breaking complex ideas down into single videos. Mainly because he knows what he is doing and has been doing for a while now. Even then the way he explains things seems to just resonate with the way I understand stuff. Admittedly it takes me about five to ten times longer the amount of time to figure the stuff out for myself and to replicate the behavior with Zig and Linux. Not because of Zig or Linux, mostly because of my skill issues. Even then I'm able to get the idea behind the concepts, it's the execution that I stumble around a while in the dark till I get it which is also the fun bit.

What is this looped live code editing stuff anyways?

It's quite simple really, you record a section of your game or any application for that matter. By recording game I mean recording the state and the inputs which you can then use the replay on a loop to test out variations of your code. This only works because the actual game code itself is loaded dynamically when it's edited. I've written about it here if you want to know more. So what this essentially means is that you can edit the code while the recording of your input and state plays and see what the changes to your code does to the output. It's a really fun way of debugging your code visually. Best of all you can get all of it working in less than twenty lines of code. All you need to know is how to write to a file and then read from it after. That's it really. The outcome is surprisingly amazing for a very low amount of effort. You can find the code here if you want to check it out but I would suggest checking out Days 21-23 as in about three hours Casey explains how to load game code dynamically and then edit it and watch the changes appear in real time. I'd like to explore how far I can take this. This seems to me a fascinating way of debugging code.

Hope you enjoy it as much as I did. Going through handmade hero has been the best decision I've made for getting better at programming. It's simple no nonsense programming. It's what I have been looking for since I fell in love with programming five years ago.