Is ASM Really Dead?

I hear this question all the time: “I heard asm was dead. Do video games still use assembly code?”

The answer? No, but yes. Sometimes. Sorta. It depends.

Video game engines as a whole are not typically written in assembly code these days. They are written in many different languages, depending on the target platform. Many console games have the core of the engine written in a moderate to low level language such as C++, while enemy logic and level triggers are written in an easier to use scripting language such as Lua, or a game-specific scripting language. Other games, particularly PC casual games or mobile games, may be written using other tools such as Java or Flash.

However, although game engines as a whole are not typically written in assembly anymore it is not unusual–especially in C++ based game engines–to have very small amounts of assembly code in performance-critical functions. Some coin-op games also have small amounts of assembly code needed to access custom arcade hardware. From my personal experience, I can say that every major commercial game engine I have seen under the hood of has had at least a few lines of assembly code in it. However, with the exception of PlayStation 2 titles, the amount of assembly code was extremely nominal. PS2 titles required larger amounts of microcode–which is technically one step lower-level than assembly, but looks virtually identical–because of the way the vector units (co-processors) work. You can read a lot more about this if you search the gaming magazines on the web; look for the hardware notes on sites like IGN.

Ironically, despite the overall move to higher-level languages, the advent of programmable graphics hardware is introducing an entirely new generation of game programmers to assembly-style programming. Languages like HLSL will allow you to write good shaders without knowing shader assembly, but a surprising number of shader programs are written in asm. As you might expect, it’s a common tactic when performance is critical. However, the tools are rapidly improving, so I don’t know how long this will continue to be the case… I suppose it will continue to be true for only as long as developers feel they can gain a competitive advantage by doing so.

Or, until the next new chip-that-does-something-cool comes out and needs some low-level code to make it go. 🙂

Tags: , , , , , , , , , ,

One Response to “Is ASM Really Dead?”

  1. new hidden objects games Says:

    Stumbled on your site quite by accident, I’m glad I did. I’m always on the lookout for a new gaming resource and your site really fit the bill 🙂