Search code examples
c++c++11scriptinggame-engine

C++ embedded scripting language for game development - can't find anything I like


I'm desperately looking for a fast, C-like syntax, easy to embed, easy to wrap scripting language to embed in my C++ games.

So far I've tried:

  • Lua: it works, but wrapping global C++ functions around it is painful, and wrapping objects is even more difficult. Also, I really dislike Lua's syntax.
  • AngelScript: couldn't get it to work. Beginner documentation is absymal, as the first examples do not compile, and you have to build a lot of add-ons first. Wrapping C++ objects and functions looks easier than Lua but it still could be cleaner. Syntax looks fine.
  • ChaiScript: couldn't get it to work. I got a lot of errors both with the non-git and git C++11 versions. I don't want to use the boost version, as I don't want to introduce boost as a dependency in my project. Wrapping looks easy, and syntax is ok.

I've also investigated:

  • Pike: syntax looks good, but I found no documentation about embedding.
  • Squirrel: I don't like the syntax, and embedding/wrapping is as annoying as Lua, having to deal with the stack.

So:

  • Is there a good fast, C-like syntax, easy to embed, easy to wrap alternative?
  • If there isn't - what are the best learning resources on the creation of a scripting language? I like reinventing the wheel, and this could be an interesting learning experience.

Solution

  • For C-like syntax, checkout

    • Ch a commercial, embeddable C interpreter
    • CINT an open source C/C++ interpreter
    • Pawn - a "simple, typeless, 32-bit extension language with a C-like syntax"

    Probably not for you, but as this question might turn up a list of alternatives others would find interesting, I offer you QtScript which gives you a Javascript-like syntax. Wrapping can be straightforward, but you need to adopt the Qt framework to do it, particularly concept of signals and slots.

    There's also SpiderMonkey, the JS engine from Firefox.