Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What is a good scripting language to integrate into high-performance applications?

I'm a game's developer and am currently in the processing of writing a cross-platform, multi-threaded engine for our company. Arguably, one of the most powerful tools in a game engine is its scripting system, hence I'm on the hunt for a new scripting language to integrate into our engine (currently using a relatively basic in-house engine).

Key features for the desired scripting system (in order of importance) are:

  • Performance - MUST be fast to call & update scripts
  • Cross platform - Needs to be relatively easy to port to multiple platforms (don't mind a bit of work, but should only take a few days to port to each platform)
  • Offline compilation - Being able to pre-parse the script code offline is almost essential (helps with file sizes and load times)
  • Ability to integrate well with c++ - Should be able to support OO code within the language, and integrate this functionality with c++
  • Multi-threaded - not required, but desired. Would be best to be able to run separate instances of it on multiple threads that don't interfere with each other (i.e. no globals within the underlying code that need to be altered while running). Critical Section and Mutex based solutions need not apply.

I've so far had experience integrating/using Lua, Squirrel (OO language, based on Lua) and have written an ActionScript 2 virtual machine.

So, what scripting system do you recommend that fits the above criteria? (And if possible, could you also post or link to any comparisons to other scripting languages that you may have)

Thanks, Grant

like image 653
Grant Peters Avatar asked Feb 27 '09 17:02

Grant Peters


3 Answers

Lua has the advantage of being time-tested by a number of big-name video game developers and a good base of knowledgeable developers thanks to Blizzard-Activision's adoption of it as the primary platform for developing World of Warcraft add-ins.

like image 125
Yes - that Jake. Avatar answered Nov 14 '22 17:11

Yes - that Jake.


Lua is a very good match for your needs. I'll take them in the same order.

Lua is one of the fastest scripting languages. It's fast to compile and fast to run.

Lua compiles on any platform with an ANSI C compiler, which afaik includes all gaming platforms.

Lua can be pre-compiled, but as a very dynamic languages most errors are only detectable at runtime. Also precompiled code (as bytecode) is often larger in terms of size than source code.

There are many Lua/C++ binding tools.

It doesn't support multi-threading (you cannot access a single instance of the interpreter from multiple threads), but you can have several instances of the interpreter, one per thread, or even one per game object.

like image 39
Doub Avatar answered Nov 14 '22 18:11

Doub


Lua have been used in video-game industry for years. Lightweight and efficient.

That being said, ChaiScript and Falcon are good candidates matching your needs and with higher level language than Lua but with less history and community support.

like image 45
Klaim Avatar answered Nov 14 '22 19:11

Klaim