This course will become read-only in the near future. Tell us at if that is a problem.

Why make games in HTML 5?

Why not Flash, or iPhone apps, or one of the many other choices of technology platforms that programmers have today?

Here are 5 advantages to writing your game in HTML 5.

5. Work Anywhere

Flash doesn't run at all on iOS (iPhone/iPad) and it works poorly on Linux.  iOS apps need to be coded in Objective-C, and can't run anywhere besides an iOS device.

HTML 5 is well-supported in the latest versions of all the major desktop browsers - IE 9, Chrome, Firefox 4, Safari, and Opera.  It's not fully implemented in most mobile-phone/tablet browsers yet, but mobile browsers are going to be moving that way as they compete with each other on features.

The many mobile-phone/tablet operating systems - iOS, Android, Windows Mobile, Blackberry, Symbian - are all in a war over software standards.  It's a fragmented market.  Intercompatibility is nil.  If you wanted to write a game that could run across all operating systems, you'd have to write it once in Objective-C for iOS users, again in Java for Android users... and a third (maybe even a fourth and fifth) time for Windows, Mac, and Linux users.

But ALL of them support the Web.  Nobody wants a computing device that can't do Web pages.

There's also a pretty good chance that a game written for Web standards today will still work fifteen years from now, if you keep your web server online that long.  (After all, web pages from 1995 are still readable in modern browsers!)  Makers of web browsers have a very strong incentive not to break backwards compatibility.

4. Power

If you don't believe me, take a look at The Flight of the Navigator, an HTML 5 tech demo made last summer by the Mozilla #audio hacking team.

That's not a pre-recorded video.  Notice how you can select the text as it appears during the credits?  Everything you see and hear there is being generated live in the web page, without any plugins.  WebGL, part of the new set of web standards, is using your computer's graphics card to accelerate the 3d graphics.  The music is a .ogg file, an open encoding standard, being played via the <audio> HTML tag.

You, too, can make something with this level of graphics and sound quality in HTML 5.  And it's only going to get better as browsers compete with each other to render faster and better.

3. Integration

If you keep watching The Flight of the Navigator, you'll see picture slideshows and videos being displayed on billboards and the sides of buildings as the spaceship flies through the city.  Those slideshows are made of pictures pulled in from Flickr streams.  The videos are being pulled in from other websites.  The words scrolling around the tops of buildings are the live results of Twitter searches for #firefox and #mozilla, so you'll see new stuff there each time you run it.

Writing your game in a plugin means that it gets locked away in a little box on the page with limited ability to interact with anything else on the web page.  Writing your game in HTML 5 means your code can interact with not only the rest of your web page, but can draw from and "mash up" other web pages as well.

What new kinds of game designs are possible when your code has access to all the data and APIs of the entire Web?

2. Transparency

Do "View Source" on The Flight of the Navigator and you can see the code and learn exactly how it works.

This may sound like a drawback to some who want to keep their source code secret for whatever reason, but I believe we all become better programmers by sharing knowledge, by reading other people's source code and letting other people read ours.

1. Freedom

If you build on a proprietary platform belonging to a single company (Flash belongs to Adobe; iOS belongs to Apple) then you are at the mercy of that company deciding what you can and can't do.  Apple has a history of banning apps from their app store that they don't like.  Adobe isn't interested in supporting Linux users.  Those companies have this right -- their platform, their rules -- but that's little comfort if you're one of the developers who has been left out in the cold by their decisions.

With web standards, nobody can get between you, the game developer, and your players.  If their browser decides to stop supporting your game for whatever reason, they can switch browsers.  If your web host decides it doesn't want to host your game, you can switch web hosts.  And so on.  Web standards mean having a choice at every layer of the technology stack, and that means never being at the mercy of any particular company.

Task Discussion