Engine Scripting

I am thinking about how to incorporate a scripting language into my engine. Luckily aveng, gimpster and me implemented a compiler from a scheme-like language to a bytecode format interpreted by a lean VM written in C. I plan to make that VM the core of the scripting functionality, which would enable me to have a compiled scripting language. How to actually use it is the hardest part. I’m thinking about enabling the user of the scene graph to specify a script that will execute during the application stage of the rendering loop, that way animation scripts can be written in scheme and just inserted appropriate places in the scenegraph. For instance a script controlling the movement of a door can be writtens once in scheme and attached the scene-graph at leafs representing doors. Of course, one could write many different door scripts, all in scheme, and use them all as they see fit.

Another feature which could be cool and prove priceless for people scripting for the engine would be to enable the engine to track changes in the scripts and automatically reload them. That way you can code many interesting aspects of the scene graph – and debug them – without even restarting the main binary! All this comes at the price of running the scripts, which will be fast since the scripts are compiled into compact bytecode running on a VM complete with garbage collection.

Leave a Reply

Your email address will not be published.

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>