Criminal Code: The Procedural Logic of Crime in Videogames

Criminal Code[This is the text of my second talk at the 2011 MLA convention in Los Angeles, for a panel on “Close Reading the Digital.” My talk was accompanied by a Prezi “Zooming” presentation, which I have replicated here with still images (the original slideshow is at the end of this post). In 15 minutes I could only gesture toward some of the broader historical and cultural meanings that resonate outward from code—but I am pursuing this project further and I welcome your thoughts and questions.]

New media critics such as Nick Montfort and Matthew Kirschenbaum have observed that a certain “screen essentialism” pervades new media studies, in which the “digital event on the screen,” as Kirschenbaum puts it (Kirschenbaum 4), becomes the sole object of study at the expense of the underlying computer code, the hardware, the storage devices, and even the non-digital inputs and outputs that make the digital object possible in the first place. There are a number of ways to remedy this essentialism, and the approach that I want to focus on today is the close reading of code.

Micropolis on the Screen

Frederich Kittler has said that code is the only language that does what it says. But the close reading of code insists that code not only does what it says, it says things it does not do. Like any language, code operates on a literal plane—literal to the machine, that is—but it also operates on an evocative plane, rife with gaps, idiosyncrasies, and suggestive traces of its context. And the more the language emphasizes human legibility (for example, a high-level language like BASIC or Inform 7), the greater the chance that there’s some slippage in the code that is readable by the machine one way and readable by scholars and critics in another.

Today I want to close read some snippets of code from Micropolis, the open-source version of SimCity that was included on the Linux-based XO computers in the One Laptop per Child program.


Designed by the legendary Will Wright, SimCity was released by Maxis in 1989 on the Commodore 64, and it was the first of many popular Sim games, such as SimAnt and SimFarm, not to mention the enduring SimCity series of games—that were ported to dozens of platforms, from DOS to the iPad. Electronic Arts owns the rights to the SimCity brand, and in 2008, EA released the source code of the original game into the wild under a GPL License—a General Public License. EA prohibited any resulting branch of the game from using the SimCity name, so the developers, led by Don Hopkins, called it Micropolis, which was in fact Wright’s original name for his city simulation.

MicropolisFrom the beginning, SimCity was criticized for presenting a naive vision of urban planning, if not an altogether egregious one. I don’t need to rehearse all those critiques here, but they boil down to what Ian Bogost calls the procedural rhetoric of the game. By procedural rhetoric, Bogost simply means the implicit or explicit argument a computer model makes. Rather than using words like a book, or images like a film, a game “makes a claim about how something works by modeling its processes” (Bogost, “The Proceduralist Style“).

In the case of SimCity, I want to explore a particularly rich site of embedded procedural rhetoric—the procedural rhetoric of crime. I’m hardly the first to think about the way SimCity or Micropolis models crime. Again, these criticisms date back to the nineties. And as recently as 2007, the legendary computer scientist Alan Kay called SimCity a “pernicious…black box,” full of assumptions and “somewhat arbitrary knowledge” that can’t be questioned or changed (Kay).

The Black Box

Kay goes on to illustrate his point using the example of crime in SimCity. SimCity, Kay notes, “gets the players to discover that the way to counter rising crime is to put in more police stations.” Of all the possible options in the real world—increasing funding for education, creating jobs, and so on—it’s the presence of the police that lowers crime in SimCity. That is the procedural rhetoric of the game.

And it doesn’t take long for players to figure it out. In fact, the original manual itself tells the player that “Police Departments lower the crime rate in the surrounding area. This in turn raises property values.”

SimCity Manual on Crime

It’s one thing for the manual to propose a relationship between crime, property values, and law enforcement, but quite another for the player to see that relationship enacted within the simulation. Players have to get a feel for it on their own as they play the game. The goal of the simulation, then, is not so much to win the game as it is to uncover what Lev Manovich calls the “hidden logic” of the game (Manovich 222). A player’s success in a simulation hinges upon discovering the algorithm underlying the game.

But, if the manual describes the model to us and players can discover it for themselves through gameplay, then what’s the value of looking at the code of the game. Why bother? What can it tell us that playing the game cannot?

Before I go any further, I want to be clear: I am not a programmer. I couldn’t code my way out of a paper bag. And this leads me to a crucial point I’d like to make today: you don’t have to be a coder to talk about code. Anybody can talk about code. Anybody can close read code. But you do need to develop some degree of what Michael Mateas has called “procedural literacy” (Mateas 1).

Let’s look at a piece of code from Micropolis and practice procedural literacy. This is a snippet from span.cpp, one of the many sub-programs called by the core Micropolis engine.


It’s written in C++, one of the most common middle-level programming languages—Firefox is written in C++, for example, as well as Photoshop, and nearly every Microsoft product. By paying attention to variable names, even a non-programmer might be able to discern that this code scans the player’s city map and calculates a number of critical statistics: population density, the likelihood of fire, pollution, land value, and the function that originally interested me in Micropolis,a neighborhood’s crime rate.

