7 ms·
HTML 5 Canvas game
- Hexstream 18y agoNicely done! The first thing I notice is that unlike 90%+ of real-time browser-based games (flash or javascript), it doesn't stupidly burn 100% CPU for no reason at all. It takes close to 0%!
- reitzensteinm 18y agoYou'd probably get the same if you wrote a slow paced, event based game in Flash. Dirty rects means that even though Flash rendering is called at x fps, it can be skipped if nothing's changed (at least, as far as I understand it, my games always change each frame). Generally if a game has focus it should burn 100% CPU in order to update as smoothly as possible, but the real problem is games that still update and consume CPU like that when not in focus.
- Hexstream 18y agoBut most of those games that burn 100% CPU still burn 100% CPU even if the game is paused with a static pause screen and the container window is scrolled past the flash area and the browser window doesn't have focus and is totally obscured. So it's obviously not a deliberate tradeoff.
- jrp 18y agoThe controls should support holding down L/R instead of tapping only.
- pieter 18y agoIt does for me (Safari 3 + Webkit nightly)
- huyslogic 18y agoIt does support it. Using Firefox. It's perfect.
- axod 18y agoOnly issue I had is if the window is sized too small to require a scrollbar, then pressing down/up actually scrolls the page, as well as controlling the game. Perhaps need to cancel default action in the key handler...
- deleted 18y ago[deleted]
- Raphael 18y agoWow, that's one of the first JavaScript games that played just like a normal game, and it didn't feel cheesy like pong. No speed or control issues to report. Bright, clear, 3D rendering. Of course, I, like many others, am biased for Tetris. Oh, and I realized that you got to skip the conditions for turning at the walls, since it wraps around instead. Still hard, I bet.
- cubicle67 18y agoCan I plug my little javascript version of asteroids? http://users.tpg.com.au/_dp//dave_asteroids.html http://users.tpg.com.au/_dp//dave_asteroids.html I've tried to make it not cheesy and nice smooth gameplay
- lacker 18y agoSometimes when it goes to the next level, an asteroid materializes right on top of me, which seems a bit unsporting.
- unalone 18y agoI recall that happening in the original game, too. I could be wrong. EDIT: "You have died of dysentary." That made me smile.
- cubicle67 18y agoSame thing happens when you die sometimes, which is a real pain. It's on my list of things to do, I'm just trying to think of a good way to handle it (gameplay wise)
- ruddzw 18y agoIt took me a while to realize that my default browser, Safari 3.2.1, doesn't support HTML 5 Canvas. I'm seeing a bowl and a logo. Graceful degradation, not so much.
- GHFigs 18y agoSafari most certainly does support HTML5 Canvas. The canvas was originally introduced by Apple in 2004. (http://weblogs.mozillazine.org/hyatt/archives/2004_07.html#005913 http://weblogs.mozillazine.org/hyatt/archives/2004_07.html#0...)
- ruddzw 18y agoYou're definitely right. I'm not so familiar with Canvas at all, so I assumed that since it didn't render, it wasn't supported. My main point was about the graceful degradation.
- nickb 18y agoHuh? You're completely wrong. How did this entry get 4 points?! http://img24.imageshack.us/img24/2830/picture32s.png http://img24.imageshack.us/img24/2830/picture32s.png
- mr_justin 18y agoIt's a proof of concept, and a darn good one, graceful degradation is unneeded.
- 18y ago
- DLWormwood 18y agoIs it just me, or does the "bin" seem MUCH shallower than an official Tetris game? Otherwise, pretty impressive for not using Flash.
- lhorie 18y agoThe opera widget has been around for quite a while. His other demos seem to run pretty well too (using Flock): http://www.benjoffe.com/code/tools/functions3d/ http://www.benjoffe.com/code/tools/functions3d/ http://www.benjoffe.com/code/demos/canvascape/ http://www.benjoffe.com/code/demos/canvascape/ http://www.benjoffe.com/code/toys/spirograph/ http://www.benjoffe.com/code/toys/spirograph/
- jasonkester 18y agoDoesn't work in Chrome, but extra points for being the first Canvas thing here in a few weeks to support IE!
- mis 18y agoCool, works great in FF3 on Ubuntu. The only thing is that pressing up and down to rotate the tetromino moved the page up and down as well.
- palish 18y agoSeems to be broken in Chrome.
- zhyder 18y agoNot only is it technically impressive, it's actually fun too! I'm not a gamer (not even much of a casual gamer) so this may sound like a dumb Q: but are such variations of Tetris common?
- mynameishere 18y agoI'm thinking no one did too well. I got the high score of "2". (Unless that's broken.)
- whatusername 18y agoDo the high scores not work? Or did no-one else finish a game?
- chris11 18y agoI got on the highscore list for garbage, so it seems to be working.
- whatusername 18y agohmm.. Can you see anyone else's name on their though? I see my name on Traditional - but the other 2 spots on that are blank - and all 3 spots on Time Attack and Garbage are saying "Empty"
- chris11 18y agoI guess you are right. I don't see any scores on there at all.
- andhapp 18y agoAnyone who does a game in Javascript rocks...so does this one. Amazing...I didn't even know you could do this...
- omouse 18y agoI'm surprised at how quickly it runs in Firefox.
- cousin_it 18y agoThis is great, but why Canvas? SVG/VML would be a more natural choice - JavaScript fits better with a DOM-based API where you don't have to repaint everything.