Sign in to follow this  

Question on how Scripting languages are used in game development?

This topic is 3459 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I have a question about scripting languages(i.e. Lua, Python, ruby, etc). From what I've read on game development and even software development in general, scripting languages are used a lot. What I would like to know is how??? How do they incorporate the scripting language, I mean, like do they use a main programming language like C++ and somehow incorporate different lines of scripting code, and what specifically would a language like C++ and a scripting language be used for during game development???? Please, I am just really wondering and I don't know the answer.

Share this post


Link to post
Share on other sites
Their are several different ways you can use scripting languages in game development but the most common would be to write the core of the game in a language like c++ and have scripts for content like in game events and dialogue to avoid clustering the main code base and needing to recompile as much.

Share this post


Link to post
Share on other sites
Usually some high-level C++ functions are exposed/bound to the scripting language (e.g. to bind C++ and Lua together, you could use the LuaBind library), so that you can call C++ functions from within a script.

This allows a level designer to (for example), call a function to turn a light on or off, or tell an AI character to perform a scripted sequence (like running away from the player), etc... all without having to compile any C++ code. They could even edit their script code while the game is running.


In Supreme Commander, most of the actual game-play code is written in the Lua scripting language. This includes the user-interface, enemy AI opponents, unit statistics, etc... And then all the low-level stuff like graphics and physics are written in C++.

AFAIK WoW uses Lua as well, but only for the user-interface (so players can customise it by writing their own scripts).

Share this post


Link to post
Share on other sites
Avoiding the implementation details, I'll try to address what good scripting languages are.



The power of scripts is that you are allowing people to modify the course of execution without recompiling the full program itself.

Scripts are small programs. They must be compiled or interpreted, meaning they need to be validated, parsed, and processed. Very importantly: scripts must be debugged and generally must be profiled or optimized.

So this naturally leads to a few questions:

* Will people other than the programmers be editing it?
* What is the skill level of the people who will be writing the scripts?
* Will script writing and maintenance fall back to the programmers who are more comfortable and more efficient in the native programming language?
* Would integrated flash or other existing solutions be more appropriate than your own scripting tools or libraries?
* How much processing power will your scripting language require?
* Does it require a full comprehensive scripting language, or something simpler?
* How will scripts be debugged?
* How and when will they be validated?
* How will they be profiled when performance is an issue?
* Would a tool that generates intermediate data files be better than a formal scripting language?


Choosing a scripting language, or choosing not to use scripting, is highly dependant those answers.


Scripting tools introduce an additional development cost to programmers. They require additional debugging and tuning, and are a source of bugs. They make sense if you can offload enough work to non-programmers to justify it, or if you require the additional power of scripts after the release of the main executable.

My personal preference is that teams of 20 or less shouldn't bother with scripting languages. Use tools with data files that are processed in the tool chain, use exporters and scripts within Maya and Photoshop, keep constants in a few large tuning files, and so on. If non-programmers need to edit values, let them export the values from their favorite editors, or write a tool to edit the data files.

Share this post


Link to post
Share on other sites
Sign in to follow this