Play Super Mario Bros in 14kB Javascript
Here's an experiment in keeping things small and confined to one Javascript file. A piece of the old
Super Mario Bros Nintendo classic. There are no external image or sound files, everything is rendered with Javascript using either canvas elements or old fashioned div-making tactics (for IE).
Hey! While you're here, why don't you also check out the new Games section, a section completely dedicated to online JavaScript web games! And subscribe to the feeds to get the latest updates and games! Now let's play Super Mario...
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.
There is also 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.
It is by no means a complete clone or anything, it's not even an entire level and several key things are missing, such as mushrooms, Koopas and stuff. It was merely done as a sort of proof-of-concept and to see how small it could get.
Performance varies somewhat between the different browsers, but Firefox, Opera, Safari and IE are all playable. The latest WebKit nightly seems to give Safari a speed boost.
Be sure to click the mouse on the game if Mario won't move. When you die, you have to reload the page to start over. And yes, you can move left. Sorry.
Play Super Mario Bros without music
Play Super Mario Bros with music
Or try the larger double size version:
Play Super Mario Bros (2X) without music or Play Super Mario Bros (2X) with music
The script has been compressed to 14kb with the YUI compressor.
Here's the uncompressed script (35kb), if anyone is interested. The structure may look a bit weird, a lot of things have been moved around to get better compression.
If you liked this, be sure to check out the Super Mario Kart JavaScript game as well. Have fun!
Hey! While you're here, why don't you also check out the new Games section, a section completely dedicated to online JavaScript web games! And subscribe to the feeds to get the latest updates and games! Now let's play Super Mario...
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.
There is also 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.
It is by no means a complete clone or anything, it's not even an entire level and several key things are missing, such as mushrooms, Koopas and stuff. It was merely done as a sort of proof-of-concept and to see how small it could get.
Performance varies somewhat between the different browsers, but Firefox, Opera, Safari and IE are all playable. The latest WebKit nightly seems to give Safari a speed boost.
Be sure to click the mouse on the game if Mario won't move. When you die, you have to reload the page to start over. And yes, you can move left. Sorry.
Play Super Mario Bros without music
Play Super Mario Bros with music
Or try the larger double size version:
Play Super Mario Bros (2X) without music or Play Super Mario Bros (2X) with music
The script has been compressed to 14kb with the YUI compressor.
Here's the uncompressed script (35kb), if anyone is interested. The structure may look a bit weird, a lot of things have been moved around to get better compression.
If you liked this, be sure to check out the Super Mario Kart JavaScript game as well. Have fun!
Nice
April 26, 2008 at 3:52 AM Jonathan Colettahow can i use on my homepage !
Mis felicitaciones!
April 27, 2008 at 6:21 PM AnonymousAmazing work man!
May 1, 2008 at 8:46 AM Anonymouscool bro.. :D
May 14, 2008 at 7:57 AM AnonymousVery impressive work indeed. For the most people, when you look at the MBs a kit has one can pretty much say if it is a complex software/script o not. This one sure beats the rules :)
May 15, 2008 at 6:30 AM AnonymousEEXCELLLENT!!!!! EEXCELLLENT!!!!! EEXCELLLENT!!!!! on my Multi-core 64 bit firefox 3rc1 works flawlessly.
June 2, 2008 at 7:26 PM Anonymousdetox foot bath
June 5, 2008 at 1:05 AM Anonymousion cleanse
You my friend are An Hero. Will you have my baby?
June 8, 2008 at 6:55 PM Anonymoushow do u down load it ?
June 9, 2008 at 9:03 PM Anonymoushow do u download it?
June 9, 2008 at 9:03 PM redthank you mirc
June 17, 2008 at 8:43 AM AnonymousIt works fine for me under FF 3, beta 5. Very nice. :)
July 7, 2008 at 8:50 AM Anonymouskral oyun
oyunlar
oyunlar
The best Super Mario Games in flash.
July 18, 2008 at 2:07 AM Anonymoushttp://jogosdomario.jogosja.com
cool....
August 6, 2008 at 5:31 AM redBest regard,
priyadi.co.nr
http://www.google.com.tr/search?hl=tr&suggon=0&q=m%C4%B1rc&start=30&sa=No
August 12, 2008 at 8:56 AM AnonymousSo very cool. And yet... if we have so many 'nerds' out there with THIS much time on their hands... maybe we can cure cancer or something. *laughs*
August 18, 2008 at 11:15 AM AnonymousWell done, I work with this stuff, and I can only say kudos...!
September 4, 2008 at 3:21 AM AnonymousMuZui.com
Very useful,thanks a lot!
October 21, 2008 at 8:50 PM Anonymousit is full of s***t
November 3, 2008 at 6:13 AM Anonymousgreat, I've finishd with 165 s left ^^
November 12, 2008 at 11:14 AM Anonymouswith firefox3.1 it's pretty fast
jajaja,,,,,,,q farsa ese mario bross,,,,,,,,,,,,:D
November 29, 2008 at 7:56 PM AnonymousCool!
December 8, 2008 at 5:50 PM AnonymousYou had pretty beautiful technology of javascript!
December 9, 2008 at 5:59 AM Anonymoussurprised
December 10, 2008 at 10:00 PM Anonymouscool
December 11, 2008 at 6:42 AM AnonymousGreat Job!!!, now in going to try at home :P
December 16, 2008 at 4:57 PM UnknownI found a little bug - when you die, you still have the ability to jump, but only straight up. Nothing major, just a weird little thing I noticed.
December 29, 2008 at 7:16 PM acceptcreditcardsI am gonna share with you all a website where you can
January 1, 2009 at 10:30 PM Anonymousplay for free all Mario Bros Games online
The site is: MarioBros.com.net.gt
checkit, you're gonna love the site too !!
im working on a mario game myself, for a school project but im having a difficult time starting up
January 5, 2009 at 6:35 AM Anonymousu got any ideas
lol it's funny, you can still jump when you died ^^
January 6, 2009 at 7:47 AM Anonymousthis is amazing
January 17, 2009 at 3:34 PM Anonymouswhat is up
February 8, 2009 at 10:14 PM Anonymousthe wall is up, of course
my name is tuck, from Madagascar
would you like to be my friend
Well done!!
February 25, 2009 at 6:58 AM Anonymousi love mario
March 25, 2009 at 4:17 PM Tukang Nggamewow..
April 12, 2009 at 4:06 AM ShadowCryit's a "dark age" game, he he he...
but i still love this game...
great post..
thanks :)
Great site man!!!
April 22, 2009 at 3:56 AM AnonymousWorks great on my Opera but it doesn't restart right away.
April 24, 2009 at 1:47 AM AnonymousGreat work!
Air Jordan 1
May 12, 2009 at 12:01 AM