Overgrowth takes place in the savage world of Lugaru where rabbits, wolves and other animals are forced to use paws, claws and medieval weaponry to engage each other in battle. Combining 3rd person adventure platforming with intricate melee combat, Overgrowth achieves a unique feel. Overgrowth also benefits from Wolfire's brand new Phoenix Engine which has been built from the ground up to allow the use of cutting edge graphics, animation, and physics. Add to these exciting features Overgrowth’s realistic artificial intelligence and streamlined control system and the result is an astoundingly immersive experience.

Post news Report content RSS feed Choosing a scripting language

For the last week or two I've been working on choosing a scripting language for Overgrowth. I haven't worked with scripting before, so I hooked up Lua, V8 and AngelScript in order to give them each a fair trial and see which is most appropriate for us.

Posted by jeffr on Jan 21st, 2010

For the last week or two I've been working on choosing a scripting language for Overgrowth. I haven't worked with scripting before, so I hooked up Lua, V8 and AngelScript in order to give them each a fair trial and see which is most appropriate for us.

What is a scripting language?

In general, scripting languages are programming languages that are used to control other applications. In games, their use is more specific: they are embedded into the game in order to run external "scripts" (pieces of code that can be modified without recompiling the entire game). This is useful in several ways. First, it makes gameplay programmers more efficient by reducing the amount of time they spend waiting for their code to compile. Second, it helps enforce the division between the game engine and the game itself, encouraging modular and reusable code. Finally, it allows players to write their own scripts, resulting in much more complex and interesting mods.

I've avoided scripting in the past because native C++ code runs orders of magnitudes faster than interpreted languages. However, this is not really that important: high-level game logic is almost never a performance bottleneck. I've seen how much live texture and shader updating speeds up my graphics work, so the idea of live code updating is very appealing.

What do we need from a scripting language?

There are three things I need from a scripting language. First, it has to be easy to embed in Overgrowth. Second, it has to be similar to C++. Third, it has to support user-defined types and operator overloading.

1. Easy to embed

In order for a scripting language to be able to do anything, it needs to be connected to the game engine. For example, a gun class in the game engine might need to call a 'shoot' function from a script, and the script would then need to call a 'raycast' check from the engine to find out if it hit anything. The easier it is to share functions and variables between the game engine and the scripting language, the less development time it will take to hook up.

2. Similar to C++

Many of you probably disagree with this point, but hear me out before writing irate comments! By using a scripting language that's similar to C++, I can prototype performance-critical functions, and then smoothly copy them into the game engine code when they are done. Constantly translating code between C++ and Scheme, for example, would be really annoying and error-prone.

3. User-defined types and operator overloading

This is also controversial, but I find that operator overloading is essential for writing maintainable linear algebra code. Operator overloading lets us add, subtract and multiply vectors and matrices as easily as we add, subtract and multiply integers. For example, let's say I want to find how far apart two players are on the screen (in order to make sure their names don't overlap). I won't get into exactly how this works, but using operator overloading this would look like this:

cpp code:
float distance = length(
    (model_view_matrix * player_one_position).xy() -
    (model_view_matrix * player_two_position).xy());

Without operator overloading, we have to replace all of those basic math operators with member functions like Multiply() or Subtract(), making it look more like this:

