HTML 5 Game

Process & Optimization


Jason Arena, Keith McCullough, Matt Leffler
Every time I discuss HTML 5 with
developers I hear the same thing…
!
It’s not ready for Primetime.
A Few Games
SpongeBob Gone Missing

(Platformer)
!
Power Rangers
(Character animation)
!
Bloomix Battle


Dora Magic Land
!
Back Story
Where we’ve been



Why the transition to HTML 5?
Our clients

• All browsers and devices
• Served into Webviews for Apps

• Easy to update with new content
For Workinman
!
!
HTML5 Environments
Engines we’ve Considered;
PlayN
Construct2

CreateJS
HAXE 

• NME (Now OpenFL)
• Flambé


A Few HTML 5 Engines
(for a good laugh)
Why Flambé
• Easy transition from Flash
• Animation support
• Good performance


Also allows for lots of builds
• HTML 5
• iOS
• Android
• Flash (for IE 8 Desktops)
• Researching Steam
WM Environments
Animation

Flump
Takes a Flash animation and creates a
tweened animation with an atlas file
!
Spriter

A stand-alone animation tool
• Bones
• State blending
!
Design

• Flash
• Photoshop
• Illustrator
!
WM Environments
Think First
There is no way for us to make graphics
for every device. 

Screen Resolutions/Ratios
• Design a modular UI (if possible)
• Scale graphics to screen size
• Bleed the rest for ratio. (Safe Area)
• Oversize art
• Responsive: Brain Crush Example
!
It’s easy to set up good keyboard input
first, but don’t forget touch!
!
Designing for both touch & keyboards
• We focus on making the game work

with touch first and then add keyboard
!
Avoid soft buttons if possible

• Especially for action games
• For some reason producers love them
Think First
No Silver Bullet
• A lot of small savings add up

• Static image compression
• Strategic use of animation tools
!
Manage the loading experience

• Show art fast!

• Keep them Clicking!
Optimization
Load time Optimizations
Break down the loading process
1. Load Splash graphic
2. Load loader graphic
3. Load UI and game play graphics
4. Load level art on demand (5MB)
!
~ We try to keep initial loads under 1MB

but sometimes it’s a judgment call.
Tips & Tricks
In extreme cases:

• Load less content on specific devices
• Load smaller animations or backgrounds
• Create device specific asset bundles
!
!
Tips & Tricks
Loader Folder
Compress static assets as much as possible
PNGs Optimization

• Posterization
• Dirty Transparency
• TinyPNG.org
• 8 Bit dithered PNG for hard edge assets
• Use 80% sized graphics. Scale them up



Use compressed JPGs as Backgrounds
!
Tips & Tricks
Compress Animations



Flump
Use for main characters
• Great for detailed Flash animations
• Typically smaller download
• Bigger memory footprint
– Show Power Rangers Characters
!
Tips & Tricks
Flump Atlas File Json FIle
Compress Animations



PNG Sequences
Best for Enemies, Power Ups, & Particles
• Lower animation Framerate
• Typically larger download
• Smaller memory footprint
!
!
Tips & Tricks
Use tweens for animation
• Lowest memory and download
• Best for small items animating
• Simple rotation
• Scaling
!
Example:

SB Gone Missing background characters
!
Tips & Tricks
General Performance: Pooling

Huge performance hit when instantiating or
disposing elements. 

Example:
• Create all particles before gameplay
• Store them in the pool array
• Only add to render list when needed
Tips & Tricks
Device Performance
• Branch to handle device exceptions
• Game may look a little different
!
Show Korra Example

Test on every device!
Tips & Tricks
Audio – different versions Mp3, OGG
!
Multi channel audio issues
• WebAudio support in iOS
• Android only supports <audio> tags
• 3rd party wrappers
!
!
Tips & Tricks
Wrappers
Ludei: Cocoon JS
• Improved Audio support
• Improved performance?
• Better memory management Vs
Webview
• Consistent cross platform environment
A lil’ Something
WM JS Embed Script

• A JS library to embed games into HTML
• Handles Scaling
• APIs for game communication
• Inform Events:
• Game to HTML
• HTML to Game
!
https://github.com/workinKeith/JSEmbed
Thank You!
Email with any questions
jason@workinman.com

