4. My Perspective on the Last Decade & Web Tech4GPU AccelerationC++ in BrowserChrome OS
5. April 1 2010 – Quake II in HTML5Ray Cromwell, Stefan Haustein, Joel Webber – Google- WebGL, canvas- Web Sockets- Local Storage- AudioChrome & Safari5
13. Mobile Native or Web App?iOS & Android Monetize Native AppsWebApp wrappers: PhoneGap, appMobiPerformanceNative has greater perf, butOn Android, can call through to C++ from JSForms InputHTML5 input forms produce correct input deviceTouch13
16. Chrome Web StoreDiscovery, Distribution and Monetization on the Web16Web Apps120 million usersIn-app payments coming soongoogle.com/checkout/inapp… And Monetization
21. Canvas 2D – OverviewMostly SpritesFlash Widely supported (mobile & desktop)IE9 brings GPU performanceJavscript Shim Libraries run on old IE, e.g. ExplorerCanvasGPU upgrades Hundreds to Thousands of Draws @30fpsImmediate ModePopular21
22. Canvas 2D – APIPrimitivesrect, circle arcs, lines, bezier curves, text, imagesDrawingfill and strokeEffectsshadows, gradients, image patterns, line styles, clipping, compositing operationsTransformsrotate, scale, matrix transform (2x2 + translation)22Text
23. Canvas 2D – Simple Sample<canvas id="e" width="200" height="100"></canvas><script> var context =document.getElementById("e").getContext("2d"); var cat = new Image(); cat.src = "images/cat.png"; cat.onload = function() { context.drawImage(cat, 0, 0); };</script>23
35. WebGL – OverviewOpen GL ES 2Textures, Framebuffers, BlendingVertex and Fragment Shaders (GLSL)Khronos group specification 1.0 Q1 2011Matrix libraries come separatelyWhat will Microsoft do?35
58. <audio> – Sample var audio = new Audio();audio.addEventListener("canplaythrough", function () { audio.play(); });audio.src = “treasure.ogg”;58
59. <audio> – IssuesiOS >= 4 – only one sample at a timeNo one codec supported by all browsers. Pick 2 from: MP3, Vorbis, WAVdetect suitability before loading, with e.g. new Audio().canPlayType(“audio/ogg”);59
60. <audio> – Future1FireFox Audio Data API supports Read/Write samplesvar output = new Audio();output.mozSetup(1, 44100);var samples = new Float32Array(22050);varlen = samples.length; for (vari = 0; i < samples.length ; i++) { samples[i] = Math.sin( i / 20 ); }output.mozWriteAudio(samples);60
68. WebSockets – OverviewLow latency, persistent, full duplex Upgrades from HTTP handshakeUTF8Simplevar socket = new WebSocket(“ws://server.com”);socket.onopen = function(event) { socket.send(“Hello Server”); }socket.onmessage = function(event) { alert(“Server says: “ + event.data);68
69. WebSockets - FutureFireFox and Opera Behind FlagStandard for protocol upgradeBinaryPeer to PeerUnreliable (vs TCP)69
70. WebSockets – Linkssocket.ioHigher level libraryTransport on WebSockets, Flash, Ajax, …github.com/gimite/web-socket-jsShim implementation on top of Flash70
71. Web Sockets – AvailabilityChrome – Firefox – Safari: Yes, Still Stabilizing, Some Behind a FlagInternet Explorer: In HTML5 LabsMobile: iOS Stabilizing, Android?71- caniuse.com, Feb 2011
73. Node.JS – OverviewEase of Same Language and Client & ServerSimple, lots of uptakeTools / PluginsWebSockets, manage connections, render server side, just lots...Visual Debugger73
83. Web Storage – OverviewLocal Storage & Session Storage5MB of key value pair stringslocalStorage["levels-unlocked"] = 5 // or .getItem() / .setItem()localStorage.removeItem()localStorage.clear(); // Dump everythingWidely supportedNon TransactionalNo good recourse if over limit83
84. Web Storage – AvailabilityChrome – Firefox – Safari: GO!Internet Explorer: GO!Mobile: GO!84- caniuse.com, Feb 2011
85. File API: Directories & Systems – AvailabilityChrome: Yes for Apps and ExtensionsFirefox – Safari: NoInternet Explorer: NoMobile: No85
86. Application Cache – OverviewCache HTML pages and ResourcesManifest File CACHE MANIFEST index.html stylesheet.css images/logo.png scripts/main.js86
93. Native Client – OverviewMachine Code Served to BrowserC/C++, Mono(C#), othersNoPluginsLegacy C++ Codebase in your Web AppPerformanceCross Platform93A Web PageFull of text, lots of interesting stuff, links, blah blah. Don’t read all the links, all this text.JSA Web PageFull of text, lots of interesting stuff, links, blah blah. Don’t read all the links, all this text.C++
97. GPU AccelerationChrome 9WebGL shipped February 3rdChrome Developer & CanaryVideo, 3D CSS, Canvas 2D, CompositingFirefox 4 BetaWebGL, Video, 2D CSS, Canvas 2D, SVG, CompositingIE 9 Beta“all graphics and text rendering”97
98. Benchmarks NeededJSGameBench, Facebook“over 125 million people visit Facebook using HTML5 capable browsers just from their mobile phone”Sprite performance, options (WebGL, <canvas>, <img>, <div>, …)1000-4000 @30fps on GPU50-200 mid range desktops20-30 iOS & Android98
101. More! At GDCGoogle Sessions Today and TomorrowCloud Services, WebGL, Native Client, YouTube APIsAndroid AndroidAndroidAndroidAndroidGoogle BoothSketchup,Web Store, WebGL Native Client, AppEngine, AndroidOther HTML5 SessionsWebGL News and Technology Updates (Khronos), ThursdayGetting Your Games onto the BlackBerry PlayBook Tablet, ThursdayHTML5: The New UI Library for Games, Friday101
- New and Upcoming tech- Why care - Zero friction – available in browser, no plugins - Forward looking – Some tech ready today, more coming - Mobile – Many platforms, ubiquity
- No Flash on iOS browser- Security an issue with plugins
- Important metric is how many users will play, if a plugin is installed already or not
-Plugins worst – full permission for any web page
-Lots of options on desktop-iOS limited!-Webkit on several
-WebKit over 50%-HTML5 support pervasive
-WebKit over 50%-HTML5 support pervasive
- Android allows C++/Java from JS- Rich input if correct forms used- Android has simple touch, iOSmultitouch
120M Chrome users
- Synced between browsers- Easy offline- Permissions cleared at “install” time
CWS is a new platform for distributing games and apps on the webTargeted at 120M Chrome usersMonetization currently includes in-store payments and adsIn-app payments solution is coming soon and is a perfect fit for gamesSign up for early betaMore details at the booth
- 2D context, widely supported (IE9)- Procedural images- Dynamic OK, but not designed specifically for “animated frames”
-Simple 2D- Physics- Shooters (typing shooter) “Z-type”-Retro Sprite “Onslaught”- MMO Scrabble “Word Squared”-3D (mostly flat, though textured possible to)
-DrawImage takes Sub Regions as well
- Implementations around for 5 years, standard started 10 years ago
-EXTERNAL Javascript tool-Capturevis HUD-Step Draw Calls-State-Texture state-Texture Browser-Shader programs, view parameters-View shaders-View data buffers as well
-Optional to use Google API, but easy
-Larger API
-Larger API
-Editor’s Draft
-W3C Editors Draft of Spec
-3 component accelerations, rotations-interval in milliseconds
-Session storage clears at end of session
-HTML5
-Copies message data between processes-No DOM access
-Plugins have full access to OS-JS safely sandboxed, browser offers security-NaCl does the same for C++