I'm writing a little embedded language for another project. While game development was not its original intent, it's starting to look like a good fit, and I figure I'll develop it in that vein at some point.

Without revealing any details (to avoid bias), I'm curious to know:

What features do you love in a scripting language for game development?

If you've used Lua, Python, or another embedded language such as Tcl or Guile as your primary scripting language in a game project, what aspects did you find the most useful?

  • Language features (lambdas, classes, parallelism)

  • Implementation features (performance optimisations, JIT, hardware acceleration)

  • Integration features (C, C++, or .NET bindings)

  • Or something entirely different?

  • 2
    \$\begingroup\$ Obfuscation: Because if it can be obfuscated then it's probably also quite flexible. Take Perl, for instance, which can be obfuscated to the extent that it looks like the output caused by line noise from a 300bps modem (when someone else picked up a telephone at the other end of the house) back in the days when these were fast. ;-P \$\endgroup\$ Jun 19, 2011 at 0:11
  • 1
    \$\begingroup\$ @Randolf: Good point. The only problem with obfuscation is that it tends to rely on a stable language, which young languages aren't. An obfuscator that works with 0.10 might not work with 0.11. \$\endgroup\$
    – Jon Purdy
    Jun 19, 2011 at 0:15
  • \$\begingroup\$ @Jon Purdy: That's correct (+1 for you). There's also the aspect of obfuscated code being more difficult to maintain. The important thing to note, though, is that obfuscation can provide one interesting measure of how flexible a language is. \$\endgroup\$ Jun 19, 2011 at 0:24
  • 5
    \$\begingroup\$ @Randolf: when does perl not look like that? \$\endgroup\$
    – Ken
    Jun 19, 2011 at 4:06
  • 1
    \$\begingroup\$ @Joe Wreschnig That's saying 'which one should I pick', this is more 'what features are good in a scripting language'. \$\endgroup\$ Jun 19, 2011 at 14:56

3 Answers 3


I'm looking for two things- speed, and integration. Usually the two go together, and with familiarity. Unfortunately, for C++, there are pretty much no languages that offer speed and integration. I've used Lua and it sucked, horrifically. I spent the whole time writing bindings and nowhere near enough time actually writing code.

Language features? The point of embedding a scripting language is not so that it can have whizzy dynamic language features that my original language didn't have, it's so that it can be interpreted at run-time. I really don't care beyond that, as long as it's basically functional, then that's fine- and fits with my host language (in this case C++). However, amazingly, languages that are designed to be integrated into host applications utterly fail the the part about integration.

Do I need co-routines? No, I do not need co-routines. Do I need dynamic typing? No, I need to know what types are coming back at me from my scripting language, and since all of my existing code is built around very strong typing, I'd really like my script code to be able to respect that too. Do I need garbage collection? No, my types already manage their own resources, and I definitely do want deterministic destruction. Do I want goto? No- I want to throw exceptions.

The trouble I found was that basically all the existing scripting languages were designed to extend C, not C++, and don't properly support the C++ model in many ways, and in addition to this, they have totally different semantics. How on earth am I going to translate shared_ptr, which is automatic deterministic destruction, into a garbage-collected environment? You can write whatever wrapping libraries you want, you won't change the underlying language semantics being incompatible with the language you're trying to extend with it. How can I ensure that this void* is the right type? How can I deal with inheritance? How do I throw and catch exceptions? It just doesn't work.

A good scripting language for C++ would be statically typed, value semantics, deterministically destructed, throw and catch exceptions and respect my destructors/constructors/copy constructors, because then all my types will just work, nice and easy, and the resulting language will be fast and support all my original semantics, easy to bind to.

  • \$\begingroup\$ You should try something like this wrapper library I wrote for myself recently to address some of the same problems you were having. You can use shared_ptrs and stuff with it just fine, it's type safe (as much as it can be anyway), you can decide if you want the life of something controlled by your code or by the Lua environment, it supports inheritance, and it's extremely similar to the normal Lua API. I'm not sure I get the complaint about making bindings though, I just use vim snippets to make my bindings 99% of the time. \$\endgroup\$
    – Alex Ames
    Jun 21, 2011 at 22:14

For web-based gaming, three important factors for me are:

  • Familiarity
  • Speed
  • Integration

I particularly like Perl, partly because I am already familiar with the language, and because with a web server module like mod_perl2 there is a huge performance and integration benefit -- mod_perl2 keeps a compiled version of the scripts in RAM (which are only interpreted upon first loading) that gives it a major speed advantage over other interpreted languages that don't have compilation options, and it also integrates into the Apache HTTPd server with a feature-rich API that provides access to a lot of very powerful features.

These factors can be useful for web-based game development (and where database access is needed, caching the database connections helps to further reduce response times for users). Of course, this may not be the most ideal solution for everything as each language has its advantages (and disadvantages), but it has always worked well for my needs.


Arranged in the order of (decreasing) importance:

  • Readable at a glance. Actually, that's a requirement for any language I want to use, but for scripting it's arguably more important: scripts, by definition, change more often than "core" code. So, no LISP or PERL.
  • Terseness. Scripts are constantly written and rewritten, and typing lots and lots of "boilerplate" code is inefficient.
  • Easy debugging. Preferably with breakpoints, step-through etc.
  • Easy integration with my chosen "core" technology. If I'm using C++ for my game, I'd need good C++ bindings, like in LUA. If the game is in C#, I'd choose a CLI-based language: C#, IronPython, Boo.
  • Language features: easy associative arrays, coroutines, maybe lambdas. Actually, this mostly depends on what I'm going to use the scripts for. AI scripts are different from, say, initialization scripts.
  • Good documentation. C# has a whole MSDN dedicated to it, and Boo has only sources. that's why C# is way better.
  • Good development environment. VS or Eclipse beats Notepad every time.
  • \$\begingroup\$ +1 This helps me out quite a bit, thank you. I'll wait to see if there's any further discussion, but I think you covered it well. \$\endgroup\$
    – Jon Purdy
    Jun 19, 2011 at 6:48

Not the answer you're looking for? Browse other questions tagged .