John Carmack: Script Interpreters Considered Harmful
The most interesting part of John Carmack's keynote at QuakeCon this year wasn't the stuff on megatextures or static code analysis. It was his assertion, right around the 1:07:32 mark, that script interpreters are evil. Well, as evil as it's possible for a script interpreter to be. Which is still pretty evil.
And I quote:
One of the lessons that we took away from Doom 3 was that script interpreters are bad, from a performance, debugging, development standpoint. It's kind of that argument "oh but you want a free-form dynamically typed language here so you can do all of your quick, flexible stuff, and people that aren't really programmers can do this stuff", but you know one of the big lessons of a big project is you don't want people that aren't really programmers programming, you'll suffer for it!
But one of the things that we did is—because the other side of it is also performance—you'd think that with our million-times faster systems that, it's like "ah, scripting some things, performance should be a non-issue." And it's striking almost how much that isn't the case. In the last month of Rage's development we're taking some of our Flash GUI stuff and converting it to C++ because the interpreter for doing the ActionScript stuff in the GUI is taking multiple milliseconds sometimes. Even with all of our wealth of processing power, we still don't have enough performance; performance still matters.
This is a strong statement for a guy with Carmack's reputation and influence. Hundreds of modern games use lightweight scripting languages like ActionScript or Lua to handle things like scripted NPC encounters or environmental events. Carmack's most successful game of all time (Doom 3, by the numbers) employed over half a million lines of scripting for the in-game computer terminals alone!
According to the Doom 3 manual, GUI designer Patrick Duffy wrote over 500,000 lines of script code, and generated more than 25,000 image files to create all of the graphical interfaces, computer screens, and displays throughout Doom 3.[49] Other important features of the game engine are normal mapping and specular highlighting of textures, realistic handling of object physics, dynamic, ambient soundtrack, and multi-channel sound.
If those figures are accurate, no wonder Carmack thinks script interpreters are evil. In-game "toy user interfaces"—like this one from Fallout 3—

—probably shouldn't consume more lines of code than certain early builds of the entire Unix operating system. While a little scripting goes a long way, scripting languages weren't really designed for large-scale development efforts involving millions of lines of code. They typically lack the code-reuse abstractions and development toolsets, not to mention the runtime characteristics, that make large-scale development feasible. Anyway, hopefully when the Doom 3 source code is released we'll get a chance to dig in and see what's what.
Use the form below to leave a comment.
- Of Gravatars and Robohashes
- Optimizing VP$IP
- A Question of VP$IP
- John Carmack: Script Interpreters Considered Harmful
- Movie Doppelgangers: B-Movie Ripoffs of Hollywood Blockbusters
- BROWSE ALL POSTS
Subscribe to Coding the Wheel over email or through any RSS reader. Coding the Wheel has been published since 2008.
- How I Built a Working Online Poker Bot, Part 1, 2, 3, 4, 5, 6, 7, 8
- Summoning the Harry Potter MMORPG
- Are Commercial Databases Worth It?
- 21 and the Monty Hall Paradox
- Summoning the Harry Potter MMORPG (1615)
Anonymous wrote: I can't wait to play this game! When are ya gonna make it? :) - The Programming Aphorisms of Strunk and White (96)
miv wrote: Little did I know true composition requires a lot of work and creativity. The basic English class ... - The Great Poker Hand Evaluator Roundup (104)
totolemuto wrote: I am writing mine. Sure to beat everyone ! - The Programming Aphorisms of Strunk and White (96)
preisvergleich hundehaftpflicht wrote: I harmonise with your conclusions and will thirstily look forward to your next updates. Just saying ... - Summoning the Harry Potter MMORPG (1615)
chaz wrote: !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!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! - Multiway Isometric Ranged Equity Calculation in Poker, Part 1 (93)
Alex B. wrote: Hello guys. First, thanks a lot for sharing this code. Unfortunatly, I would like to use it in the VB.net ... - Summoning the Harry Potter MMORPG (1615)
Tekken9 wrote: Nice to see you again here. - Summoning the Harry Potter MMORPG (1615)
Benjy wrote: Man, I've been here since April '09 and still no word - 21 and the Monty Hall Paradox (115)
Anonymous wrote: I know this is old.. but I have your answer right here... the game IS and WILL ALWAYS be 50%.. even with ... - Summoning the Harry Potter MMORPG (1615)
Tekken9 wrote: @hpotter66 If you mean in-game, we've talked about this before, we've said that it should ... - Summoning the Harry Potter MMORPG (1615)
hpotter66 wrote: if you did join, is there any way you could make yourself an important character, like madeye? ... - Summoning the Harry Potter MMORPG (1615)
hpotter66 wrote: me need hpmmorpg. its so awesome im gonna die!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! ... - Summoning the Harry Potter MMORPG (1615)
Tekken9 wrote: @the big one: As far as I know no one has begun any development so far ona game like this, everyone knows ... - Summoning the Harry Potter MMORPG (1615)
MMOADDICT wrote: yeah the real Daniel Radcliff trolls forums on possible harry potter games and mythos just like the ... - Summoning the Harry Potter MMORPG (1615)
Antoxifysu wrote: Your blog is superb Ozz and your motivation is remarkable! Thank you for your signatures and made ... - Summoning the Harry Potter MMORPG (1615)
the big one wrote: my qweston stell stands have you even begon to develop eany part of the game yet that wold at lest progress ... - Summoning the Harry Potter MMORPG (1615)
Ozz wrote: I really like this article. A Harry Potter MMORPG is something I'd love to see happen and would ... - Summoning the Harry Potter MMORPG (1615)
Ozz wrote: I really like this article. A Harry Potter MMORPG is something I'd love to see happen and would ... - The Coin Flip: A Fundamentally Unfair Proposition? (99)
Sam wrote: I love science such as this, but the science I love the most is the science of martial arts. That is why ...