cpp code:
float distance = length(

I'm sure there are many great programmers out there who can read and debug code like that (the entire Scheme programming language is based on this principle, for instance) but I find it difficult!

With these requirements in mind, let's evaluate our three candidates: Lua, V8, and AngelScript.


Lua is a very popular game scripting language, used in everything from Aquaria to World of Warcraft. Because it is so popular, it has specialized libraries like Luabind which make it easy to embed in C++ programs. It does support operator overloading, so it should be easily usable for 3D vector math. However, it would be very difficult to port Lua code to C++ and back. First, Lua is a dynamically-typed prototype-based language, while C++ is a statically-typed class-based language. Second, Lua has its own idiosyncratic syntax -- here is an example:

lua code:
-- Print numbers counting from 1 to "to_what"
function count(to_what)
for the_count = 1, to_what do

V8 JavaScript

While Lua is a popular game scripting language, JavaScript is the most popular scripting language for everything else. We already use JavaScript for our WebKit UI layer, but is it good for game logic as well?

I found that it is quite difficult to expose C++ functions to the V8 JavaScript engine -- there is no established Luabind equivalent, so I had to create a much more low-level wrapper than I did for Lua. This is not so hard for simple functions and variables, but it would be very difficult to expose complicated classes and member functions. Also, while JavaScript syntax is superficially similar to C++, it does not support operator overloading, and is structurally much more similar to Lua (JavaScript is a dynamically-typed prototype-based language).


AngelScript is virtually unknown compared to JavaScript and Lua -- I only heard about it from our friends at Frictional Games. It has native support for C++ functions and types, so it is very easy to hook up to the game engine. The syntax and structure of the language is very similar to C++, except with garbage collection and a few simplifications. It also supports operator overloading, and even comes with example code for setting up a 3D vector type.

Given the three things I was looking for in a scripting language, AngelScript seems ideal. Now the game engine code, gameplay scripting code and even GLSL shader code all use the same syntax! For example, the following code would run in the engine, in a script, or in a GLSL shader:

cpp code:
    point_of_interest = target_position;
} else {
    point_of_interest = GetRandomNearbyPoint(head_position);
vec3 head_direction =
     normalize(point_of_interest - head_position);

If this code doesn't make sense to you, and you're interested in how it works, you can read my Linear Algebra posts (part 1 and part 2).

Uses for scripting in Overgrowth

There are a lot of possible uses for scripting in Overgrowth -- right now I'm mostly interested in using it for developing the movement, AI and fighting systems more rapidly, but it can be used for many other applications as well. For example, I'm thinking of eventually using scripts to handle spawning detail objects like grass and small rocks, and to direct dynamic weather effects. Can you think of any other ways we could use scripting?

Track us
on ModDB (visit our page)

Please join us here too:
Facebook icon ModDB icon Steam icon Twitter icon YouTube icon

Post comment Comments
feillyne Staff Subscriber
feillyne Jan 21 2010 says:

What about character/etc. stats? Will they be stored in .xml or .ini files? Or something else?

+2 votes   reply to comment
Joe_Shmoe Jan 21 2010 says:

Dont know anything bout scripting, but I say "Simpler is always beter" =] seems angelscript it is?

+3 votes     reply to comment
Ichiman94 Jan 21 2010 says:

huh, lua is my opponion, but you can try python....
lua has good performace.......

0 votes     reply to comment
Dan911 Jan 21 2010 says:

only reason i would recommend something besides angel-script is because moddders (especially new/inexperienced ones) would probably rather use something like LUA instead because of its simplicity

+2 votes     reply to comment
DuckSauce Jan 21 2010 says:

I can't help with the decision which scripting language to choose, but I've experienced a bit of two ways of modding.
1. Source, most of the gamecode is part of a C++ solution that you compile, with a couple of "scripts" that's mostly just textfiles being read by the code.

2. Mount&Blade modding, they use Python another scripting language.

The way I experienced it, Mount&Blade was severely limited by allowing the modders to only use scripting. While you could do a nice variety of things really easy with little knowledge of the scripting language, the downside was you were largely limited to that what the developers "allowed" you to do, basically a large part of the gamecode was done with C++ and you didn't have access to it, meaning core parts of the gameplay couldn't be changed because alot of stuff was "hardcoded".

So maybe that was a decision they made, or it had to do with the limits of python that they couldn't do the "hardcoded" stuff with that scripting language. Either way the result is that modding became limited to little to none gameplay changes, gameplay remained that of Mount&Blade, unlike Source where a first person shooter is turned RTS, RPG or a racing game or heck even be turned from 3d to 2d!

So you should also consider how much freedom you're want to and can give modders with the scripting language you choose. If you're gonna do as much "game" code you can with a scripting language and the "engine" code with C++ and the "game" code is what modders will work with, then I'd say choose Lua if it can be reasonably done with it since that's supposed to be easier on people new to that sort of stuff.

If you're gonna let them work with your C++ code and a scripting language, choose that what's similar to C++ so it's also easier for new people as learning 2 new languages is worse than one.

+2 votes     reply to comment
TheHappyFriar Jan 21 2010 replied:

conversely, doom 3 (and Prey & ETQW) allow you to modify almost the entire game via scripting. C++ for things that were better handled there, script for things that didn't need the power of C++.

If Overgrowth has pretty much everything but the engine & a few critical functions in script (D3 for example didn't do trig in scripting, so some people make their own trig functions, which wasn't fun, but it worked!) then scripting is one of the best ways to go. It's like the C vs Assembler argument years ago. :)

+4 votes     reply to comment
DuckSauce Jan 21 2010 replied:

If scripting wouldn't be limited like you say it's in those games, then I'm all for it ;)

+1 vote     reply to comment
Delusibeta Jan 21 2010 replied:

So, basically do what the Natural Selection 2 guys are doing and no-one will complain too loudly.

+1 vote     reply to comment
Wiweeyum Jan 21 2010 replied:

I'm a fan of the D3 scripting. I'm no programmer, but I was able to do a lot of the base level tweaking myself.

