Experienced Points

Experienced Points
The Language of Game Development

Shamus Young | 13 May 2014 15:00
Experienced Points - RSS 2.0
Experienced Points Game Development

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.

Comments on