• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
  • Mikalai Zaikin

Beyond canvas, what are the most relevant HTML5 game related standards/technologies?

Ranch Hand
Posts: 57
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
A lot of focus on HTML5 when it comes to the web is focused on the low level (often 2d) graphic capabilities of the canvas component. I'm kind of wondering what else HTML5 brings to the table that is relevant to game programming in particular.

For example, HTML5 has the audio element, although I'm not sure what advantages it has over older methods of playing sounds.

I don't seen anything in HTML5 for things like basic geometry primitives, hit detection, animation (timers, easy in/out, etc) or support for gaming controllers (gamepads).

So some of these things are probably provided by js libraries/frameworks, but i'm wondering what other HTML5 components are there that are essential or more relevant to game programming, beyond basic drawing capabilities.

BTW - on hit detection, I was playing with some canvas stuff and the isPointInPath function to be puzzling. It works on a point hitting the current path, seems a bit useless. If you wanted to leverage it for graphical objects you create, you'd have to recreate the path (and not draw) on say a mouse click hit detection. Maybe I'm missing the point of this function ...
Posts: 35
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

The audio element is ok for playing sounds. The key value in this is that it doesn't require a plugin. It's built into the browser. There are compatibility issues between browsers on what formats are supported. The three audio types that are supported in some shape or form are OGG(Ogg Vorbis), MP3, and WAV. The audio tag does have function called canPlayType that tells you if the specific browser might support a file type.

would tell you if the current browser supports MP3 files. Return values from canPlayType are "no", "probably", or "maybe".

CanIUse.com is another useful resource. If you want to use a library to test availability of HTML5 features, check out Modernizr.

Though not as widely supported, you should look into the WebAudio API. It picks up where the Audio tag leaves off like better support for volume/gain management, multiplexing sound, etc.

Re: collision detection and things like that, I don't believe that is a core concern for HTML5 implementers. Lots of libraries exist that do collision detection and response like bullet.js and jiglib.js.

Re: Gamepads: There is a specification API for gamepads and experimental support in Chrome and Firefox, more info here (https://wiki.mozilla.org/GamepadAPI).

Re: animation: Check the other threads in this forum where I talk about requestAnimationFrame, that facilitates core animation stuff but for easing functions/etc, you would have to do that yourself. One library that I like to use for easing stuff when I'm not using RaphaelJS(SVG and has built in easing funcs) is TridentJS(https://github.com/kirillcool/trident-js)
Don't get me started about those stupid light bulbs.
    Bookmark Topic Watch Topic
  • New Topic