9 ms·
Infinite Mario in HTML5
- bprater 15y agoToo bad the source is obfuscated. This is the kind of thing that could draw a young person into digging deeper into programming.
- kevingadd 15y agoIt's always disappointing when people's cool demos have obfuscated/minified JS source. It destroys the readability and hackability of the code, and it means that if you find bugs (like I did in this demo) you can't trivially fix them either.
- arkitaip 15y agoYou can always use Javascript Deminifier For Firefox https://addons.mozilla.org/en-US/firefox/addon/javascript-deminifier/ https://addons.mozilla.org/en-US/firefox/addon/javascript-de... For Chrome, there's the built-in de-obfuscator http://www.sitepoint.com/whats-new-in-google-chrome-12/ http://www.sitepoint.com/whats-new-in-google-chrome-12/
- CrystalKoo 15y agoYou can copy and paste the .min.js file into http://jsbeautifier.org/ http://jsbeautifier.org/. That would beautify everything so it's readable. :) Crystal
- stevenleeg 15y agohttps://github.com/robertkleffner/mariohtml5/ https://github.com/robertkleffner/mariohtml5/ Nope, it's actually open source.
- Groxx 15y agoThe source is obfuscated? It's just one-lined. Copy-paste here: http://jsbeautifier.org/ http://jsbeautifier.org/ I don't know why they even bothered un-white-spacing it. Doing so doesn't save much space, nor provide any kind of real obfuscation. At best it just makes it un-debuggable (hmm. seems like an oversight (that most debuggers also miss) that you can't set breakpoints inside a single line of code...)
- beaumartinez 15y agoIts source is on GitHub[1]. [1] https://github.com/robertkleffner/mariohtml5 https://github.com/robertkleffner/mariohtml5
- rat 15y agoI was just about to say that.
- xiaoqmaxkk 15y agowelcometo: http://www.fullmalls.com http://www.fullmalls.com The website wholesale for many kinds of fashion shoes, like the nike,jordan,prada,, also including the jeans,shirts,bags,hat and the decorations. All the products are free shipping, and the the price is competitive, and also can accept the paypal payment.,after the payment, can ship within short time. free shippingcompetitive priceany size availableaccept the paypal ===== http://www.fullmalls.com http://www.fullmalls.com ===== jordan shoes $32nike shox $32Christan Audigier bikini $23 Ed Hardy Bikini $23Smful short_t-shirt_woman $15ed hardy short_tank_woman $16Sandal $32christian loubo utin $80 Sunglass $15 COACH_Necklace $27handbag $33AF tank woman $17puma slipper woman $30 ===== http://www.fullmalls.com http://www.fullmalls.com ===== ===== http://www.fullmalls.com http://www.fullmalls.com ===== ===== http://www.fullmalls.com http://www.fullmalls.com ===== ===== http://www.fullmalls.com http://www.fullmalls.com ===== ===== http://www.fullmalls.com http://www.fullmalls.com =====
- neovive 15y agoVery interesting. Does anyone know which script controls the mapping of the background bitmaps to create the panning background?
- reubenyeah 15y agoThis is really cool. I find it immensely disappointing that many years on and I'm still rubbish at Mario though!
- keyle 15y ago"Background music currently does not work in any browser besides Firefox 4."
- kevingadd 15y agoDoesn't even work in a newer Firefox. Very strange.
- josefresco 15y agoDoesn't work in Chrome on Windows either.
- loevborg 15y agoWorks perfectly in Chrome 12 (linux).
- kand 15y agoAmazing work. Love it.
- Arxiss 15y agoAmazing! HTML5 rocks my world. Too bad sound doesn't work.
- wccrawford 15y agoWin7/Chrome. Can't jump! Up and down move up and down the page, space moves down the page. S and Left and Right are the only things that do anything.
- ry0ohki 15y agoS is jump?
- wccrawford 15y agoWeird. That works now, but it didn't the first time.
- ayanb 15y agoReally nice work, here is what git clone says "Receiving objects: 100% (113/113), 1.07 MiB | 164 KiB/s, done." Just 1 MB. Further ubuntu mariohtml5 $ du -k code Enjine/ 364 code 68 Enjine/ roughly 400K of code
- JonnieCache 15y agoConsider that the original super mario brothers ROM is 30.79kb.
- JackWebbHeller 15y agoFinally lost my Mario virginity...
- simias 15y agoIt's very cool, however I have yet to find an html5 game that will let me change the keybindings. Think of the people who don't use QWERTY!
- larelli 15y agoFor Ubuntu (and probably most of the other distros) theres a keyboard layout switcher. I'm sure there's something similar for windows and almost every browser. You can use those extensions to rapidly switch to qwerty layout when needed.
- simias 15y agoOf course, but why should I need to? Most "real" games let me remap the controls however I like. Is there a technical limitation of html5 that prevents that or is just that nobody bothers to implement it?
- hardy263 15y agoPersonally, it usually doesn't cross my mind to remap the keys when I make simple games, because I'm so busy thinking about all the logic to actually make the game work. If the game is particularly simple, it's not worth my time to make a settings page anyway. And if you think about it, mario is usually played on a device where you only have a limited number of buttons. There's no reason to remap the keys if there's only 6 buttons to use.
- de90 15y agoIt's certainly possibly, it's just generally a waste of time for games made for fun..
- pharrington 15y agoWell here you go: http://blocks.solitairey.com http://blocks.solitairey.com It's a Tetris clone and very much a work in progress: Only "Standard" mode (and the controls menu) is implemented at all. There's also a simplistic AI and it saves your replays, but none of that is actually integrated into the game interface-wise yet :\
- JonnieCache 15y agoThe original java infinite mario was used in the fascinating Mario AI competition. Details and papers here: http://www.marioai.org http://www.marioai.org Video of last years winning entry at work here: http://www.youtube.com/watch?v=DlkMs4ZHHr8 http://www.youtube.com/watch?v=DlkMs4ZHHr8 It's pretty interesting, a lot of people wrote/are writing high falutin' machine learning algorithms, but they are consistently trounced by good old A* techniques.
- StavrosK 15y agoThat's because the problem was, essentially, "get from point A to point B", but few people could see it.
- StavrosK 15y agoIs there anything like this for lua? It might be just the thing to help me finally learn the language (I have an inexplicable dearth of problems to work on in lua)...
- neovive 15y agoTry looking through some of the resources for the Corona game engine (http://www.anscamobile.com/resources/ http://www.anscamobile.com/resources/). The SDK compiles Lua source into iOS and Android. I've just started looking at it myself -- it's the first time I have seen Lua code -- and it looks extremely clean.
- Lewisham 15y agoInfinite Mario is actually a rather useful piece of code for all sorts of games research. It's a very good "simplest non-trivial example". The code itself is decently clean, OOP code, which a lot of open-source games, even those written in Java, are not. For example, I modified Infinite Mario to become self-repairing: http://www.zenetproject.com/pages/lakitu http://www.zenetproject.com/pages/lakitu
- mshron 15y agoI'm confused. All I see is a copy of Mario in HTML5. Can someone enlighten me?
- kiiski 15y agoWhat did you expect? The title is "Infinite Mario in HTML5".
- jessriedel 15y agoYea, but what's infinite about it?
- kiiski 15y agoIt's a HTML 5 version of older (Java/Flash?) game called "Infinite Mario". edit: I'm not sure about this, but I got the idea that it randomly generates the map/levels.
- woogley 15y agoThe original[1] was made by the Minecraft guy. Like most of his projects, the levels are randomly generated. The levels themselves end, but there is no end to the actual game. It just keeps generating new levels. [1]: http://www.mojang.com/notch/mario/ http://www.mojang.com/notch/mario/
- mnutt 15y agoI'm not disappointed, but I was actually hoping it was a playable html5 version of this: http://www.youtube.com/watch?v=T2OytHzZ72Y http://www.youtube.com/watch?v=T2OytHzZ72Y My favorite part is when he misses the goalpost in his first pass and then goes back a second time and hits it.
- robjohnson 15y agoThat is absolutely incredible - makes me want to dive into learning HTML 5.
- progolferyo 15y agoDoes anyone know what javascript engine this game is using. It appears to be 'Enjine' but I can't seem to find any information about it.
- sycren 15y agoHis own engine, open source code can be found here: https://github.com/robertkleffner/enjine https://github.com/robertkleffner/enjine
- fiblye 15y agoI don't mean to sound cocky, but I don't get why people are still impressed by simple game demos in javascript. I've been working on a full Metroid-like game (some very old screenshots here http://ektomarch.com/games/ http://ektomarch.com/games/) that'll have ~100 rooms, ~40 enemy designs, and a full plot for a year now and I've been doing it at a glacial pace, yet it's still nearing completion. How is it that seemingly nobody has made any real games in HTML5/javascript yet? We've had over a year of nothing but basic demos.
- tibbon 15y agoI think its partially that people are impressed by simple things when completed, more than complex things in the works. Looks like you have a cool game, but it will get the attention it deserves when its complete more than beforehand.
- Almaviva 15y ago"Over a year"? Given that the canvas element was introduced in 2004, I suppose this is accurate. I agree, I am also mystified by how people are consistently impressed with game demos that say little more than "See, we can now do some of the things that Flash has been able to do for ten years, as long as you run the right browser."
- JoshTriplett 15y agoThis seems to have the same property I've seen in quite a few other HTML5 games: the arrow keys get used for movement but also still get interpreted by the browser to scroll the page. Both seem important: I usually don't want anything to break the arrow keys for scrolling, but on the other hand for something like this I don't really want the page to move around as I play. (Of course, for something like this perhaps the page just needs to become small enough to not need scrolling, which would fix the problem, but the general issue still applies.)
- woodall 15y agoOr catch the key's event trigger with onfocus or onkeydown. That way even if they are pressed, nothing will happen.
- Tyrant505 15y agoThis brings up a good point. The controls are even set swapped compared to gamepads, so using the wrong hand isn't comfortable. Old computer games did use the pc arrows of course. But now since this is a remake of the classic, it should at least be hand aware :)
- sid0 15y agoFlipping around the hands used for directions and actions is standard with emulator keyboard input, actually.
- Groxx 15y agoNow that I think about it, it's really weird. I play FPSes at times, and WASD feels natural, but WASD+JKL for, say, Sega emulation feels wrong compared to ↑←↓→+ASD(/ZXC, for you crazy Japanese-targeted-game fans).
- Groxx 15y agoNo, they're just all making the same crazy omission: event.preventDefault(); I have a fix, if you're interested, in my top-level comment: http://news.ycombinator.com/item?id=2798835 http://news.ycombinator.com/item?id=2798835
- _phred 15y agoInfinite (in the practical sense) lives for Infinite Mario; pop open your JS console and run: Mario.MarioCharacter.Lives += 1024 Now the challenge is: how far can you get before the game locks up?
- Retric 15y agoThe three starting lives are actually plenty, I stopped playing out of bordem not game over. By the time I stopped I was sitting at 12 lives and I think I died 3 or 4 times in the process.
- swolchok 15y agoCan't seem to jump while holding down the run key, which is usually my method of playing mario...
- Twisol 15y agoSounds like your keyboard might have a ghosting issue with those keys, as I can jump while running perfectly well. http://www.microsoft.com/appliedsciences/AntiGhostingExplained.mspx http://www.microsoft.com/appliedsciences/AntiGhostingExplain...
- rebelidealist 15y agoAwesome work! I am always curious about the copyright implication of cloning an old game like Mario. Does anyone know?
- Groxx 15y ago// in Enjine.KeyboardInput Initialize: function() { var self = this; document.onkeydown = function(event) { self.KeyDownEvent(event); } document.onkeyup = function(event) { self.KeyUpEvent(event); } }, IsKeyDown: function(key) { if (this.Pressed[key] != null) return this.Pressed[key]; return false; }, KeyDownEvent: function(event) { this.Pressed[event.keyCode] = true; }, KeyUpEvent: function(event) { this.Pressed[event.keyCode] = false; } Sheesh. That's why it's jumping up and down when you use the arrow keys. All keyboard input is based on checking `IsKeyDown`, and nothing else. `event.preventDefault()` please. Why do people do this? .preventDefault() is missing in a huge amount of HTML5 demos that aren't full-screen; surely it's not that obscure. edit: seriously, that's all there is to it. Pop open the console / inspector in your browser of choice, and run this: document.onkeyup = function(event) { Enjine.KeyboardInput.KeyUpEvent(event); event.preventDefault(); } document.onkeydown = function(event) { Enjine.KeyboardInput.KeyDownEvent(event); event.preventDefault(); } Viola. No more jumping. No more keyboard scrolling either, which is why you check if the cursor location / last-clicked location is within your canvas. edit2: that aside, very nice work. Smooth playing and so far no glitches, and highly readable code :) edit3: if you're on IE, that code is `event.returnValue = false` btw. Yaaay, IE :|
- alttab 15y agoCan't play on iPad. Which is dissapointing because when you have a good web game that works with touch you have won
- ahmetalpbalkan 15y agoBandwidth Limit Exceeded... too bad.
- robkleffner 15y agoThanks for crashing my website guys. Any ideas where to put it so I don't have to pay an exorbitant amount for hosting?