Browser Based Game Performance: I’m Over My Old Flame

  • 1.
    HTML 5 Game
 Process& Optimization 
 Jason Arena, Keith McCullough, Matt Leffler
  • 2.
    Every time Idiscuss HTML 5 with developers I hear the same thing… !
  • 3.
    It’s not readyfor Primetime.
  • 4.
    A Few Games SpongeBobGone Missing
 (Platformer) ! Power Rangers (Character animation) ! Bloomix Battle 
 Dora Magic Land !
  • 5.
    Back Story Where we’vebeen
 
 Why the transition to HTML 5? Our clients
 • All browsers and devices • Served into Webviews for Apps
 • Easy to update with new content For Workinman ! !
  • 6.
    HTML5 Environments Engines we’veConsidered; PlayN Construct2
 CreateJS HAXE 
 • NME (Now OpenFL) • Flambé 
 A Few HTML 5 Engines (for a good laugh)
  • 7.
    Why Flambé • Easytransition from Flash • Animation support • Good performance 
 Also allows for lots of builds • HTML 5 • iOS • Android • Flash (for IE 8 Desktops) • Researching Steam
  • 9.
    WM Environments Animation
 Flump Takes aFlash animation and creates a tweened animation with an atlas file ! Spriter
 A stand-alone animation tool • Bones • State blending !
  • 10.
    Design
 • Flash • Photoshop •Illustrator ! WM Environments
  • 11.
    Think First There isno way for us to make graphics for every device. 
 Screen Resolutions/Ratios • Design a modular UI (if possible) • Scale graphics to screen size • Bleed the rest for ratio. (Safe Area) • Oversize art • Responsive: Brain Crush Example !
  • 12.
    It’s easy toset up good keyboard input first, but don’t forget touch! ! Designing for both touch & keyboards • We focus on making the game work
 with touch first and then add keyboard ! Avoid soft buttons if possible
 • Especially for action games • For some reason producers love them Think First
  • 13.
    No Silver Bullet •A lot of small savings add up
 • Static image compression • Strategic use of animation tools ! Manage the loading experience
 • Show art fast!
 • Keep them Clicking! Optimization
  • 14.
    Load time Optimizations Breakdown the loading process 1. Load Splash graphic 2. Load loader graphic 3. Load UI and game play graphics 4. Load level art on demand (5MB) ! ~ We try to keep initial loads under 1MB
 but sometimes it’s a judgment call. Tips & Tricks
  • 15.
    In extreme cases:
 •Load less content on specific devices • Load smaller animations or backgrounds • Create device specific asset bundles ! ! Tips & Tricks
  • 16.
  • 17.
    Compress static assetsas much as possible PNGs Optimization
 • Posterization • Dirty Transparency • TinyPNG.org • 8 Bit dithered PNG for hard edge assets • Use 80% sized graphics. Scale them up
 
 Use compressed JPGs as Backgrounds ! Tips & Tricks
  • 18.
    Compress Animations
 
 Flump Use formain characters • Great for detailed Flash animations • Typically smaller download • Bigger memory footprint – Show Power Rangers Characters ! Tips & Tricks
  • 19.
  • 20.
    Compress Animations
 
 PNG Sequences Bestfor Enemies, Power Ups, & Particles • Lower animation Framerate • Typically larger download • Smaller memory footprint ! ! Tips & Tricks
  • 21.
    Use tweens foranimation • Lowest memory and download • Best for small items animating • Simple rotation • Scaling ! Example:
 SB Gone Missing background characters ! Tips & Tricks
  • 22.
    General Performance: Pooling
 Hugeperformance hit when instantiating or disposing elements. 
 Example: • Create all particles before gameplay • Store them in the pool array • Only add to render list when needed Tips & Tricks
  • 23.
    Device Performance • Branchto handle device exceptions • Game may look a little different ! Show Korra Example
 Test on every device! Tips & Tricks
  • 24.
    Audio – differentversions Mp3, OGG ! Multi channel audio issues • WebAudio support in iOS • Android only supports <audio> tags • 3rd party wrappers ! ! Tips & Tricks
  • 25.
    Wrappers Ludei: Cocoon JS •Improved Audio support • Improved performance? • Better memory management Vs Webview • Consistent cross platform environment
  • 26.
    A lil’ Something WMJS Embed Script
 • A JS library to embed games into HTML • Handles Scaling • APIs for game communication • Inform Events: • Game to HTML • HTML to Game ! https://github.com/workinKeith/JSEmbed
  • 27.
    Thank You! Email withany questions jason@workinman.com