Wednesday, April 9th, 2008
Super Mario; 14KB of JavaScript
<>p>
Jacob Seidelin is doing great work, and for something fun, he build a piece of Super Mario in just 14KB of JavaScript:
Here’s an experiment in keepings things small and confined to one Javascript file. There are no external image files or anything, everything is rendered with Javascript using either canvas elements or old fashioned div-making tactics (for IE). The sprites are stored in custom encoded strings in a format that only allows 4 colors for each sprite but in turn only takes up around 40-60 bytes per sprite.
We also have MIDI music embedded as base64-encoded data: URI’s. No music for IE, though, and it seems all the other browsers each have different, minor problems with it, but it sort of works.
Related Content:











What can I say Mario, …..Super! :-)
I
+10, I heart Mario! I did something similar back in 1999 but it was probably larger than 14kb (used images) and definitely wasnt as cool. Very nice!
but does it work on the wii?
Very impressive!! only 14KB, *without* gzip compression!
I ran your JS through the compressorrater (http://compressorrater.thruhere.net) and
It looks like you could get that to under 7KB with gzip compression!
Now if only I could get ExtJs down to that size (am I dreaming?)
Wow, the performance is significantly better then I anticipated.
@ArthurBlake: Thanks. I actually used your compressor rater trying to decide which compression technique to use. It’s very nice!
Cool, a perfect excuse to play mario at work! Just tell people you’re researching javascript, hehe ;)
A few JS animals have written crazy stuff like this, Mathieu “P01″ Henri (of Opera) has a 3D Tomb game in
Hm, broken HTML because I said “in < 4 KB” of JS. (Again).
Ah hell, while I’m at it, this JS/Canvas game is also quite nifty.
Whoa, good job! but it seems like some of the data has not been properly encoded in base64 because I got a broken Mario when I first opened it with UTF-8. Anyways, looks really good!
This is very cool. I did something similar, I ported a version of Freecell in written in javascript / DHTML to work on the iPhone. Then put the whole thing into a bookmarklet using data:URI so its all in the URL and can play without an internet connection. See http://jonathanleech.blogspot.com.
my childhood love, quite nice to see it with javascript
just awesome and really smooth…