I often get asked, “I’m looking to get into game development. What programming language should I learn?” This question has always troubled me a bit. First of all, it’s sort of ambiguous: Are you asking what language you should learn in order to develop a game, or are you asking what language is a good starting language?
But let’s back up. Computer science is a weird science because it’s a very young science. (Also because most stuff labeled “computer science” isn’t science.) When I was a teenager in the 80’s, we were still trying to figure out where this branch belonged on the great tree of human knowledge. Was it the domain of mathematics, where it was mostly invented? Or was it the domain of business and engineering, where it was actually used? In my day they frequently had ridiculously easy programming courses (stuff we would teach to children or middle school students today) locked behind advanced math courses like trigonometry and calculus. While most of that nonsense has been smoothed over, we’re still seeing situations where people can’t figure out what computer science is and how it should be taught.
The field keeps growing. New languages are invented. Computers are finding their way into just about every career as we find new ways to use the dang things. So rather than telling you to go out and learn one specific language, let me explain why this question is so difficult when it comes to game development.
There are a bunch of tradeoffs when you invent a new computer language. At one extreme end of the spectrum you have the lowest-level languages. These are languages where you have very fine-detailed control over the computer. Since no technical article is complete without a Terrible Car Analogy, imagine driving directions that say:
Depress gas pedal 10%. Turn wheel 10° to the right. Traverse 5 meters. Turn wheel 10° to the left. Depress gas pedal 15%. Traverse 100 meters. Release gas pedal. Depress brake pedal 25%.
Using this, the directions to go anywhere would be novel-sized. It would be hard to understand where you’re going just by reading them. On the other hand, maybe you could use a higher-level programming language:
Turn right onto Main St. Turn left on Smith St. Get onto Highway 17.
That’s a lot easier to write, easier to read, and easier to figure out where you’re going. Then again, sometimes even this level of detail is overkill. Sometimes the only direction you need is:
Take me to the mall.
In programming, those tricky and cumbersome lower-level languages are massively faster and more efficient than the easy and clear higher-level ones. If you want your program to run really fast or if you need to make sure you’re not wasting memory, then you really do need to crawl down in there and do things the hard way. On the other hand, doing things the hard way is slow and expensive and it’s really hard to re-use the code from one project to the next.
The problem with game development is that you kind of need both. John Carmack famously stood in front of a group of NASA personnel and told them that modern game development is more complex than rocket science. (And to be clear, Carmack has done both.) We need speed. We need all the speed we can get. But at the same time, some of this stuff is just too complex and we can’t afford to build everything in those annoying low-level languages.
The key here is that we don’t need speed everywhere. We need speed way down in the guts of the graphics engine. We need speed when we’re doing physics simulation. We need speed when we’re playing video files. (Which is becoming less of a thing these days anyway.) But when we’re just counting hitpoints, spawning bad guys, keeping score, navigating menus, awarding achievements, and tracking inventory? That stuff is computationally trivial and lightweight. You can do that in any language.
You can see this divide in a lot of the major game engines like Unity, CryEngine, Unreal, and every id Software engine since 1996. They are all written in low-level languages, but they have these high-level scripting languages bolted on so you can write clear and (one hopes) readable gameplay code while still having the core of the engine optimized for speed.
Which brings us back to the original question:
“What programming language should I learn?”
I’m a C++ programmer. (For the purposes of this discussion, I’m not going to draw a distinction between C and C++. I do both, but difference isn’t important here.) The language is the backbone of modern game development. But being the backbone doesn’t mean it’s the most interesting, rewarding, or expedient. It’s what operating systems are written in. It’s what drivers are written in. It’s what big-time graphics engines are written in. It’s very fast, very powerful, and an absolutely terrible place to begin learning programming. As our machines get faster and faster, we need C++ less and less. As much as I like C++, I can see it’s on the way out. It’s not going extinct or anything. (At least, not in my lifetime.) But it’s becoming a less critical part of a growing whole. AAA studios are limiting what gets done in C++, and indies are actively avoiding it.
My advice is this: Do NOT start with C++. If you want to know where to start, I suggest Python. I don’t know it myself, but the conventional wisdom is that it’s a really good place to go to learn to type some stuff and have something interesting happen. I spent an hour with it last year, and it did live up to its reputation as something you could pick up without needing to bog yourself down with a bunch of arbitrary rules and programming theory first.
But before you go running off to earn your black-belt in writing code, maybe stop and ask yourself what it is that attracts you to game development. It’s just one of many, many jobs in the industry. If you just want to design games – like, you enjoy coming up with gameplay systems and rules – then there are a lot of roads that lead there. Artistic and management jobs can land you at the head of a team just as easily as a programming position. Maybe even easier.
If you’re young, don’t sweat it. Try lots of stuff. See what’s fun. Don’t wait to take a class on it. Classes are great, but don’t limit yourself to what adults can teach you because a lot of the most relevant stuff hasn’t been turned into curriculum yet. Just hit Google and see what’s out there. Try making some mods for existing games. (Skyrim and Valve games are both decent places to start.) Try making models or textures. Even if you come back to programming, you will be enriched if you understand what artists want and need when they’re doing their job. Far too many young people make the mistake of selecting their major and then seeing if it suits them. Experiment as much as you can.
One final note: you shouldn’t see programming as this distant, mysterious, and esoteric body of knowledge. Movies tend to elevate technical people to the status of space-wizards. But just because knowledge isn’t widely known doesn’t mean it’s hard to learn. Don’t get caught in the trap of thinking, “I’m just a regular person. I could never do that.” The secret is that we’re all just regular people. Programmers are not strange aliens with gigantic pulsating distended brains. We’re just oddballs who enjoy this stuff. If you enjoy it – or if it sounds like you would enjoy it – then you have the most important thing: You have passion. Go for it.
Shamus Young is the guy behind Twenty Sided, Spoiler Warning, and How I Learned.