A game in 2KB of code, 128 bytes of RAM, 8 million instructions per second, and 2 days
In high school I was obsessed with microcontrollers and old computer architectures. I designed, built, and wrote code for a couple of tiny computers during that time. Demomite was special because it was sort of the culmination of all of my prior tinkering. I was applying to colleges and wanted a project that would make me stand out. So I set out to design, build, and program a game console in as short a time as I could manage.
For the core I chose the ATTiny2313 processor from Atmel (now Microchip). I love AVR microprocessors because they are very simple but powerful. It's a RISC architecture so it's easy to hold in one's head and programming directly in assembly is straightforward. The 2313 in particular has some aspects that make it extra fun:
- 2 KB of flash for code
- 128 bytes of RAM
- An 8 MHz instruction clock
For a complete game console I decided I needed graphics and audio. So I added a screen stolen from a Nokia 3310 cell phone with a nice simple SPI interface and a small speaker taken out of a toy driven by a transistor connected to a single I/O pin. For controls I used a NES compatible controller (basically just a shift register).
It took a full day to develop the hardware, writing drivers and tests in assembly code as I went. On the second day I wrote the code for a game for the system.
For a while I had been playing around in Ruby on the PC writing a side-scrolling adventure game I called Miasmata. I thought the concept for that game fit the lofi aesthetic of my new console well, so I set out to develop a version of it as the first title for the Demomite.
In roughly 1700 lines of AVR assembly (check it out on GitHub) I made a little adventure game with tile-based graphics and an interrupt-based audio system. You play the role of someone exploring a wrecked world. You have strange abilities to corrupt the environment, but you are not sure if they give you the power to change circumstances for the better or just throw the world further into chaos.
Here's a sample of the 1 bit sound track (I'm not a musician...):
Here's what death sounded like:
To fit everything in I developed a quick prototype of the game in Ruby and some tools to compress assets like the map and graphics. Prototype game:
Here's what the level editor looked like:
So in the end it took 2 days to get through this project. I made a cringe-worthy video to link in my college applications that you can see below. Watch it on 2x speed for sanity. There's a timelapse of the build process in there which is interesting maybe.