Separating running/editting code



  • Right now, if you have a syntax error in the "committed" code, everything just stops as all code breaks. This is reasonable for the current world where everything is short-term, but I'd hate to be editting a persistent world and lose a couple hundred ticks while I'm trying to find the typo. It would be nice to be able to automatically revert the running code to a previous known good state, while keeping the code in the editor the current debugging version.



  • I think this would be nice to have, but keep in mind that switching your main program suddenly would be quite prone to errors itself. You'd have to maintain both programs constantly to make sure their memory usage is consistent or you might end up corrupting your AI state when you switch. But, you don't have much to lose if you run into a recurring error.

    You can use a try-catch block but again there's a catch (no pun intended). You can't cancel the actions (creep moves, memory assignments, etc.) of your terminated program without throwing an error. And you can't set a memory flag to run a different program next tick unless you complete the tick without any errors. So again, you run the risk of corrupting your AI state.

    I guess the only foolproof solution would be to use try-catch-finally blocks throughout your program to properly deal with errors.



  • Eh... I'm happy enough with the API access; I can keep code in git locally for development. Then if I break something at a terrible moment, just "git stash; push-to-server.rb; git stash pop" to get a good version running.

    Since pushing code seems to take effect within a tick or two, that works just fine.