News for hackers. Stuff that matters.
Re:HTML 5 Canvas game by Hexstream on Friday March 13, 2009 @10:11AM (#514870)
Nicely 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%!

Re:HTML 5 Canvas game by reitzensteinm on Friday March 13, 2009 @04:13PM (#515270)
You'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.

Re:HTML 5 Canvas game by Hexstream on Saturday March 14, 2009 @11:54AM (#515899)
But 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.

Re:HTML 5 Canvas game by Raphael on Friday March 13, 2009 @11:44AM (#514974)
Wow, 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.

Re:HTML 5 Canvas game by cubicle67 on Friday March 13, 2009 @09:38PM (#515547)
Can I plug my little javascript version of asteroids? http://users.tpg.com.au/_dp//dave_asteroids.html

I've tried to make it not cheesy and nice smooth gameplay

Re:HTML 5 Canvas game by lacker on Saturday March 14, 2009 @11:36AM (#515892)
Sometimes when it goes to the next level, an asteroid materializes right on top of me, which seems a bit unsporting.
Re:HTML 5 Canvas game by unalone on Saturday March 14, 2009 @01:52PM (#516019)
I recall that happening in the original game, too. I could be wrong.

EDIT: "You have died of dysentary." That made me smile.

Re:HTML 5 Canvas game by cubicle67 on Saturday March 14, 2009 @08:00PM (#516348)
Same 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)
Re:HTML 5 Canvas game by zhyder on Friday March 13, 2009 @03:35PM (#515230)
Not 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?
Re:HTML 5 Canvas game by ruddzw on Friday March 13, 2009 @11:45AM (#514976)
It 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.
Re:HTML 5 Canvas game by GHFigs on Friday March 13, 2009 @01:44PM (#515096)
Safari most certainly does support HTML5 Canvas. The canvas was originally introduced by Apple in 2004. (http://weblogs.mozillazine.org/hyatt/archives/2004_07.html#0...)
Re:HTML 5 Canvas game by ruddzw on Friday March 13, 2009 @07:41PM (#515453)
You'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.
Re:HTML 5 Canvas game by mr_justin on Friday March 13, 2009 @02:58PM (#515185)
It's a proof of concept, and a darn good one, graceful degradation is unneeded.
Re:HTML 5 Canvas game by jdowdell on Friday March 13, 2009 @04:58PM (#515314)
People speak in binary on support for CANVAS, SVG, CSS etc -- "this browser has CANVAS support", "that browser doesn't have CANVAS support".

They should actually be speaking of "what level of CANVAS support", because there are different implementations among different browser brands, versions, and possibly operating systems. Whenever there's a common spec with multiple implementations, some solid conformance testing is vital before starting development.

(I'm not too concerned about the lack of "graceful degradation" here, because it's more of an enthusiast piece, "look what I can code", rather than something solid to deploy out to the general public. Different priorities.)

jd/adobe

Re:HTML 5 Canvas game by nickb on Friday March 13, 2009 @02:57PM (#515182)
Huh? You're completely wrong. How did this entry get 4 points?!

http://img24.imageshack.us/img24/2830/picture32s.png

Re:HTML 5 Canvas game by tectonic on Friday March 13, 2009 @03:27PM (#515218)
Re:HTML 5 Canvas game by rufo on Friday March 13, 2009 @04:10PM (#515268)
Same thing on Safari 3.2.1 here. Works fine with WebKit, though.
Re:HTML 5 Canvas game by palish on Friday March 13, 2009 @03:17PM (#515211)
Seems to be broken in Chrome.
Re:HTML 5 Canvas game by whatusername on Friday March 13, 2009 @06:07PM (#515380)
Do the high scores not work? Or did no-one else finish a game?
Re:HTML 5 Canvas game by chris11 on Friday March 13, 2009 @06:57PM (#515418)
I got on the highscore list for garbage, so it seems to be working.
Re:HTML 5 Canvas game by whatusername on Sunday March 15, 2009 @10:52PM (#517656)
hmm.. 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"
Re:HTML 5 Canvas game by chris11 on Monday March 16, 2009 @04:15AM (#517901)
I guess you are right. I don't see any scores on there at all.
Re:HTML 5 Canvas game by lhorie on Friday March 13, 2009 @12:53PM (#515050)
The 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/demos/canvascape/ http://www.benjoffe.com/code/toys/spirograph/

Re:HTML 5 Canvas game by cousin_it on Sunday March 15, 2009 @08:02AM (#516771)
This 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.
Re:HTML 5 Canvas game by mis on Friday March 13, 2009 @01:05PM (#515063)
Cool, 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.

Re:HTML 5 Canvas game by DLWormwood on Friday March 13, 2009 @12:45PM (#515037)
Is it just me, or does the "bin" seem MUCH shallower than an official Tetris game?

Otherwise, pretty impressive for not using Flash.

Re:HTML 5 Canvas game by andhapp on Friday March 13, 2009 @09:17PM (#515539)
Anyone who does a game in Javascript rocks...so does this one. Amazing...I didn't even know you could do this...
Re:HTML 5 Canvas game by jasonkester on Friday March 13, 2009 @12:58PM (#515056)
Doesn't work in Chrome, but extra points for being the first Canvas thing here in a few weeks to support IE!
Re:HTML 5 Canvas game by mynameishere on Friday March 13, 2009 @03:51PM (#515245)
I'm thinking no one did too well. I got the high score of "2". (Unless that's broken.)
Re:HTML 5 Canvas game by jrp on Friday March 13, 2009 @10:45AM (#514911)
The controls should support holding down L/R instead of tapping only.
Re:HTML 5 Canvas game by huyslogic on Friday March 13, 2009 @11:12AM (#514942)
It does support it. Using Firefox. It's perfect.
Re:HTML 5 Canvas game by axod on Friday March 13, 2009 @01:15PM (#515071)
Only 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...

Re:HTML 5 Canvas game by pieter on Friday March 13, 2009 @11:11AM (#514938)
It does for me (Safari 3 + Webkit nightly)
Re:HTML 5 Canvas game by omouse on Friday March 13, 2009 @10:37PM (#515577)
I'm surprised at how quickly it runs in Firefox.