August 18, 2014

When Scripting Deserves to Fly

Hello everyone!

It's my very first blog post here, and I'm excited to bring to you the work I did as part of GSoC 2014!
Ever thought of an awesome and fun feature for a track you loved? Wanted the sheep in Green Valley to run away as you passed them by? Well, I've been working on a shiny new Scripting Engine for SuperTuxKart to allow all that and more. The best part is that scripting makes it unbelievably easy (and fun) to create good game loops! If you wish to know more, more details are available at

The first part of my project was to come up with a good language and an  intuitive and user-friendly scripting API. With this in mind, I chose AngelScript as the language, due to a variety of reasons, chief among them the fact that it had good synergy with our existing code. Most of my work went into refactoring existing code so as to expose that functionality to the API. Right now, most of the different track elements you see like animations, static objects have had various properties exposed to the API. I've also added several different ways of triggering scripts, from action-triggers (Think bubbles that pop and run a script when you enter it) to collisions (between karts, items and track-objects). In addition some miscellaneous classes have also been bound ( For example 3-D vectors ), to make life easier for anyone writing scripts.

The API is pretty comprehensive at this point (You can find the API documentation at, and I intend to broaden it further to allow more fun stuff to happen during races. I'm still hoping to do quite a bit of work post-GSoC on things like the weather, object behaviors and perhaps some unit testing as well.

I've added a tiny example (which is way more fun when you actually play it), for everyone to get a taste of what scripting will bring! Feel free to pull the ScriptEngine branch at for even more fun examples! You can find the scripts under stk-code/data/scripts.

An innocent looking barrel appears in Hacienda, let's check it out!

It's a trap!

The barrel has exploded into 2 parts, the rim and wonky-barrel

We'll be adding a video showcasing all the capabilities of the new engine once my work is merged, so stay tuned for more details!


  1. woah, that's awesome !

    keep it that, guys :D

  2. Well Done Guys! the updates on the blog keep on getting better and better.
    Keep up the good work ;)

  3. I love this feature! Man stx is going to eventually be way better than some other unmentionable kart racing games on the PC. : D

  4. With the scripting, maybe you could impose speed limits. Make a recording of police sirens, then have it play back and slow you down for a few secs.

  5. When we can play STK 0.8.2 (Please) ?

  6. I'd like another update...It doesn't really have to be anything substantial, just tell us you're still actively working on this...

  7. Replies
    1. No, and I don't really have any good excuses... I want to write a post soon, so please stay tuned.

  8. This comment has been removed by a blog administrator.