MangoFusion Posted October 29, 2015 Share Posted October 29, 2015 Hey guys,Anyone hanging around IRC may know I've been working on a rewrite of the TorqueScript VM (codenamed TorqueScript 2) over the past few months, based on the T2D codebase. The rewrite involves changing the bytecode & the interpreter runtime in order to improve runtime performance, as well as paving the way for more useful features.Why rewrite the VM? The main reason really is its fairly slow compared to modern interpreters (e.g. lua). Another reason is that the way TS manipulates variables makes supporting constructs such as arrays, lua tables, and closures a complete pain.Some of you may be wondering "why is MangoFusion bothering rewriting TS when we should be using [popular language X]?". The main reason in my case is I have a few projects which rely on TS in the pipeline and it would be more trouble than its worth sticking my feet into someone elses mysterious mess. Also I think embedding another language tends to create too many compromises I'm not too happy with, and they often fall short of supporting everything useful for game development (e.g. serializable coroutines).At the end of the day, with the exception of a few neat runtime features, TS2 will mostly just be a drop-in replacement for the existing TS vm. I don't have any plans to add in anything too complicated like a JIT or a hand-optimized interpreter since both things would incur a bad maintenance cost as well as make everything harder to compile in.Also I should stress TS2 is merely the codename, so I will likely designate a new name for it before pushing it out there.--Now enough about what TS2 will be. What is it now? Well it can currently parse, compile, and execute bytecode for much of the core torquescript language. The only major language feature I haven't implemented yet is array support, but that should be rather trivial.I'm currently working on fixing up the console interop so calling methods on objects from c++-land works correctly, which will also allow stuff to boot correctly (up until now I've just been testing it with main.cs basically).Future plans are to decouple the script code from the rest of the T2D codebase and spin it off into an embeddable project. Because quite frankly, i'm probably nuts.In any case I will be pushing my TS2-related changes to a branch this weekend, in the hope someone might find it useful. Quote Link to comment Share on other sites More sharing options...
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.