Pong written in both flash and HTML5. Left side is flash, right side is HTML5.
labs.codecomputerlove.com
labs.codecomputerlove.com
Awesome demo tho. Would love to see source of the flash part (maybe I missed it) so we could compare the source, not just performance (which seems to be about the same on my 5 year old laptop).
edit: who's now working on a (HTML5|Flash) vs Silverlight demo? That would be even more awesome.
Would love to hear a more elegant solution.
I'm sorry if I'm rude, but there are other characters than a-z (which I need to input quite frequently). And that is a concept English speaking developers seem rather hard to grasp (judging by most of the software out there). I just wanted to point that out.
A "right" answer is to make the keys remappable.
None of that requires those flags, so I think forcing those is not fair.
If you remove the windowless flag from Flash, you would have to add the opaque flag to HTML5 to make it a fair comparison.
I call it unfair.
Interesting that on the page they say "We believe the two technologies are not in competition" but that is exactly what this type of demo is going to stir up. While the improvements in browsers and javascript engines as of late has been nice, I think we're still a few years off from real parity, especially on lower-spec'd machines. Make no mistake, Flash on the web will be obsoleted by HTML5. But not yet, especially for all those people who don't update their browser every month.
For the time being, if Flash evangelists really wanted to make a point, they should do this same type of set up, but with a complicated (hardware-accelerated?) visualization.
HTML5's real fight is against native mobile platforms where it's competing against much richer platforms than Flash and more importantly business models that revolve around a mountain of cold hard cash people throw like confetti at the games they like.
If all it does is coexist or even entertaining the fantasy where it 'kills' Flash its lost, Flash is just the tip of casual gaming. Solipskier made $70,000 in the first 2 months of their iOS version ... against $16,000 on the Flash version (and that's more than most Flash games make).
if(collision) {
switch(side_of_screen) {
case LEFT:
horiz_speed = abs(horiz_speed);
break;
case RIGHT:
horiz_speed = -abs(horiz_speed);
break;
case TOP: // Positive Y is downward
vert_speed = abs(vert_speed);
break;
case BOTTOM:
vert_speed = -abs(vert_speed);
break;
}
}http://img201.imageshack.us/img201/8486/screenshot20101102at...
Method: Get the ball to hit a paddle on the top or bottom. It seems the code that deals with paddle collisions only imagines horizontal collisions, so, every frame (or whatever unit of time it uses), it registers a collision and reverses its horizontal direction. This is the "sticks to the paddle, vibrates, and travels up the paddle" behavior you describe. Move the paddle up and down to follow the ball's vertical movement, so it doesn't fall off. You rack up a lot of collisions very quickly like this.
This works much better on the left side, for whatever reason. I've succeeded twice in getting the ball to vibrate on the paddle while moving slow enough vertically that I can follow it and prevent it falling off. I haven't managed to do it on the right side; I have gotten it to vibrate, but only for a short time before it gets flung away.
Also, sometimes the ball vibrates on the top or bottom surface for a little while (fraction of a second). This has happened only on the left side so far.
lol i have the same situation
Of course, flash on chromium on ubuntu isn't what Adobe is optimizing for ... but that's just another reason to hope that canvas continues to do well.
MY_64B_URI="http://download.macromedia.com/pub/labs/flashplayer10/flashp...
and hence:
http://download.macromedia.com/pub/labs/flashplayer10/flashp...
Edit: I do know that "Square" isn't an official release, it's a preview, but boy is it great. 64-bit support on Linux, hooray! 32-bit with nspluginwrapper is a pile of crap and would consistently crash, also taking out Firefox before they abstracted out the plugins from the browser. Secondly given Flash Player is insecure by default, it's probably better to be using the bleeding edge release over the current stable since it's less likely to be targeted.
I think I also found a bug in the Flash version. The ball got stuck somehow at the top bar.
I'm running a 2008 iMac.
Plus who knows how each side was coded. I make games for a living and more times than not, jerkiness/glitches are an indication of bad programming than the platform it was written in. Pong is an ultra-simple game but you'd be surprised even on a game as basic as that the issues that can crop up that require elegant coding. Collision in particular -- the simplest, most obvious way in pong to check when the ball collides is to check the intersection of a point and a line, or a point and polygon/rectangle, the point being the edge of the ball (top/bottom of it for the walls, left/right of it for the paddles) versus the edge of the paddle or the whole paddle. More precise, but more math used and thus a less common way of writing the game, is to check the intersection of a circle and a line segment/polygon.
For example in flash, there are some built-in methods that everyone tends to use but don't get "pixel perfect collision" -- if you google that phrase you can see where people have tried to come up with perfect collision and how complicated all the math is for it.
I know for a fact just from playing this flash/html5 pong that it wasn't coded perfectly because it glitches when the ball gets to too high of a speed, either getting stuck in the wall and bouncing along it but not away from it, or going right through the paddle.
So this is really apples and oranges, unless both halves were coded with the exact same algorithms for everything (and just different syntax for the languages) -- very unlikely -- and, as evidenced by the other commenters also completely dependent on the environment/browser implementations of html5 and the flash plugins.
However, way cool on the link-bait worthiness :) I shoulda thought of this =P
I also noticed the flash side was smoother, while the javascript side was very jerky.
Anyway, as the author suggests, this kind of test has merely entertainment value. While 95% of Flash could be replaced by HTML5, Flash still has its place on Games.
Enable passthrough mode on all Google sites:
:autocmd LocationChange .* js modes.passAllKeys = /google\.com/.test(buffer.URL)
Or you can just press Ctrl-Z once your in the page, to temporarily go to pass-through mode.For those interested in Flash game optimization here's a video on porting Plants vs Zombies to Flash http://tv.adobe.com/watch/max-2010-develop/building-plants-v... (that would be and interesting split screen!).
The only complaint I had was that there was some sort of hit detection problem on the HTML5 side (the ball got caught inside the paddle, and the rally count shot up by about 30 in about a second). I can't hold it against the HTML5 code though, since the flash side did it to me too about 10 seconds later.
Reminded me of a BeOS demo, where windows would send each other messages about own position and the ball's physics.
Dell Mini 9 running Crunch Bang 9.10 (Ubuntu respin) with Opera 10.60.
flash (left) is faster/smoother than html5 (right), so much that right could never win.
Ball is nice and smooth on HTML5 side, and kind of jerky on flash side. That could just be Linux+flash issues, but the animation for HTML5 is super-smooth, so I'm guessing it's just bad flash plugin.
A lot of us Flash coders actually want to drop Flash from our websites, widgets and resumes. It performs bad and puts a lot of stress on the CPU, blocking my vital programs from running.
I also dont like Flash because Flex Builder is not a free tool and because of all the security issues in Flash that Adobe just never seems to get fixed. http://www.adobe.com/support/security/bulletins/apsb07-20.ht....
Potentially leaving my computer including webcam feed and microphone wide open to anyone having an exploit before I update. http://blog.guya.net/2008/10/07/malicious-camera-spying-usin....
However, I think Flash (or read Actionscript 3.0) is a necessary evil to be able to do what you want to do.. fast and to a mass audience, see this table for statistics http://www.adobe.com/products/player_census/flashplayer/vers....
I've been coding Actionscript for some time now, but only started really liking it when 3.0 came out. I remember when the Papervision project became popular I loved coding Actionscript.... I still do and I dont think JS has the right properties to become anything close to Flash.
Adobe really is on the right way by including hardware accelerated graphics. http://www.tgdaily.com/software-features/38273-adobe-flash-p....
I hope they improve upon this a bit though..