This specific calculation appears in lines 413-424. We start off with the crime rate variable Z at a baseline of 128, which is not as random at it seems, being exactly half of 256, the highest 8-bit binary value available on the original SimCity platform, the 8-bit Commodore 64.

Z Variable

128 is the baseline and the crime rate either goes up or down from there. The land value variable is subtracted from Z, and then the population density is added to Z:

Z and PopulationWhile the number of police stations lowers Z.Z and Police Stations

It’s just as the manual said: crime is a function of population density, land value, and police stations, and a strict function at that. But the code makes visible nuances that are absent from the manual’s pithy description of crime rates. For example, land that has no value—land that hasn’t been built upon or utilized in your city—has no crime rate. This shows up in lines 433-434:

Crime Rate Zero

Also, because of this strict algorithm, there is no chance of a neighborhood existing outside of this model. The algorithm is, in Jeremy Douglass’s words when he saw this code, “absolutely deterministic.” A populous neighborhood with little police presence can never be crime free. Land value is likewise reduced to set formula, seen in this equation in lines 264-271:

Land Value in Micropolis

Essentially these lines tell us that land value is a function of the property’s distance from the city center, the type of terrain, the nearby pollution, and the crime rate. Again, though, players will likely discover this for themselves, even if they don’t read the manual, which spells out the formula, explicitly telling us that “the land value of an area is based on terrain, accessibility, pollution, and distance to downtown.”

Land Value in SimCity

So there’s an interesting puzzle I’m trying to get at here. How does looking at the code teach us something new? If the manual describes the process, and the game enacts it, what does exploring the code do?

I think back to Sherry Turkle’s now classic work, Life on the Screen, about the relationship between identity formation and what we would now call social media. Turkle spends a great deal of time talking about what she calls, in a Baudrillardian fashion, the “seduction of the simulation.” And by simulations Turkle has in mind exactly what I’m talking about here, the Maxis games like SimCity, SimLife, and SimAnt that were so popular 15 years ago.

Turkle suggests that players can, on the one hand, surrender themselves totally to the simulation, openly accepting whatever processes are modeled within. On the other hand, players can reject the simulation entirely—what Turkle calls “simulation denial.” These are stark opposites, and our reaction to simulations obviously need not be entirely one or the other.


There’s a third alternative Turkle proposes: understanding the simulation, exploring its assumptions, both procedural and cultural (Turkle 71-72).

Understand the Simulation

I’d argue that the close reading of code adds a fourth possibility, a fourth response to a simulation. Instead of surrendering to it, or rejecting it, or understanding it, we can deconstruct it. Take it apart. Open up the black box. See all the pieces and how they fit together. Even tweak the code ourselves and recompile it with our own algorithms inside.

Seeing the Parts of the Simulation

When we crack open the code like this, we may well find surprises that playing the game or reading the manual will not tell us. Remember, code does what it says, but it also says things it does not do. Let’s consider the code for a file called disasters.cpp. Anyone with a passing familiarity with SimCity might be able to guess what a file called disasters.cpp does. It’s the routine that determines which random disasters will strike your city. The entire 408 line routine is worth looking at, but what I’ll draw your attention to is the section that begins at line 109, where the probability of the different possible disasters appears:


In the midst of rather generic biblical disasters (you see here there’s a 22% chance of a fire, and a 22% chance of a flood), there is a startling excision of code, the trace of which is only visible in the programmer’s comments. In the original SimCity there was a 1 out of 9 chance that an airplane would crash into the city. After 9/11 this disaster was removed from the code at the request Electronic Arts.

Disasters Closeup

Playing Micropolis, say perhaps as one of the children in the OLPC program, this erasure is something we’d never notice. And we’d never notice because the machine doesn’t notice—it stands outside the procedural rhetoric of the game. It’s only visible when we read the code. And then, it pops, even to non-programmers. We could raise any number of questions about this decision to elide 9/11. There are questions, for example, about the way the code is commented. None of the other disasters have any kind of contextual, historically-rooted comments, the effect of which is that the other disasters are naturalized—even the human-made disasters like Godzilla-like monster that terrorizes an over-polluted city.

There are questions about the relationship between simulation, disaster, and history that call to mind Don DeLillo’s White Noise, where one character tells another, “The more we rehearse disaster, the safer we’ll be from the real thing…..There is no substitute for a planned simulation” (196).

And finally there are questions about corporate influence and censorship—was EA’s request to remove the airplane crash really a request, or more of a condition? How does this relate to EA’s more recent decision in October of 2010 to remove the Taliban from its most recent version of Medal of Honor? If you don’t know, a controversy erupted last fall when word leaked out that Medal of Honor players would be able to assume the role of the Taliban in the multiplayer game. After weeks of holding out, EA ended up changing all references to the Taliban to the unimaginative “Opposing Force.” So at least twice, EA, and by proxy, the videogame industry in general, has erased history, making it more palatable, or as a cynic might see it, more marketable.

I want to close by circling back to Michael Mateas’s idea of procedural literacy. My commitment to critical code studies is ultimately pedagogical as much as it is methodological. I’m interested in how we can teach everyday people, and in particular, nonprogramming undergraduate students, procedural literacy. I think these pieces of code from Micropolis make excellent material for novices, and in fact, I do have my videogame studies students dig around in this source code. Most of them have never programmed, let alone in C++, so I give them some prompts to get them started.