+1 vote     reply to comment
NullSoldier Jan 21 2010 says:

You didn't say much about it but a lot of developers are starting to use MONO for game scripting now-a-days because it's powerful, has c-style syntax and is easy to use.

Everyone seems to want to use LUA but I absolutely can't stand tab deliminated languages they are total crap to write code for syntax wise. I just wish tab deliminated languages would disappear and be replaced by c-style languages.

+2 votes     reply to comment
ger Jan 21 2010 says:

I did a very similar proccess to choose a scripting library for Warsow. Tried LUA, GameMonkey and AngelScript. The selected one was AngelScript, because of its simplicity to plug in into the C gamecode, its speed, and its similarity to C++ (easier to start coding straight ahead for most people). It's been a long while since we implemented it, and I'm very happy with the decission.

+4 votes     reply to comment
JKM Jan 22 2010 says:

Some people have made similar remarks already, but just to make it very clear:

I think you have missed a big point if you want the scripting to allow for easy modding (and not just speeding up your own development).

I think due to your skills in c++ it seems natural to choose angel-script, but think of the mappers later on.

Even in highly sophisticated modding teams there is little more frustrating that having to ask the lead coder for every little change. In fact I think this is one of the biggest hurdles in modding that (except in the few engines with great tools) someone without sufficient coding skills can not just "dabble" around trying this and that and waiting only for the really big changes done by the main coders.

Lua (or python I think) are now easy enough and pretty much a standard that even non coders can get into them on a basic level for map/ai scripting and such, angel-script with its similarity to c++ is not.

0 votes     reply to comment
jeffr Author
jeffr Jan 22 2010 replied:

It's a tough decision. With AngelScript, we will be able to expose much more of the engine, since it is trivial to expose it to a C++ language. However, not everyone knows C++ so it might make it harder for modders.

We will see how it turns out, and could theoretically switch if necessary.

+1 vote   reply to comment
NullSoldier Jan 22 2010 replied:

I think it's a bad idea to water down your engine just because peopple don't have the time or effort to actually learn some basic C-style scripting. Instead of having your engine's scripting watered down for the lesser individuals build it for the higher individuals and have the lesser's learn.

Choosing the harder options which in the end makes it more powerful is always the better choice. It's like comparing WYSIWYG to building something yourself. WYSIWYG is easier but limited in comparison.

+2 votes     reply to comment
Geowil Jan 23 2010 replied:

I agree as well, c++, or something similar, should be one of a coders base languages (along with maybe c# and possibly java) in the first place, in my opinion. C++ is probably one of the easier languages to learn, least it was for me.

But yes, watering down an engine to hand-hold the "mappers"-esque people, as it was put (mappers should map, not get into coding. If you want to code, go learn the language you want to code for), is not the best way to go about things.

+2 votes     reply to comment
DOLBYdigital Jan 22 2010 says:

Interesting post and good to see some of the decision making behind the scenes. I'm not a coder so I won't get into my opinions but it does seem like this is a hard decision. I'm sure you guys will come up with a great solution but I do agree with JKM in that many mods seem to need coders.

Either way I think we will see some great mods for Overgrowth mainly because the community is already strong and it hasn't even released yet. I hope in the long run you guys are able to provide modders with a lot of power and also an easy scripting language but there may not be a solution that provides both. In the end I would prefer something that allows mods to do more even if its more challenging coding wise. I'd rather see a few unique and different mods than a bunch of little mods that only change small things. Keep up the great work!

+1 vote     reply to comment
Mularac Jan 22 2010 says:

I'm with NullSoldier here. I'm currently modding a game that has many hardcoded features (and a tough language too... so it seems I'm on the loosing side here) and I can tell you that I wouldn't care spending one more week learning the code language if it meant that I would have those features available. Learning a language from scratch can be done so don't sacriface game features for an "easier" language.

+2 votes     reply to comment
The_Game_Pope Feb 6 2010 says:

I think you should use Lua. I'm not a good programmer, but in Crysis, I made a lot with lua. And a very good thing about lua is, that you can define each C++ function as a lua function. That makes it easier for modders and yourself. So i would say choose lua.

+1 vote     reply to comment
Post a comment

You are not logged in, your comment will be anonymous unless you join the community. Or sign in with your social account:

Windows, Mac, Linux
Developer & Publisher
Wolfire Games
Send Message
Release date
Game watch
Start tracking
Post news
Related Games
Overgrowth Adventure
Related Engines
Phoenix Engine
Phoenix Engine Commercial TBD
Related Groups
Wolfire Games
Wolfire Games Developer & Publisher with 4 members