Categories
Uncategorized

The perfect scripting language, part 2

The author of Angel Script was kind enough to reply to me about his library: Hi Kevin, AngelScript is not an interpreting scripting engine, but its built-in compiler is fast and suitable for (re)loading and compilation of scripts at runtime. The script language is similar to C++, though not 100% compatible. It is also possible […]

The author of Angel Script was kind enough to reply to me about his library:

Hi Kevin,

AngelScript is not an interpreting scripting engine, but its built-in compiler is fast and suitable for (re)loading and compilation of scripts at runtime. The script language is similar to C++, though not 100% compatible. It is also possible to compile the script code and save the precompiled bytecode to disk for later use, if you do not want to distribute your script sources.

You mentioned in your post that the script will be able to call into the engine but not vice versa. This is not quite true, the engine obviously has to know how to make a call for it to be able to do it, but you could define interfaces or callbacks that the script can connect to, which the engine then uses to call into the scripts with. This is of course not an exclusive feature of AngelScript.

The main advantage of AngelScript over other scripting languages is that it is statically typed, just like C++, and that it can in most cases interact directly with the C++ application without the need for wrapper functions. This makes it particularly easy to embed in applications with an efficient interface. I cannot guarantee that AngelScript is the fastest scripting library, but it is for sure one of the fastest available.

I suggest you give it a try, to see if you like it and if it suits your needs.

Regards,
Andreas

1. It is good that you can reload at runtime.
2. To me it’s roughly equivalent to releasing script and releasing C++ game code for modders. On one hand, with script you don’t need to think about which interfaces you expose, and making nice header files for those interfaces. On the other hand, if you plan for this from the start it’s not really extra work and you get the use of a debugger.
3. Regarding script compilation, I think the best solution is to check the file dates of the script and the compiled script. When your game runs, compile the scripts that are out of date. If you change scripts at runtime and reload them, always compile them.
4. There is no debugger for AngelScript that I know of. Perhaps the script code execution module throws an exception? I would refrain from writing too much in script without a debugger. This is not a big deal from me, since I think it’s always a bad idea to write too much in script. Script should only be for things which change very frequently during development, such as gameplay specific numbers or algorithms. The Unreal Engine is an example of where script was overused pointlessly.
5. The author points out that Angel Script isn’t directly equivalent to C. With the use of defines (there is a preprocessor add-on) and refraining from using non-equivalent language semantics I see no reason why one would not be able to both script and compile the same code. I’d have to look at it in more detail to know for sure.

I can see the use for this for something like a map file for an RPG. When the character talks to NPC A, and selects option B, then trigger C.

Leave a Reply

Your email address will not be published. Required fields are marked *