Squirrel’s in-game script reloading
Today I’ve achieved what I wanted… a method to reload scripts in-game without having to restart the game or even the level. I know that probably those mentioned events will happen a lot, but I’ll be happy to be able to a lot of other times change a bit of an enemy behaviour without needing to “get back to where the bug happened” (which takes time and sometimes doesn’t even work).
The only caveats are that the language doesn’t allow to add new member variables (as JavaScript would) nor remove functions, but it allows to replace and add new functions on the fly. Maybe for big changes it wont work, but for tweaks it’s a charm. A workaround is to make all instances to have a unique table as a member variable to hold on to any new member variable needed until the next “reset” iteration.
With this feature and some in-game graceful handling of script errors (syntax and logic) to avoid a total crash, hopefully, I’ll be able to work comfortably and with shorter try-test-fix iterations.
Thanks for reading
Posted: 2012-04-03 18:57 | Author: 2bam | Filed under: Uncategorized | No Comments »






