A few months ago I was having a conversation with an old friend. He’s an AI and gameplay programmer and we were back on a topic that we’ve argued about many times in the past. Should game AI be written in a scripting language? His view was no, it should be written in a C++, a real language, one with compiler and templates and everything. My view, yes, of course it should. AI is content and it’s really-hard-to-create content at that. It takes trial after trial to get it right and if it takes you 10 minutes to compile your code and restart your build between tweaking each value, you’re going to be there at 3am a lot in order to meet your deadlines.
Now, obviously I was right and he was wrong, but that’s not important right now. The important thing was that I began to get an inkling that game developers don’t think that Lua – in this case – but more generally, higher level languages are worthy of them programming in.
Where is the line anyway, Java presumably isn’t a ‘scripting’ language, but is Python? Wikipedia says that a scripts are distinct from the core code as they are often written in a different language. That seems like a pretty sensible description, but lets think about that for a second. What if the game, the AI, the mechanics, the player movement, you know, the bits that differentiate your game from any other are written in a ‘scripting’ language and the rest of it – you know, the easy bit, the implementation of a ten-year-old SIGGRAPH paper – the graphics engine, are written in C++. Surely that makes core code the part that is written in the ‘scripting’ language, and the ancillary code is everything written in C++?
I could only think of two reasons that otherwise smart and enthusiastic game developers would turn down the opportunity to work with tools that made their jobs easier and their lives more productive. A lack of experience – they simply had no knowledge of why higher level languages could improve their lives; or snobbery – they they don’t think that real development can be done in these toy languages.
Ignorance is understandable, game development is a pretty specialised area of programming and it is easy not to look out at what the rest of the world are doing. Snobbery less pleasant but understandable too, I suppose, if for your entire career you’ve only been exposed to C++ because that’s the way it’s always been done.
- Minecraft (Java)
“It’s sold how many!” – Anonymous traditional game publisher
- EVE Online (Python)
Python enabled us to create EVE Online, a massive multiplayer game, in record time. The EVE Online server cluster runs over 50,000 simultaneous players in a shared space simulation, most of which is created in Python. The flexibilities of Python have enabled us to quickly improve the game experience based on player feedback” – Hilmar Veigar Petursson of CCP Games
Unity 3 is a game development tool that has been designed to let you focus on creating amazing games.
- LÖVE (Lua)
Don’t forget to have fun ( ^ – ^ ) /
As game developers we often see ourselves as the last bastion of the elite down-to-the-hardware developer and I wonder if perhaps we go too far to protect that image, at the expense of making better games. Any suggestion that we move away from the quite frankly bloody awful syntax of C++ – or perhaps the pre-historic C – is greeted with disdain and smirks.
“But it’s so much faster in C++” you’ll hear them whine from their wattle and daub huts, while wind whistles through the gaps in their pre-Spinning Jenny clothing, and one of them tries to light a fire with a couple of pieces of flint.
Well, you know what? Who cares? We live or die by getting a game out under budget and making damn sure it’s fun to play. And how do you make it fun to play? You iterate, and you iterate as fast you can. No one cares if you’re running at 30 or 60fps if you game is shit. Frankly I’d rather a game had half as many polygons and was twice as fun or had twice as much to do.
We’ve finally got hardware that is powerful enough for us to use a real programming language. That’s right I said a real one! One which can work out what type the variable is without me telling it, and if I change my mind later on, well then it can figure that out too. A programming language in which I can write a readable and meaningful piece of code in a tweet!
We’ve got to this stage after years of late nights and early mornings, fighting against intractible memory-stomping bugs with no harness to catch us if the change I put in a 3am this morning caused more problems than it solved.
And now you think I should be using C!
Actually no please don’t. Come here, I’ve got a job for you. You can sit over there and write this bit of the code, that’s it, yep, the graphics layer, and then if you can just hook it up to this Lua VM we’ll take over from there. Thanks.
I’ll share my dream.
I dream of a game team, united in harmony working on a platform with adequate memory and several processors fast enough to push all my data around. I dream of a small dark corner on this game team, where the C++ coders live, their brows furrowed and knotted as they sweat over why the stack is corrupted, and sword-fight while waiting for their 10 minute compile to complete so that they can check why that bug they fixed last week is still occuring. I dream of golden happy place where the rest of the team live, programmers, designers, hell even artists tapping away at their keyboards, iterating on ideas in seconds, safe in the knowledge that if they make a mistake the ample test harness will warn them before the code even reaches the stable branch.
A man can dream.
Dave Evans is founder of Code Amplifier and co-founder of ground-breaking new project. He is prone to hyperbole and winding up C and C++ programmers. He doesn’t necessarily agree with everything in the post above and he’s probably not as facetious as he sounds.