3 ms·
Either the browser supports canvas or not. It's not much more mess than that and definitely not as messy as making a normal website cross compatible.
by Kiro 15y ago
Either the browser supports canvas or not. It's not much more mess than that and definitely not as messy as making a normal website cross compatible.
- kevingadd 15y agoCanvas mostly works across browsers but there are still variances and browser-specific edge cases you have to detect. Cross-browser audio is an absolute trainwreck, and APIs like gamepad, fullscreen, etc. are all very finicky as well and will require careful effort if you want to use them in each browser. Plus, each JavaScript runtime has things it likes/doesn't like so to get playable performance for a serious game in all the browsers you'll have to spend a while figuring out how to tune your JS for all of them (or writing browser-specific versions). This is made worse by the fact that some of the major browsers don't have usable profiling tools... But sure, if all you want to do is draw some lines and bitmaps on the screen, no problem.
- sil3ntmac 15y agoAgreed. HTML5 audio is definitely a complete mess, you need shims and fallbacks if you even want to consider using it... but for the present (e.g., on modern browsers+devices), canvas seems to be the winner in terms of write-once, run-anywhere for games and animations that look great and run smooth. And since it is an open standard, we can look for other devices (smart tv's, game consoles, car dashboards... okay perhaps that is dangerous) to support it in the not-so-distant future.
- TazeTSchnitzel 15y agoYou think audio is a trainwreck? You haven't tried detecting key presses.
- stravid 15y agoCanvas is not the only option. I'm currently developing a racing game where you can build your own race track in HTML5 with my colleagues for our final university project and we don't use canvas at all. The whole game is built upon SVG, CSS3 (transform3d) and CoffeeScript and it works pretty fine, even on the iPad which is also the target platform. The limiting factor with this combination is the number of DOM elements. We are currently considering to render our racing tracks as a single image so we can remove the several SVG paths we currently use for this. If you want to take a look you can find the source on GitHub[1] or play the game[2]. Currently only Chrome and iPad are supported. But that's only because we haven't added all vendor prefixes yet. [1] https://github.com/stravid/slotcars https://github.com/stravid/slotcars [2] http://slotcars.herokuapp.com/ http://slotcars.herokuapp.com/