Prompts for Students

And for you today, here in the audience, I have similar questions, about the snippets of code that I showed, but also questions more generally about close reading digital objects. What other approaches are worth taking? What other games, simulations, or applications have the source available for study, and what might you want to look at with those programs? And finally, what are the limits of reading code from a humanist perspective?


Bogost, Ian. “Persuasive Games: The Proceduralist Style.” Gamasutra 21 Jan 2009. Web. 1 Feb 2009. <>.

DeLillo, Don. White Noise. Penguin, 1985. Print.

Kay, Alan. “Discussion with Alan Kay about Visual Programming.” Don Hopkins 16 Nov 2007. Web. 30 Dec 2010. <>.

Kirschenbaum, Matthew. Mechanisms: New Media and the Forensic Imagination. Cambridge Mass.: MIT Press, 2008. Print.

Manovich, Lev. The Language of New Media. Cambridge: MIT Press, 2001. Print.

Mateas, Michael. “Procedural Literacy: Educating the New Media Practitioner.” Beyond Fun. 2008. 67–83. Print.

Montfort, Nick. “Continuous Paper: The Early Materiality and Workings of Electronic Literature.” Philadelphia, PA, 2004. <http: //>.

Turkle, Sherry. Life on the Screen: Identity in the Age of the Internet. New York: Simon & Schuster, 1995. Print.

Image Credits

(1) Greco, Roberto. SimCity. 2008. Web. 4 Jan 2011. <>.

(2) Wright, Will. SimCity. Maxis, 1989. Manual.

(3) Goldberg, Ken, and Bob Farzin. Dislocation of Intimacy. 1998. San Jose Museum of Art. Web. 14 Jan 2011. <>.

All other images created by the author.

Original Presentation

20 thoughts on “Criminal Code: The Procedural Logic of Crime in Videogames

  1. […] Mark Sample, a professor of Contemporary American Literature and New Media Studies in the English Department at George Mason University, in Fairfax, Virginia, has posted his interesting 2010 MLA talk on deconstructing code in analyzing computer games. […]

  2. Great stuff. Seeing the kind of things we can do with the actual code of a game is fantastic. With that said I think we can (to some extent) read the code without reading the code.

    To respond to a specific point: You suggested, “I’d argue that the close reading of code adds a fourth possibility, a fourth response to a simulation. Instead of surrendering to it, or rejecting it, or understanding it, we can deconstruct it.”

    I would argue that playing a simulation game (in particularly playing at any significant difficulty level) necessarily entails deconstructing it. As you play the game you develop theories about the code, about the model the game constructs. As you play you test those theories and in the process you do more than understand the model. The further you go the more you start to actually reconstruct and critique the code.

    This actually goes to crazy levels with games like World of Warcraft. See Kenco’s research on threat. For reference, his opening is amazing.

    “It’s often said that we will never be able to work out the way threat and hate lists and mobs’ AI works, because it’s too complicated and unknowable, that we’ll only ever have crude approximations and guesses. I’ve conducted some decent, rigorous tests, and i have what i believe is a good list of hate values and explanations of gaining and losing aggro and the behaviour of taunt. I am also able to debunk a few myths about how threat works.”

    TLDR: Yes, reading code is great and we can learn a lot from it, but I think there is a lot of deconstruction that goes on without actually seeing the code.

  3. Hello Mark(?),

    I wrote and still update the Programmer’s Guide to Inform 7. Working with some of the writers and such in the int fic community has raised my own awareness for how sad it is that most programmers’ work goes unappreciated. Any idiot can have an opinion on the music or movie or essay someone created, but not on code. Programming can be an even more lonely occupation than a novel writer’s.

    That said, here’s a few tidbits I’ve discovered elsewhere you may find interesting. (Also, I second what CdrJameson just said.)

    I’ve disassembled a few Colecovision and first-gen NES games, when they were written in assembly directly. In those environments you can learn something about the programmers themselves. For example, in one I found this line of code:

    $C0ED JMP $C0ED

    Which if you can read that, it’s an infinite loop. Placed at memory location C0ED (hexadecimal), it’s a GOTO line that JuMPs to itself. Pointless code, but an in-joke, if you know anything about co-ed colleges and humor.

    In another example: every game has a “main loop” which is where it and the player spend 99% of the time. In assembly it’s helpful to place the main loop’s start at a memory location that’s easy to remember — such as $F1FA. Which, if you can read l33t-speak, is the acronym for the Fédération Internationale de Football Association, the international soccer organization.


  4. […] The code is the next layer of the model. It’s the software the realizes the game, and it’s often dependent on the platform underneath. Think of how some older Mac software no longer runs on recent MacBook Pros. The problem is due primarily to Apple’s shift from PowerPC microprocessors to Intel processors; the Intel chips have a different architecture, which can break code designed for the PowerPC chips. Examining code—whether functional or not—can lead to a greater understanding of games, a point I’ve tried to demonstrate on Play the Past and elsewhere. […]

Comments are closed.