30 comment(s)
Am quite looking forward to the Doom 3 source code release. My expertise isn't in gaming but getting a chance to peek under the hood of a commercial mass market game will be a learning experience to say the least. If they ever do it that is. This isn't the 1st time Carmack has promised "teh source codez". Holding my breath...
FWIW most of Firefox's UI and suck is written in JS and it is a rather large project...
Excuse me... I may not have read you correctly here, but, did you mention ActionScript as a LIGHTWEIGHT language? Fuck you. Really. Lua is lightweight, but ActionScript DEFINITELY IS NOT.
Lua is way faster than ActionScript (even without using LuaJIT, which is many times faster again), and Flash uses software rendering to draw GUIs. There are lots of reasons you wouldn't want to use Flash in a game.
Lua is used in hundreds of games because it IS really fast, and you can use whatever abstractions you want in it. It's a really powerful and flexible language. People can abuse it, but you can also write extremely elegant code that executes nearly as fast as C/C++.
So rather than "scripting languages are evil," the only real take-away here is the Flash sucks. Which all real game programmers knew already (likely Carmack included, though he seems to have underestimated the degree of suck).
@Markus: the comparison is to C or C++ so yes, ActionScript is lightweight.
Uhm, Carmack promised code a lot of times and delivered. Not his fault that the engine is still being licensed for very recent games and there being some legal hold-ups until now with the D3 one.
And that is precisely the reason why the browser performs with the zeal of an overfed, paraplegic cow.
Woah here come the Flash-suck-trolls... AS, LUA whatever: Carmack's problem is that these are not good-enough scripting languages because he didn't write their VM himself and he can't use static code analysis tools & stuff to be sure code is optimal.
For what is worth games usually use ScaleForm which is a runtime somewhat compatible with Flash but nothing really like Flash Player - also it's coded in AS2 which, like LUA and unlike AS3, isn't strongly and doesn't offer any code analysis tools.
LUA = Lua Uppercase Accident?
Lua is strongly-typed. You probably mean statically typed?
Personally I'm surprised to hear such a broad statement from Carmack. A number of interpreted languages - namely those with a good JIT - are very close to the performance level of C++ now. LuaJIT in particular is pretty amazing and others are getting better like Pypy (and hopefully someday Rubinius or something). It's true though that execution speed can be somewhat inconsistent and difficult to predict, though.
He also mentions two important things:
Strip down C++ dialect: yes please.
"They typically lack the code-reuse abstractions and development toolsets, not to mention the runtime characteristics, that make large-scale development feasible."
This statement is false. Counterexample is Python, which has all of the above.
Which is why we said "typically". So that somebody would come along and pretend we didn't say typically, when we did. Typically means "often but not always". Typically allows for counterexamples like Python and PHP. Which have more in common with large-scale development languages like C#, C++, and Java than they do with ActionScript or Lua anyway.
Guys. We should view his statements in the context: big game projects. It's not hard to imagine that breadth and duration of the project minimizing benefits of script languages and maximizing management cost.
Keep in mind that JC's idea of a "scripting" language is interpreted subsets of c and c++. To my mind, it's extremely likely such languages will end up with the worst of both, vs using something like lua.
Ugh.
Let's break this down:
1) Doom 3 was essentially "pop in a box" that relied heavily on scripted events to provide "tension / fear" and "game play". Oh.. I've opened an "object" or used an "object" ... what are the chances that you just scripted a pop up spawn behind me? HEAVY. The real issue isn't language, it is engine constraints. We get that modern games have moved from Doom open maps to Black-Ops "scripted events along a pretty tunnel" but... Both are doing it wrong, and need to die out.
Comment - this isn't a problem with the language, this is a problem with design.
2) LUA. LUA is fucking magic pixie land if you know what you're doing. LUA was first used in games and now is being used in... Oh. Ok. If you're reading this, you should be educated, and in touch, right? Then go find out which companies are using LUA for non-games, then come back with your tails between your legs. [Disclosure - used LUA in its infancy, and saw the potential right away].
Comment: A decent GUI engine + pre-made LUA scripts CAN allow non-coders to make games. Fact. Proof? Hmm.. $500mil+ in sales says I'm right.
3) At some point, the 90's cease to matter. As do the 00's. It is 2011 now. Carmack hasn't produced a groundbreaking game / engine in ... 10+ years. He looks like a meth addict. Why are you still listening to a person who personally did DaiKatana, and Doom III was a flop? Remind me why he's relevant now? Unreal Engine kinda won the battle (along the lines of "Oasis vrs Blur" in the 90's)
Comment: Stop crying, make a decent game this decade. I dare you. OH....
Disclosure: Anachronox was the best game ID never made. If you've not played it, then GTFO and don't bother commenting.
p.s.
Your code is fracking insane. Correct tags => insane issues. Blog is retarded. Grats.
Third try now. Nice to know that "modern" blogs not only badly format proper HTML, but also rape to death < and > etc etc.
/fail
I'd say he looks like an otherwise healthy guy who doesn't get a lot of sun. (Programming, ever heard of it?)
I've been following this site for about a year and you sir have a way of phrasing things that polarizes people. Sometimes this is a good thing, sometimes a bad thing, but I've seen far worse writers get far more praise and take a lot less flack. Not one tech writer out there bothered to listen to the keynote in its entirety or they would've been all over this. If they did listen, they didn't know enough about programming to understand why the quote you isolated would be interesting to a programmer. Thanks for a great little discussion and for whetting my interest in game programming for a 2nd time.
Christ people, the title is a reference to GOTO Considered Harmful a famous opinion paper by Dijkstra. He's not actually saying that script interpreters are harmful what are they teaching you kids in CS these days? http://en.wikipedia.org/wiki/Considered_harmful
This guy is so overcome by his celebrity, he believes his own BS. You are better off using programmers to code games. Deep! We needed that bit of arcane wisdom.
Notice how he has a really, really bad case of console envy. Instead of producing a decent follow up to the DOOM franchise, he is working on a console like rail shooter type game.
When they dispense with the creatives, i.e. writers for storyline and plot development, you basically get console tunnel creeps like Rage sounds more and more like it is going to be.
You are probably misinterpreting what Carmack said. I saw it a while ago and I remember him saying in "in retrospect" and "what we learned is" several times.
This time is about what he thinks now. Not about what they did it in the past. It's a talk about if you had to do it again, how differently would you do it. And he even mentioned "contraints", "small teams".
Listen to a bunch of people who couldn't build a 2D asteroids criticize the man who singlehandedly invented modern FPSes...seriously...what have you guys ever built?
Hmm
@Jason You don't actually know who you're talking about, do you? Carmack never touched Daikatana. That whole post was embarrassing...
You actually don't have to wait until the Doom 3 source code is released to see "what's what," the source code to the entire scripting system is in the gamecode, which means you can grab the Doom 3 SDK and look at it right now.
this is a very good text!
Really the article is spreading its wings rapidly Great posting dear, really thanks
your blog is awesome
for a few minutes. When Putnam came up to his party he said "we drive them." Now let it be
Thanks so much for this wonderful website;this is the kind of thing that keeps me on paroxetine dosage track through these day.