Talk:GSoC Scripting

Scripting Engine

Being able to use scripts in tracks would allow much more interesting tracks, and reduce the amount of code to be maintained inside of the STK sources. Some examples where scripting could be used in a track:

  • birds/animals that flee when you drive near
  • driving over a button opens a gate
  • cows stop eating grass and look at you as you drive by
  • play sounds depending on what's happening in the race
  • trigger animations that might e.g. slow down the leader (throwing down a rock that forces the leader to avoid it)
  • perhaps even support modifications of the original track - we don't intend to support track deformations, but e.g. it is possible to add or remove part of the track, so the road could become narrower as part of it collapses (i.e. the road would be created from two different objects on the left and right, and at the right time one of parts will be removed, which is triggered by scripts).
  • certain features that are currently hardcoded in STK could be rewritten with scripting, and thus clean our code of specific hardcoded actions for certain objects:
    • e.g. in the tutorial a help popups when you reach a certain point
    • offering to start a challenge when driving near a challenge node in the story mode overworld
    • the gates to the final story mode challenge opening only when you have completed all challenges.


More specifically, this project will involve :

  • perform an analysis to determine how/when to trigger scripts, and what set of functions/classes should be offered to the scripting engine to offer interesting abilities while keeping the scope realistic (note that there is no intent to enable the coding of game modes or other complex features from the scripting engine; the goal at this time is only to make the environment react to player interaction).
  • once the analysis is done, write the C++ version of the API with the capabilities determined during analysis
  • select a lightweight scripting language (ideas: Lua, Squirrel, etc.) and integrate it into SuperTuxKart, mapping it to the C++ side of the scripting API. Implement proper error handling and reporting.
  • write a few proof of concept scripts to demonstrate implemented capabilities and provide full documentation to help writing further scripts