Some people think the Atari is dead — that’s not true. Hell, even most of the consoles I’ve seen still work. But, surely, no one’s making new games for the Atari, right? Wrong — there’s an active community of programmers making new games. One of these games is Duck Attack! by Will Nicholes — available both as a downloadable ROM that can be run in an emulator like Stella, or as an actual cartridge via AtariAge. Will agreed to an interview about the ins and outs of programming for the Atari and his love of math and integer sequences. (It’s awesome, I swear!)
Part the First
Kittysneezes: At this moment in time, what is your favorite song?
Kittysneezes: What’s your favorite band that you don’t think a lot of people would have heard of?
Will Nicholes: Big Daddy, if Facebook is any indication. When it was converting everyone’s musical “likes” into links to artists, it didn’t know what to do with “Big Daddy.” It thought I was trying to “like” a John Mellencamp album.
Kittysneezes: What, if anything, is on any particular wall (your choice) in your domicile?
Will Nicholes: I think the most interesting wall at my place is the one with the framed Slow Wave art. I really love what Jesse Reklaw, the Slow Wave artist, does, and I was fortunate enough to get a couple of dreams drawn, so that makes an interesting conversation piece.
Kittysneezes: What’s the strangest thing you own?
Will Nicholes: Probably my USB rotary phone.
Kittysneezes: Of the things you’ve done, what’s your all-time favorite (however you want to interpret that, be it artistic works, actions, whatever)?
Will Nicholes: At the moment, I’d have to say Duck Attack! is my favorite. The experience of designing, coding and releasing a game has been such a thrill, it’s unlike anything I’ve done before.
Kittysneezes: Who’s your favorite visual artist (excluding yourself)?
Will Nicholes: Nathan Strum. The art he did for the Duck Attack! cartridge is just amazing. I was really fortunate to get to work with him.
Kittysneezes: What are the five most recent films you’ve seen?
Kittysneezes: What’re your top three movies?
Kittysneezes: Do you own any original artwork, and if so, whose?
Will Nicholes: Aside from the Slow Waves, I have a couple of pieces done by some old friends of mine.
Kittysneezes: What is your favorite game?
Will Nicholes: Chess, although I’m terrible at it.
Kittysneezes: If you could say one thing to David Byrne, what would it be?
Will Nicholes: Thanks for “And She Was.” I could listen to that song 20 times a day for a year and not get tired of it.
Kittysneezes: What are your five most favorite books in the world?
Will Nicholes: A Confederacy of Dunces, The Age of Spiritual Machines: When Computers Exceed Human Intelligence, Uncle Tungsten: Memories of a Chemical Boyhood, and two Douglas Adams books (can’t decide which two at the moment).
Kittysneezes: What is the most boring thing you’ve ever experienced?
Will Nicholes: A seven-hour conference call. The less said about that, the better.
Kittysneezes: If you could name a child anything in the world, what would it be?
Will Nicholes: I’m terrible at naming things. I still haven’t even come up with a satisfactory name for the characters in Duck Attack!, and I’ve tried.
Kittysneezes: What is your favorite meal?
Will Nicholes: A giant bowl of brown rice with cubed zucchini, thyme, basil, peanuts and chili oil, served with a cold Diet Dr. Pepper with no ice.
Kittysneezes: What is reality?
Part the Second
Kittysneezes: Where did you get the idea for Duck Attack! and how long did it take you to make?
Will Nicholes: My original idea was to hack some interesting objects into the game Adventure, like a hot-air balloon that would let you float above the walls. I did that, and then started thinking of more objects I could add, as well as some other gameplay changes. At that point, I figured I might as well design a game of my own. People had always made fun of the Adventure dragons for looking like ducks, so I thought, “you think those are ducks? I’LL show you ducks.” I settled on the “robot vs. giant, fire-breathing ducks” theme in 2009 and was able to (mostly) finish it the same year.
Kittysneezes: Why do you think the Atari has been such a successful console, even today?
Will Nicholes: It’s really fascinating how the primitive nature of the graphics system – you have to write one line to the TV at a time – ended up providing the 2600 with so much flexibility. Having to write each line means you get to re-write each line, which lets you create rows of unique aliens in Space Invaders, rows of dots (well, dashes) in Pac-Man, and all sorts of other configurations for games that hadn’t been thought of when the 2600 was designed. Either the designers were eerily prescient about what kinds of arcade games would be developed and need to be ported, or it was just an amazingly fortunate coincidence that the model they used would be able to be exploited for so many of the popular arcade games that followed.
Kittysneezes: The Atari only has 128 bytes of RAM in the console — how can you use such a small amount for a game?
Will Nicholes: That was the biggest challenge, but it was also a very fun challenge. Adventure, for example, lets you pick up and carry an object, like a sword or a key. It uses three bytes for that: one to describe what object you’re holding, one to indicate how far away it is vertically (so that when you move, the object moves with you) and one to indicate how far away it is horizontally. I wanted Duck Attack! to let you carry TWO objects, but I didn’t have 6 bytes to spare. So I limited the number of carry-able objects to 7, and the number of different ways you could carry it to 8 (above, above-and-to-the-left, etc.), and was able to cram the object-carry information for both objects into a byte and a half. There are a bunch of other places in the code I do similar things. Compared to Duck Attack!, the 70s-era Atari games spend RAM like a drunken sailor. But to be fair, I do have a lot more ROM to play with.
Kittysneezes: How much ROM did you have available for Duck Attack!?
Will Nicholes: I used 32 kilobytes. The original run of Atari-produced games ran from 2k in the early ones (Combat, Breakout) to 16k in the later ones (Dig Dug, Millipede). Many of the recent homebrews use 32k also, although some developers prefer to try to stay within the ROM constraints of the early games. Halo 2600, for example, uses 4k.
Kittysneezes: What does the code for an Atari game look like?
Will Nicholes: Very flat. It’s all in assembly language, so there aren’t any indented sections like you’d see in a higher-level language like C; just a long list of STAs, LDAs and other assembly-level opcodes. In the case of Duck Attack! it’s about 20,000 lines of code and graphics in a single text file. There’s a neat website that actually makes art out of Atari 2600 disassemblies. Duck Attack!‘s disassembly would probably look a lot like that.
Kittysneezes: How did you figure out how to do the larger sprites?
Will Nicholes: The 2600 is actually pretty flexible in what it lets you do with sprites; the trouble is, there’s only so much time you get to do anything with them. In a game like Pitfall!, the program updates the color and bitmap of the Pitfall Harry sprite each line (a “1-line kernel.”) What I wanted to do with the duck sprites was update the color, bitmap, width and horizontal position of the sprite each line, to cut down on some of the blockiness that would otherwise accompany such a large sprite. Unfortunately, there wasn’t enough processor time to do that. I was racing the beam, and the beam won. So I decided to let the beam win 2 out of 3 times, and get all the updating done in 3 lines, for a 3-line kernel. This makes the sprites taller than in normal games, but that’s a small price to pay for getting a duck sprite that actually looks like a duck.
Kittysneezes: What do you mean by “racing the beam”? And what do you mean about the updating every line in the kernel?
Will Nicholes: There was a neat book that came out last year called Racing the Beam: The Atari Video Computer System that explains the concept really well. The way a 2600 game works is by generating, in real time, each line of video that’s fed to the television. There’s no concept in the 2600 hardware of a 2-dimensional sprite: only one-dimensional bitmaps that you can update in the tiny amount of time it takes for the television’s electron beam (cathode ray) to pass from one side of the TV screen to the other.
One of the most common programming techniques is to tell the Atari you want three copies of an object, then actually change that object’s bitmap after the electron beam has drawn the first copy on the screen but before it’s drawn the second, and then change the bitmap again between the second and third copies. This will give you three differently shaped objects on one line. You’re literally racing the electron beam across the screen, trying to get the graphics updated before the electron beam starts drawing them.
You only get 76 machine cycles per line, and if your timing isn’t perfect, the technique won’t work. And if your timing is REALLY off, the television will roll and jitter because you’ve fed it more lines than the 262 lines per frame it’s expecting. After the 262nd line, you have to tell the television to move the electron beam back up to the top of the screen so it can begin the next frame. Getting a stable 262 lines per frame is one of the big challenges of coding a 2600 game.
Racing The Beam was actually one of the things that inspired me to try writing a game from scratch. I’d known most of the technical details of the 2600 before, from studying the specs online and playing around with the Adventure ROM, but reading how the original game concepts were developed made me think it was something I could do myself.
Kittysneezes: Now that a lot of TVs aren’t CRTs, does that have an effect on games, or, alternately, “fucking Plasmas, how do they work”?
Will Nicholes: I haven’t tried hooking an Atari to a non-CRT TV personally, but I’ve heard that it makes flickering look worse, since you can’t take advantage of the way the phosphor glow lingers a bit between frames on a CRT. So you wouldn’t want to try to play Pac-Man on a plasma, but something that doesn’t flicker, like Space Invaders, would be fine.
It’s interesting: there are hardware modifications you can make that will let the 2600 output in S-video instead of the channel 3 or 4 signal, and combined with a higher-end TV I’ve heard you can get an almost-comically sharp picture. On the other hand, PC emulators like Stella have effects that let you “fuzz up” the sharp pixels you’d see on your computer’s LCD screen, to mimic the fuzziness of playing on a TV. So there are lots of options available depending on how sharp or fuzzy you want the video.
Kittysneezes: Has any other game used the 3-line kernel system Duck Attack! uses?
Will Nicholes: To the best of my knowledge, no. It’s possible there’s another game that does but I’ve played hundreds of different games for the 2600 and I’ve never seen one. There’s no technical reason someone couldn’t have done one earlier; I can only assume in other games they were able to accomplish all they wanted to do graphically in 1 or 2 lines.
Kittysneezes: Is it difficult to have to account for both PAL and NTSC? Are both versions available in the cartridge?
Will Nicholes: Yep, both PAL cartridges and NTSC cartridges are available. And there are actually two PAL versions, a 60Hz version that keeps the game speed the same as the NTSC version, and 50Hz version for those (European) televisions that can’t support a 60Hz framerate. The 50Hz version plays a little slower, but the gameplay is otherwise identical. Once you get an NTSC version working, coding for PAL 60Hz is pretty straightforward since it’s basically just a palette swap. Including a 50Hz version does add a couple of timing wrinkles to content with, and it did take a while to iron the bugs out of that.
Kittysneezes: How’s Facebook Hero coming? What can you say about it?
Will Nicholes: I’m having great fun coming up with all the friend statuses for the players to react to. I’m hoping to get Nathan Strum to do the art for it, since he did such an amazing job with the Duck Attack! art.
Kittysneezes: Do you have any Atari projects that you’d like to do, but haven’t figured out how to do yet?
Will Nicholes: One of my arcade favorites from the 80s was Super Pac-Man, and I’d love to figure out how to do a version of that on the 2600. Or more accurately, I’d love to figure out how to do a version that didn’t give people epileptic seizures from all the flickering.
Kittysneezes: What numerical sequence is your favorite?
Will Nicholes: Right now, it’s what I call the Peter Gunn sequence. I haven’t submitted this to the Online Encyclopedia of Integer Sequences yet, but I tried to come up with a mathematical formula that would generate the MIDI notes for the bass line of the Peter Gunn theme: 41, 41, 43, 41, 44, 41, 46, 44. So far the simplest such formula I’ve found is 41 + floor(3 * (1 – cos(((mod(x,8)+1/6)/2)^sqrt(17)))). There’s probably an even simpler generating formula, but that’s the simplest I could come up with. On a less musical note, I really like any sequence having to do with prime signatures.
Kittysneezes: What draws you to math and playing with numbers?
Will Nicholes: It’s like comfort food for the brain. If I’ve had a really bad day, or people are behaving in ways I can’t understand, it’s nice sometimes to take a little side trip into the world of math and numbers, where it’s easier to make sense of things. The human mind is built to seek patterns out of chaos, and when there seems to be a lot of chaos in the world, math provides a ready source of patterns to uncover, and lets the brain do what it was meant to do.
Kittysneezes: Do you think there’s a connection between your love of numbers and your work with the Atari?
Will Nicholes: I think part of the appeal of both hobbies is the aspect of solving a puzzle. Finding a new, interesting integer sequence, and figuring out how to accomplish something interesting within the constraints of an early computer system, are both just elaborate puzzles to solve. And these hobbies have intersected in at least one way: if you get far enough in Duck Attack!, one of the bonus items you’ll find is Euler’s Identity: ei?+1 = 0. If you find that and run into it, you get a lot of points. I’m going to go out on a limb and declare that’s the first time Euler’s Identity has appeared in an Atari cartridge. Unless the Fun With Numbers cart has an Easter Egg I don’t know about.
Kittysneezes: Do you have anything else you’d like to mention?
Will Nicholes: Just that if you like Duck Attack! (and why wouldn’t you? It’s an awesome game!), to check out the other new games that others have written for the Atari 2600, because a lot of them are really, really good. Lady Bug, Juno First, and Strat-O-Gems Deluxe are my current favorites, but there are dozens more that are well worth checking out. AtariAge has been an incredible resource both in uncovering technical information about the 2600 and in finding people to help refine a work-in-progress with helpful feedback and suggestions. It’s definitely a site to check out.
Kittysneezes: Any chance of an Atari port of Polybius?
Will Nicholes: No, I think after E.T. and Pac-Man, 2600 players have suffered enough.