10k Apart.

- -

I've finished, and submitted, my entry for the 10K Apart contest, a somewhat faithful Javascript/HTML5 clone of the 1979 arcade classic game, Asteroids.

A couple of weeks ago, a friend sent me a link to a contest that An Event Apart is doing along with (*gasp!*) Microsoft where entrants build an HTML5 web application in less than 10Kb. I looked over the existing entries at that point and thought they were pretty lame. People were getting so stuck on the 10Kb requirement—and they were attempting the fool's errand of cramming images and tons of CSS into 10Kb. I thought that was the wrong approach.

So I had an ambitious idea. A very ambitious idea. I had always speculated that, with the Canvas element added to HTML5 and with most edgy browsers packing a just-in-time Javascript bytecode compiler (see also: Safari/Webkit/Chrome, Firefox, and as I understand it IE9 beta as well), it would be possible to create an actual arcade game, in Javascript, that would take less space and load faster than an equivalent Flash game. I thought, 10Kb is actually a lot of Javascript, so I could make the game logic as robust as I liked, but I would just be limited by not being able to add images.

No problem, I thought. I'll just hearken back to the good old days, the days when a dollar's worth of quarters could last you an hour at the arcade, the days of vector-based graphics. For those of y'all who haven't dove into the very fetid depths of computer graphics terminology, images and sprites and things are raster graphics—meaning they're defined in terms of which pixels are which colour; vector graphics are defined in terms of where lines and curves are. Vector graphics are much simpler, they scale better, and they are much smaller. I had reasoned that, being as I have an old Atari 2600 with a cartridge of the original Asteroids, and I know that cartridge has to be less than 8,192 bytes, it seemed reasonable that with HTML5 and Javascript I could make a similar game in under 10Kb even if I didn't try in the slightest to make my code small.

Anyways, I've been extremely surprised and pleased with the praise I've gotten for this while it's been in the works. Many thanks to all my friends who helped me test it and adjust it to be what it is now. Don't expect this to be the last you hear of Asteroidz, space cadets.