A lot of newbie game developers ask themselves this questions, is scripting that important? Yes it is – at least to me. Now when you develop your own technology for games which includes a game engine, level editor and the rest of the tools, you would probably want to build a game on top of that technology. That’s where you need to implement scripting. Scripting is not free, it’s a lot of work for programmers and it takes game resources, but you’ll have to implement it in most games.
Why is scripting essential?
Now it’s easy to say that scripting is not important, but don’t get ahead of yourself for now. Let’s think about this for a second, now when you build a game you will have to implement the logic of the game, so where would you implement the logic of the game you would say, would you integrate it in the engine? It’s doable but that means that you have failed the important aspect of building a game engine which is to build a “reusable” framework for games. You might say it’s normal to have both framework code and game logic in the same place but I would disagree, you see on larger games integrating both has many design deficiencies, one of them is the compile time, waiting for the code to compile each time you change the initial position of the enemy is not fun anymore. Another thing is creating a game out of the same code base means that you’ll have to modify the code heavily so it can work for the new game thus eliminating the flexibility factor. One important fact is that most game designers are not programmers, meaning that they won’t be able to incorporate game logic if your game was written in C/C++/Java or any other programming languages.
How would scripting benefit me then?
Now that you understand few of the issues of building such huge games, you begin to appreciate scripting languages like Lua. Scripting provides a barrier between the complex modules that run your game like physics and rendering against the very specific game logic code like destroying enemies when they’re hit by a ball. Such a separation allows you to assign the task of implementing game logic to the less programming-guru-type like game designers, game logic is mostly written by easier languages like Lua which can be taught to game designers in less than three days. Another thing is the compile time, I keep coming to the compile time because it’s such an important matter when your code-base grows big, in the case of scripting you have different people maintaining the game engine code, that means you only compile the code of the engine if you add a feature or fix a bug.
What scripting language should I use?
Lua is a great scripting language, it’s very easy and has a tiny memory footprint, you can learn it easily in few days and the license enables you to use it in many projects. Many game developers prefer Lua because of the small runtime library, you can be sure that Lua is not a memory hog eating up your precious resources. You can find it being used in PC, Consoles and mobiles, so it’s a proven-to-work scripting language.
Not implementing a scripting mechanism in your game – unless it’s really simple – is not for your sake, scripting will spare you minutes of headache, waiting and probably excessive use of caffeine.