I’ve been working mainly as a engine/graphics coder during my rather short professional programmer career. Also, in order to learn more than what my job offers, at home I have coded several 3d engines, from weekend hacks to an engine I’ve working on and off for almost a decade. And on those that actually grew a little, I was always tempted to add a rather popular feature: scripting.

Oh, no, another rant

So, I’m going to talk about something I’ve never implemented at home, but have implemented and used at work. The difference between the two perspectives and some recent discussion at work regarding this same issue made me want to write my reflections and get some advice from the more knowledgeable readers :P

Also, I’m rather busy at the moment, so I’ll try to keep this short and concise, and in two simple points: pros and cons.

Scripting pros

So, why I was always tempted to implement and use scripting? What does it offer me compared to C/C++? Why should I clutter my project with more libraries, bindings, and such stuff?

  • Fast iteration: That’s one of the big selling points. Reloading an script should be faster than compiling and linking. I’ve seen a few systems unable to reload scripts during runtime, which is a pity. I used this in the past, in order to work on our exporter faster, and it was a delight.
  • More artist/designer friendly: Most artists/designers (usually) don’t want to go anywhere near C/C++ or deal with the engine nuisances, but want to customize behaviours, of fine tune as much as possible. In theory, a scripting language is more high level and simple than what the engine is programmed in, and thus more approachable.
  • More productivity: If I’m able to code on a higher level, I might be able to achieve my goals faster. Not a big point for me, keeping in mind that I’m not an extremely experienced scripter, but I know a few which would actually defend this one with a sword. Also, related, being able to describe groups of actions of your engine in a simple manner is cool is you don’t want to clutter you engine with per project needed features.
  • Mod friendly: You don’t have to release your engine source code (or need to release way less code) to let others use you engine on mods. I guess this is important to big companies, not that much to smaller ones.

Scripting cons

What always stopped me from implementing scripting on my own engines? What do people I know get pissed with, when using scripting languages? This is what I’d really love to get feedback on, so comment on this!

  • No debugger: That’s one of the main problems that I’ve with scripting languages. I want to be able to debug with something similar to Visual Studio. Or similar to TurboC. Or similar to a decent debugger. Printing stuff to the standard output should be banned as a debugging tool, only brings misery and pain to developers. If I focus on Lua, I found a two options: A few searches point to recent post by Zeux describes what seems a bit painful way to get the callstack of Lua from Visual Studio, but it seemed painful to say the least.
  • Performance: If I can do stuff that runs faster on C/C++, why should I use a scripting language? If I’m the one programming everything (or most of the stuff) why should I use several languages if it doesn’t mean more productivity, keeping in mind that changing context between several different languages a few hundred times a day will only slow me (and you) down. I’m quite aware of the performance differences between different scripting languages (there was a lenghty discussion on the SWENG list a few months ago), so I know that depending on how you intend to use the scripting language they might be negligible.
  • More dependencies: Even if you do have all your dependencies code and libraries on your code repository (which you should, IMHO), adding another dependency into your engine is not always cool. I always have the impression of constraining myself a bit with every additional dependency, in a not fun way to view constraints.
  • Losing control: A consequence of not having a debugger is that sometimes is hard to know why certains path of the script are called. It’s highly correlated with the lack of proper flow control we are used to check fast with debuggers.

I want feedback!

So I would really like to hear opinions on scripting. I would LOVE to know about better debuggers (or debuggers at all) that work with embedded use of scripts, about your personal experiences with scripting, if artists/designers actually use them, and if they’re happy with that flexibility.

Thanks to my coworkers at Bravo for some interesting discussion about this issues :)