PDA

View Full Version : Super Mario done in Javascript -- 14kb!


ADM
04-14-2008, 07:59 AM
http://blog.nihilogic.dk/2008/04/super-mario-in-14kb-javascript.html

Super Mario in 14kb Javascript.

Bludd
04-14-2008, 08:58 AM
Cool albeit slow.

I consider it a proof of concept of why more games are not coded in JavaScript. :D

Danule
04-14-2008, 09:21 AM
it ran a little too fast on my machine :P

Little Conqueror
04-14-2008, 09:31 AM
Not so impressive. I've remade the Mario engine in countless engines and programming environments, all with better results than this, and there's people who do it much better than me.

ADM
04-14-2008, 09:35 AM
Not so impressive. I've remade the Mario engine in countless engines and programming environments, all with better results than this, and there's people who do it much better than me.
By all means post links to your countless remakes of Mario :)

Black Yeti
04-14-2008, 10:47 AM
It's not perfect but still really impressive considered that it's done in JavaScript.

The Stinger
04-14-2008, 10:51 AM
I ran off the screen and died. :o

theHunted
04-14-2008, 12:49 PM
I dont know why but this leaves me completely unimpressed. Neither the size nor the fact that it is written in JS looks impressive to me. But then again I dont have fond knowledge of JavaScript having coded only one application for it. Im only into Java but Ive been told its basically the same, just running in a browser. So maybe thats whats impressive but for a regular java application I say theres nothing spectacular.

But enough of the ranting. After all its another solid adaption of mario and its fun to play ;)

8IronBob
04-14-2008, 12:53 PM
There's all sorts of games from the old NES days that can be remade, including Mario. However, it seems like this may probably not be one of the ways that I consider solid performance from that programming language. I'd certainly consider inline C#, as that may perhaps do better for web-based games. Hell, I'd even go with Flash over JavaScript. Flash has been known for gaming performance, Java's more for light multimedia or point and click games.

Bludd
04-14-2008, 01:40 PM
I dont know why but this leaves me completely unimpressed. Neither the size nor the fact that it is written in JS looks impressive to me. But then again I dont have fond knowledge of JavaScript having coded only one application for it. Im only into Java but Ive been told its basically the same, just running in a browser. So maybe thats whats impressive but for a regular java application I say theres nothing spectacular.

But enough of the ranting. After all its another solid adaption of mario and its fun to play ;)
No, JavaScript and Java are not basically the same. If you have developed apps using both languages, you should know this. Also, if you know anything about programming languages you would know what's different about JavaScript and Java.

Delta
04-14-2008, 04:33 PM
Java and JavaScript are in fact completely unrelated. They only happen to have similar names. This is why the "formal" name is ECMAScript (http://en.wikipedia.org/wiki/ECMAScript).

Decker
04-14-2008, 04:53 PM
Please... a little perspective here, people. That's very impressive for a JS game. The language of choice is obviously used for challenge or study purposes. Reminds me of JavaScript Lemmings (http://www.elizium.nu/scripts/lemmings/).

IwantMORE
04-14-2008, 05:07 PM
Ohhh Nooo more Lemmings! I love it

steauengeglase
04-14-2008, 06:07 PM
Haven't bothered looking at the source, but I'm impressed.

Nevermind, just checked it out. He/She (sorry, didn't read the article) did a number on shrinking it down. Performance wise, yeah, it sucks. That could have been handled better, but its pretty obvious that performance wasn't the point. "I can do this with less space than so-and-so could have." was.

On the elegance side I really can't say anything. Since I'm only looking at it in notepad and I'm not going to spend an hour fluffing it out into something readable, but I'm still impressed.

alexgk
04-14-2008, 08:09 PM
Lol, goombas don't disappear.

Water12356
04-14-2008, 08:33 PM
good but I cant hear the music on the with music version. :(

alexgk
04-14-2008, 08:34 PM
^ What browser are you using?

Water12356
04-14-2008, 08:35 PM
Ie 7.0

Edit: Just read, yea music dosnt work for IE. >.>

leilei
04-14-2008, 08:57 PM
Not so impressive. I've remade the Mario engine in countless engines and programming environments, all with better results than this, and there's people who do it much better than me.

But can you do it at a tiny size like 14kb? Please, keep your ego out of this.

Damien_Azreal
04-14-2008, 09:52 PM
Cool.... but it ran way to fast. I was all over the place.

theHunted
04-15-2008, 02:06 PM
No, JavaScript and Java are not basically the same. If you have developed apps using both languages, you should know this. Also, if you know anything about programming languages you would know what's different about JavaScript and Java.

Let me stand corrected. Ive been told that programming JavaScript and Java is pretty similar - and theres no doubt about that. This JS I wrote was a simple GUI application making use of awt for drawing if I remember correctly.
All you really need for a 2D sidescroller game is 2D graphics and a way to display them and move them around. As for the latter I believe awt could do the job. Dont know if this would actually allow for interactive refresh rates however. I guess looking at the source of this game would clear things up. As for the 2D graphics again I believe its not hard to keep them below 14k when created by help of code.
Of course its also a little bit of gamelogic and some crude and simple collision detection. But that shouldnt take away too much memory

ADM
04-15-2008, 02:10 PM
Just a little insight, all game assets are actually embedded into the code. There's no external art assets in this game.

Bludd
04-15-2008, 03:39 PM
Let me stand corrected. Ive been told that programming JavaScript and Java is pretty similar - and theres no doubt about that. This JS I wrote was a simple GUI application making use of awt for drawing if I remember correctly.
All you really need for a 2D sidescroller game is 2D graphics and a way to display them and move them around. As for the latter I believe awt could do the job. Dont know if this would actually allow for interactive refresh rates however. I guess looking at the source of this game would clear things up. As for the 2D graphics again I believe its not hard to keep them below 14k when created by help of code.
Of course its also a little bit of gamelogic and some crude and simple collision detection. But that shouldnt take away too much memory

I am sorry but you seem to be confusing Java Applets for JavaScript.

Black Yeti
04-15-2008, 03:46 PM
Let me stand corrected. Ive been told that programming JavaScript and Java is pretty similar - and theres no doubt about that. This JS I wrote was a simple GUI application making use of awt for drawing if I remember correctly.
All you really need for a 2D sidescroller game is 2D graphics and a way to display them and move them around. As for the latter I believe awt could do the job. Dont know if this would actually allow for interactive refresh rates however. I guess looking at the source of this game would clear things up. As for the 2D graphics again I believe its not hard to keep them below 14k when created by help of code.
Of course its also a little bit of gamelogic and some crude and simple collision detection. But that shouldnt take away too much memory

Sorry, but you have been told wrong. The only similarities between Java and JavaScript are the names an that the syntax is based on C. Other than that they are completely different programming languages. JavaScript is a prototype based object oriented programming language, which means that there the class concept is unknown. There are objects but there are no classes in JavaScript. There are a lot more differences but I'm not going to list them here. If you want, look it up on wikipedia or somewhere. The point is: programming in Java is pretty easy - programming in JavaScript can be a pain in the ass (mainly due to the fact that JS implementations differ from browser to browser).

Oh, and there is no awt in JavaScript nor any other library that you may be used to in Java. All graphics have to be done in HTML.

theHunted
04-16-2008, 04:27 AM
I am sorry but you seem to be confusing Java Applets for JavaScript.

Damn you're right. Thanks for clearing that up.