James Williams
LinkedInMastodonGithub

HTML5 Game Programming FAQ Day 2

Tags: HTML5 Gaming

This week I'm answering questions about HTML5 and Game Programming in general over at CodeRanch. Wednesday's questions seems to be dominated by inquiries of cross-browser feature compatibility with several variants.

Q: What are some device considerations when making HTML5 apps?

A: The best guide to check is CanIUse.com. It lists the capabilities of the mobile browsers along side the desktop browsers. YMMV when it comes to mobile browsers.

Q: What is HTML5 geolocation sometimes wrong?

A: Geolocation can be inferred in many different ways, one of which is your IP address. Sometimes your IP address can be assigned to a location other than your physical location. For example, your company or ISP might be giving you an IP for a different locality or might be routing your traffic to another site which serves as the IP of record for your request.

Q: What's the point of the audio tag?

A: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.

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.

Q: What can I use for easing functions?

A: If you aren't using RaphaelJS(SVG) which has built-in functions for easing, you could implement them yourself or try out Trident.js which allows you to almost any JavaScript property or element.