Programming in Assembly Is Brutal, Beautiful, and Maybe Even a Path to Better AI

Roller Coaster Tycoon wasn’t the hottest video game of 1999. But if you peered beneath the pixels—the rickety rides, the crowds of hungry, thirsty, vomiting people (and the janitors cleaning up in their wake)—deep within the code, you saw a craftsmanship so obsessive that it bordered on insanity. Chris Sawyer, the game’s sole developer, wrote everything in assembly.
Some programming languages, like Python, Go, or C++, are called “high-level” because they function much like a human language, written in commands and idioms that could fit into a poetry slam. Generally speaking, software such as a compiler turns this into what the machine actually reads: blocks of 1s and 0s (or perhaps hexadecimals) that tell the actual transistors how to behave. Assembly, the lowest of the “low levels” language, has an almost one-to-one correspondence with the native language of the machine. This is direct-to-metal coding. Building a complex computer game from assembly is like weaving a tapestry from stray cat fur.
Why would anyone do that? I recently asked Sawyer, who lives in his native Scotland. He told me that efficiency was one of the reasons. In the 1990s, not all of the tools needed for high-level programming were available. The compilers were terribly slow. The debuggers sucked. Sawyer could avoid them by doing his own x86 assembly work, the lingua franca of Intel chips.
But we both knew that wasn’t the real reason. The real reason was love. Before turning to roller coasters, Sawyer had written another assembly game, Transportation magnate. It puts players in charge of a city’s roads, train stations, tracks, and ports. I imagined Sawyer as a model train enthusiast, laying each section of track, hand-sewing artificial turf, every detail a choice and a chore. To move these carefully designed pixels from bitmaps to the display, Sawyer had to exploit the full potential of the chip. “Roller Coaster Tycoon was born because I knew the limits of what was possible,” he told me.
Working within limits? A foreign idea, perhaps, in the age of digital abundance, when calling a single function in an AI training algorithm can involve a million GPUs. With assembly, you get one thing and one thing only, and that’s the thing you ask for – even, as many coders have learned the hard way, if it’s wrong. The assembly is brutal and beautiful that way. It forces you to say exactly what you mean.
I made some assemblies the creators are not doing any favors. They wanted things to be easier, not harder. I guess they got tired of loading punch cards and flipping switches on their steampunk leviathans. Perhaps they dreamed of a world like ours, where computers can do so much with so little guidance.



