HTML5 Games for
the Real World

Jiri Kupiainen

Vice President, Rocket Pack
Disney Interactive Media Group

Twitter

#gdconline

@jiri

What to expect

"Making browser games
for today's browsers"

What not to expect

This is me

Jiri playing Guitar Hero

jiri@rocketpack.fi

Where I work

Rocket Pack Logo

Warimals

Warimals Screenshot

warimals.com

My boss

Mickey

Today's topic

HTML5 Badge

HTML5, a definition

[...]5th major revision of the core language of the World Wide Web: the Hypertext Markup Language (HTML). In this version, new features are introduced to help Web application authors, new elements are introduced based on research into prevailing authoring practices, and special attention has been given to defining clear conformance criteria for user agents in an effort to improve interoperability.

(HTML5 W3C Working Draft 25 May 2011)

HTML5, the good stuff

Let's build a game!

Concept:

Gears of War
meets
Pong!

Double Death Warball Explosion

Concept Art

Double Death Warball Explosion Concept Art

DDWBE Prototype

Features

Target Platforms

About that "Browser"...

Browser market shares (Top 20)

Browser%
MSIE 8.023,93%
Firefox 4.014,28%
Chrome 12.011,52%
Firefox 3.69,60%
Chrome 11.05,90%
MSIE 9.05,21%
Safari 5.0.53,71%
Mobile Safari 5.0.23,33%
Firefox 5.03,01%
Opera 11.112,71%
Firefox 3.51,35%
MSIE 7.01,19%
Android 2.20,97%
Safari 5.0.30,93%
Firefox 3.00,89%
Mobile Safari 0.00,85%
Mozilla 5.00,78%
Opera 11.100,54%
Safari 5.0.40,51%
Mobile Safari0,42%
Total91.62%

(Source: Wikimedia Traffic Analysis Report, June 2011)

Let's drop the ones below 1%!

Browser%
MSIE 8.023,93%
Firefox 4.014,28%
Chrome 12.011,52%
Firefox 3.69,60%
Chrome 11.05,90%
MSIE 9.05,21%
Safari 5.0.53,71%
Mobile Safari 5.0.23,33%
Firefox 5.03,01%
Opera 11.112,71%
Firefox 3.51,35%
MSIE 7.01,19%
Total85.74%

(Hey, where did Android go?)

(Total Android share: 1.54%)

Graphics!

The contestants

WebGL support in browsers

Browser%
MSIE 8.023,93%
Firefox 4.014,28%
Chrome 12.011,52%
Firefox 3.69,60%
Chrome 11.05,90%
MSIE 9.05,21%
Safari 5.0.53,71%
Mobile Safari 5.0.23,33%
Firefox 5.03,01%
Opera 11.112,71%
Firefox 3.51,35%
MSIE 7.01,19%
Full support0.00%

Not enabled for all users even where supported.

Canvas support* in browsers

* We just need sprites, man

Browser%
MSIE 8.023,93%
Firefox 4.014,28%
Chrome 12.011,52%
Firefox 3.69,60%
Chrome 11.05,90%
MSIE 9.05,21%
Safari 5.0.53,71%
Mobile Safari 5.0.23,33%
Firefox 5.03,01%
Opera 11.112,71%
Firefox 3.51,35%
MSIE 7.01,19%
Full support60.62%

Performance varies.

SVG support in browsers

Browser%
MSIE 8.023,93%
Firefox 4.014,28%
Chrome 12.011,52%
Firefox 3.69,60%
Chrome 11.05,90%
MSIE 9.05,21%
Safari 5.0.53,71%
Mobile Safari 5.0.23,33%
Firefox 5.03,01%
Opera 11.112,71%
Firefox 3.51,35%
MSIE 7.01,19%
Full support60.62%

Performance often not good enough for games.

The DOM

Netscape Navigator 2.0

(Source: Ghost Sites of the Web)

DOM Tricks & Gotchas

Avoid Repaint

Repaint is when the browser has to repaint something (doh!)

Triggered by visual changes that don't affect layout.

Takes time, but not as deadly as reflow...

Reflow

Reflow is when the browser has to recalculate geometry.

Triggered by changes that affect layout.

Avoiding Reflow

There are tools for profiling browser drawing & geometry. Use them!

IE8, 24 bit PNGs, Opacity

Fact: IE8 will mangle your 24 bit PNGs if the opacity is set to anything less than 1.

IE8, 24 bit PNG and opacity

Scaling, rotating & IE8

Google is your friend here...

Cool CSS3 Stuff

Handy for improving iOS performance, making presentations

Remember: you'll still need fallbacks
(except for things like this presentation)

iOS & Graphics

img.src = 'data:image/gif;base64,' + 'R0lGODlhAQABAAD' + '/ACwAAAAAAQABAAACADs=';

Sound!

Audio support in browsers

Browser%
MSIE 8.023,93%
Firefox 4.014,28%
Chrome 12.011,52%
Firefox 3.69,60%
Chrome 11.05,90%
MSIE 9.05,21%
Safari 5.0.53,71%
Mobile Safari 5.0.23,33%
Firefox 5.03,01%
Opera 11.112,71%
Firefox 3.51,35%
MSIE 7.01,19%
Full support60.62%

Not seen here: codec wars, buggy implementations.

HTML5 Audio format support

BrowserAACMP3OGGWAV
MSIE 8.0NoNoNoNo
Firefox 4.0NoNoYesYes
Chrome 12.0YesYesYesYes
Firefox 3.6NoNoYesYes
Chrome 11.0YesYesYesYes
MSIE 9.0YesYesNoNo
Safari 5.0.5YesYesNoYes
Mobile Safari 5.0.2YesYesNoYes
Firefox 5.0NoNoYesYes
Opera 11.11NoNoYesYes
Firefox 3.5NoNoYesYes
MSIE 7.0NoNoNoNo
5/125/127/129/12

Guess who invented
the WAV file format?

Microsoft.

So, what about IE8?

Deal with it.

Yup. Use Flash for audio.

Just use SoundManager2

Mobile Safari and Audio

However, there is a way around this. More on that later.

Input!

It mostly just works!

Input tricks & gotchas

Do not use
click events on iOS.

Simple solution:

Use touch events instead.

Networking!

(the kind that doesn't involve beer)

Web Socket support in browsers

Browser%
MSIE 8.023,93%
Firefox 4.014,28%
Chrome 12.011,52%
Firefox 3.69,60%
Chrome 11.05,90%
MSIE 9.05,21%
Safari 5.0.53,71%
Mobile Safari 5.0.23,33%
Firefox 5.03,01%
Opera 11.112,71%
Firefox 3.51,35%
MSIE 7.01,19%
Full support24.46%

Meh.

Just use Socket.IO

Deployment!

(there's, like, two slides left...)

Deployment

OMG what if someone steals my code

"Native" builds

Do I really have to deal with all this stuff?

Phew.

So, about Double Death Warball Explosion...

thanks

Thank you!

1. Check your email!

The GDC Online Event Team (and I) want to know what you think.
(consider skipping this part if you think it sucked)

2. Get the goodies!

http://jirikupiainen.com/gdco11

3. Get in touch!

@jiri | jiri@rocketpack.fi

Useful Links

Acknowledgements

HTML5 Logo by W3C

Browser support: When can I use...

Being awesome: Rocket Pack team