SlideShare a Scribd company logo
Browser Game Development with
           HTML5
       Chances and Pitfalls
Outline

Introduction
HTML 5
Developing with HTML and JavaScript
Showcases
Conclusion
Bytro Labs


Founded in 2009
Focus: browser based online games
Development and distribution
15 employees
2 mio. registered users
Completely independent
Bytro Labs Games

Supremacy 1914




                                Industrie Tycoon

PanzerWars



                       <HTML>
Goals:
  State of the art social browser game
  High quality graphics
  Massive number of objects rendered in real-time
  Graphical effects
     Animations
     Object Highlighting
     (Semi-) transparent Masking
  Low latency client server
  communication
  Easy access, good outreach
Outline

Introduction
HTML 5
Developing with HTML and JavaScript
Showcases
Conclusion
What is HTML 5

Collection of standards, extensions and technologies
New tags, JavaScript APIs and styling options
Plug-in less
Increasing hardware acceleration support (for graphics)
Standard(s) not finalized – “Living Standard”
HTML 5 Support




                                                        caniuse.com




                                            browser-statistik.de
- For older IE versions: Chrome Frame       25.09.2012 – Last 30 Days
HTML 5 in Topia Island


Canvas 2D
Web Sockets
CSS3
Web Storage

Planned
  Audio
  Web Worker
Outline

Introduction
HTML 5
Developing with HTML and JavaScript
Showcases
Conclusion
Client Server Architecture


    JavaScript                                        •   Visualization
                                                      •   User Interaction
                                      Client          •   Data Structures
                          client.js
             index.html                               •   Simulation Logic


                     Web Socket            Protocol: JSON


                                                     • Data Structures
Web Server                       Game Server         • Game Logic
              Java
                                                  Cassandra
                                                     DB
Developing with HTML and JavaScript


Client Server Code
  Keep Java and JavaScript data structures and code in sync
     Google Web Toolkit (GWT) – Everything in Java; JS cross-compiled
     note.js – Everything in JavaScript
     Strongly-Typed JavaScript (st-js) – Simple Java to JavaScript cross-compiler


JavaScript Code Structuring and Management
  Use supporting tools and libraries, e.g. require.js, Google Closure


JavaScript Tools Support
  Syntax highlighting and autocompleting can break easily
  Disciplined development (e.g. use Constructor / Prototype syntax,
  JSDoc type hints /** @type {string} */ var example; )
Developing with HTML and JavaScript


Backwards compatibility and Cross-Browser support
  Cross Browser libraries (e.g. jQuery)
  Polyfills


HTML GUI Development
  Missing WYSIWYG editor
      Code generation problem
  Application Suitability
      e.g. Multi-layer mouse listener problem


Future Development:
  Editors for HTML5 (e.g. Adobe Edge)
  HTML5 Libraries (e.g. CreateJS)
Outline

Introduction
HTML 5
Developing with HTML and JavaScript
Showcases
Conclusion
HTML 5 Laser Engine


Client


              Canvas 2D
mainloop
update();
render();
requestAnimationFrame();

                                   Web
                                  Storage
                      WebSocket
HTML 5 Laser Engine Showcases


Selection Bitmask
Highlight Outline
Transparent Masking
Animation
Selection Bitmask




Receive Image Data
Store Bitmask with JavaScript Bit Operations
                     imageData = canvasContext.getImageData(0, 0, image.width, image.height);
                     while(...) {
Selection Test                    ...
                                  pixelAlphaValue = imageData.data[(x + y * image.width) * 4 + 3];
                                  ...
   1. Bounding Box                if(pixelAlphaValue > threshold) {
                                              bitmask[byteIndex] |= (1 << bitIndex);
   2. Bitmask                     }
                                  ...
                     }
Highlight Outline




Setup / Init

offscreenCanvas = document.createElement('canvas');
offscreenCanvas.setAttribute('width', image.width);
offscreencanvas.setAttribute('height', image.height);
offscreenContext = offscreenCanvas.getContext('2d');
offscreenContext.drawImage(image, 0, 0);

imageData = offscreenContext.getImageData(0, 0, image.width, image.height);

while(...) {
               ...
               pixelAlphaValue = imageData.data[(x + y * image.width) * 4 + 3];
               ...
}

Draw Highlight
                                                                                        Vectorization
                                                                                  (Simplified potrace algorithm)
mainContext.beginPath();
mainContext.moveTo(point[0][0], point[0][1]);
while(...) {
             context.lineTo(point[i][0], point[i][1]);
}
context.stroke();
Transparent Masking




Draw Masked Sprite

maskBufferContext.clearRect(0, 0, spriteWidth, spriteHeight);

maskBufferContext.drawImage(spriteImage, 0, 0, spriteWidth, spriteHeight);

gradient = maskBufferContextctx.createRadialGradient(midX, midY, 0, midX, midY, spriteWidth/2);
gradient.addColorStop(0.2, 'white');
gradient.addColorStop(1, 'rgba(255,255,255,0)');
maskBufferContext.fillStyle = gradient;
maskBufferContext.globalCompositeOperation = 'destination-out';

maskBufferContext.beginPath();
maskBufferContext.arc(midX, midY, spriteWidth/2, 0, 360);
maskBufferContext.closePath();

maskBufferContext.fill();

mainContext.drawImage(maskBufferContext.canvas, spriteX, spriteY, spriteWidth, spriteHeight);
Animation




Sprite Animation
  drawImage(image, source rectangle, destination rectangle)


2D Animation
  2D Transformations
     Translate
     Scale
     Rotate
     Matrix Stack
Outline

Introduction
HTML 5
Developing with HTML and JavaScript
Showcases
Conclusion
Performance
    HTML5 Canvas 2D performance comparable with Flash and Java
    performance
    HW acceleration can not be presumed

Comparable Flash Game                       Topia Island
       ~13 FPS                                 ~18 FPS
Conclusion
   Browser Game Development with HTML5



Chances
   Browser Plug-in-less
   Increasing support
   High quality, high performance graphics


Pitfalls
   Large scale JavaScript undersupported
   Disciplined development required
   Different competing HTML5 technologies
Thank you!




www.topiaisland.com




   jobs@bytro.com

More Related Content

PDF
SVG - Scalable Vector Graphics
PDF
D3 Basic Tutorial
PDF
领域驱动设计实例讲解
PPTX
Club casa blanca
PPTX
caninos
PDF
Psychokinesis and its possible implication to warfare strategy
PDF
Modelo de gestión producepyme, centros fomento exportapyme
PDF
IBM System Networking Portfolio Update, June 2014
SVG - Scalable Vector Graphics
D3 Basic Tutorial
领域驱动设计实例讲解
Club casa blanca
caninos
Psychokinesis and its possible implication to warfare strategy
Modelo de gestión producepyme, centros fomento exportapyme
IBM System Networking Portfolio Update, June 2014

Viewers also liked (19)

PPTX
Roberto Moya Clemente
PPTX
Systematic Bytes - profile
PPTX
Horror Ideas Moodboard
PDF
3 claves para logres tu libertad financiera
PPTX
Ejemplo entrega de análisis previo Estrategia de Neuromarketing Digital Avanti
PPTX
Seminario n° 13 evaluación diente pilar y áreas edéntulas
PPTX
KB 1 Aspek Keuangan
PDF
77 2015 linea di indirizzo “le modalità di collaborazione alla valutazion...
PDF
Premier Gold Corporate Presentation
PDF
Examen de admision unasam 2013 I
PPT
Lalo Huber - Calidad en servicios de TI
PPTX
Packet light short1
PPTX
Tema libre
PDF
luke-luobio_59_2016
PDF
Vogue mediakit 2013
PDF
WoTSF: A Framework for Searching in the Web of Things (WoT)
PDF
Catálogo formación tecnicos otp 2012 ed 1 comprimido slideshare
PDF
Rehabilitacion tras cirugia de ligamento cruzado anterior
PPT
Taller de Blogger
Roberto Moya Clemente
Systematic Bytes - profile
Horror Ideas Moodboard
3 claves para logres tu libertad financiera
Ejemplo entrega de análisis previo Estrategia de Neuromarketing Digital Avanti
Seminario n° 13 evaluación diente pilar y áreas edéntulas
KB 1 Aspek Keuangan
77 2015 linea di indirizzo “le modalità di collaborazione alla valutazion...
Premier Gold Corporate Presentation
Examen de admision unasam 2013 I
Lalo Huber - Calidad en servicios de TI
Packet light short1
Tema libre
luke-luobio_59_2016
Vogue mediakit 2013
WoTSF: A Framework for Searching in the Web of Things (WoT)
Catálogo formación tecnicos otp 2012 ed 1 comprimido slideshare
Rehabilitacion tras cirugia de ligamento cruzado anterior
Taller de Blogger
Ad

Similar to HTML5 - Chances and Pitfalls (Bytro Labs GmbH) (20)

PPTX
Windows 8 Pure Imagination - 2012-11-24 - Getting your HTML5 game Windows 8 r...
PPTX
HTML5: An Overview
PPTX
An Introduction to Microsoft Edge
PDF
What is HTML5
PDF
JavaONE 2012 Using Java with HTML5 and CSS3
PDF
Jsf2 html5-jazoon
PPTX
Windows8 lightningtalk
PPTX
Introduction to HTML5 & CSS3
PDF
Building a Better Web with HTML5 and CSS3
PDF
Using Web Standards to create Interactive Data Visualizations for the Web
PDF
Talk Paris Infovis 091207132953 Phpapp01(2)
PPTX
HTML5 - A Whirlwind tour
PDF
Building a game engine with jQuery
PPT
Canvas in html5 - TungVD
PPTX
Creating 3D Worlds with WebGL and Babylon.js - Codemotion.es
PDF
HTML5 Intoduction for Web Developers
PDF
qooxdoo - Open Source Ajax Framework
PDF
Familiar HTML5 - 事例とサンプルコードから学ぶ 身近で普通に使わているHTML5
PDF
Word camp nextweb
Windows 8 Pure Imagination - 2012-11-24 - Getting your HTML5 game Windows 8 r...
HTML5: An Overview
An Introduction to Microsoft Edge
What is HTML5
JavaONE 2012 Using Java with HTML5 and CSS3
Jsf2 html5-jazoon
Windows8 lightningtalk
Introduction to HTML5 & CSS3
Building a Better Web with HTML5 and CSS3
Using Web Standards to create Interactive Data Visualizations for the Web
Talk Paris Infovis 091207132953 Phpapp01(2)
HTML5 - A Whirlwind tour
Building a game engine with jQuery
Canvas in html5 - TungVD
Creating 3D Worlds with WebGL and Babylon.js - Codemotion.es
HTML5 Intoduction for Web Developers
qooxdoo - Open Source Ajax Framework
Familiar HTML5 - 事例とサンプルコードから学ぶ 身近で普通に使わているHTML5
Word camp nextweb
Ad

Recently uploaded (20)

PDF
Electronic commerce courselecture one. Pdf
PDF
TokAI - TikTok AI Agent : The First AI Application That Analyzes 10,000+ Vira...
PPTX
1. Introduction to Computer Programming.pptx
PDF
cuic standard and advanced reporting.pdf
PDF
Encapsulation theory and applications.pdf
PPTX
SOPHOS-XG Firewall Administrator PPT.pptx
PDF
gpt5_lecture_notes_comprehensive_20250812015547.pdf
PDF
Spectral efficient network and resource selection model in 5G networks
PDF
Machine learning based COVID-19 study performance prediction
PDF
Agricultural_Statistics_at_a_Glance_2022_0.pdf
PDF
Profit Center Accounting in SAP S/4HANA, S4F28 Col11
PDF
7 ChatGPT Prompts to Help You Define Your Ideal Customer Profile.pdf
PDF
Diabetes mellitus diagnosis method based random forest with bat algorithm
PPTX
Group 1 Presentation -Planning and Decision Making .pptx
PDF
Per capita expenditure prediction using model stacking based on satellite ima...
PDF
Video forgery: An extensive analysis of inter-and intra-frame manipulation al...
PDF
MIND Revenue Release Quarter 2 2025 Press Release
PDF
Unlocking AI with Model Context Protocol (MCP)
PDF
Network Security Unit 5.pdf for BCA BBA.
PDF
NewMind AI Weekly Chronicles - August'25-Week II
Electronic commerce courselecture one. Pdf
TokAI - TikTok AI Agent : The First AI Application That Analyzes 10,000+ Vira...
1. Introduction to Computer Programming.pptx
cuic standard and advanced reporting.pdf
Encapsulation theory and applications.pdf
SOPHOS-XG Firewall Administrator PPT.pptx
gpt5_lecture_notes_comprehensive_20250812015547.pdf
Spectral efficient network and resource selection model in 5G networks
Machine learning based COVID-19 study performance prediction
Agricultural_Statistics_at_a_Glance_2022_0.pdf
Profit Center Accounting in SAP S/4HANA, S4F28 Col11
7 ChatGPT Prompts to Help You Define Your Ideal Customer Profile.pdf
Diabetes mellitus diagnosis method based random forest with bat algorithm
Group 1 Presentation -Planning and Decision Making .pptx
Per capita expenditure prediction using model stacking based on satellite ima...
Video forgery: An extensive analysis of inter-and intra-frame manipulation al...
MIND Revenue Release Quarter 2 2025 Press Release
Unlocking AI with Model Context Protocol (MCP)
Network Security Unit 5.pdf for BCA BBA.
NewMind AI Weekly Chronicles - August'25-Week II

HTML5 - Chances and Pitfalls (Bytro Labs GmbH)

  • 1. Browser Game Development with HTML5 Chances and Pitfalls
  • 2. Outline Introduction HTML 5 Developing with HTML and JavaScript Showcases Conclusion
  • 3. Bytro Labs Founded in 2009 Focus: browser based online games Development and distribution 15 employees 2 mio. registered users Completely independent
  • 4. Bytro Labs Games Supremacy 1914 Industrie Tycoon PanzerWars <HTML>
  • 5. Goals: State of the art social browser game High quality graphics Massive number of objects rendered in real-time Graphical effects Animations Object Highlighting (Semi-) transparent Masking Low latency client server communication Easy access, good outreach
  • 6. Outline Introduction HTML 5 Developing with HTML and JavaScript Showcases Conclusion
  • 7. What is HTML 5 Collection of standards, extensions and technologies New tags, JavaScript APIs and styling options Plug-in less Increasing hardware acceleration support (for graphics) Standard(s) not finalized – “Living Standard”
  • 8. HTML 5 Support caniuse.com browser-statistik.de - For older IE versions: Chrome Frame 25.09.2012 – Last 30 Days
  • 9. HTML 5 in Topia Island Canvas 2D Web Sockets CSS3 Web Storage Planned Audio Web Worker
  • 10. Outline Introduction HTML 5 Developing with HTML and JavaScript Showcases Conclusion
  • 11. Client Server Architecture JavaScript • Visualization • User Interaction Client • Data Structures client.js index.html • Simulation Logic Web Socket Protocol: JSON • Data Structures Web Server Game Server • Game Logic Java Cassandra DB
  • 12. Developing with HTML and JavaScript Client Server Code Keep Java and JavaScript data structures and code in sync Google Web Toolkit (GWT) – Everything in Java; JS cross-compiled note.js – Everything in JavaScript Strongly-Typed JavaScript (st-js) – Simple Java to JavaScript cross-compiler JavaScript Code Structuring and Management Use supporting tools and libraries, e.g. require.js, Google Closure JavaScript Tools Support Syntax highlighting and autocompleting can break easily Disciplined development (e.g. use Constructor / Prototype syntax, JSDoc type hints /** @type {string} */ var example; )
  • 13. Developing with HTML and JavaScript Backwards compatibility and Cross-Browser support Cross Browser libraries (e.g. jQuery) Polyfills HTML GUI Development Missing WYSIWYG editor Code generation problem Application Suitability e.g. Multi-layer mouse listener problem Future Development: Editors for HTML5 (e.g. Adobe Edge) HTML5 Libraries (e.g. CreateJS)
  • 14. Outline Introduction HTML 5 Developing with HTML and JavaScript Showcases Conclusion
  • 15. HTML 5 Laser Engine Client Canvas 2D mainloop update(); render(); requestAnimationFrame(); Web Storage WebSocket
  • 16. HTML 5 Laser Engine Showcases Selection Bitmask Highlight Outline Transparent Masking Animation
  • 17. Selection Bitmask Receive Image Data Store Bitmask with JavaScript Bit Operations imageData = canvasContext.getImageData(0, 0, image.width, image.height); while(...) { Selection Test ... pixelAlphaValue = imageData.data[(x + y * image.width) * 4 + 3]; ... 1. Bounding Box if(pixelAlphaValue > threshold) { bitmask[byteIndex] |= (1 << bitIndex); 2. Bitmask } ... }
  • 18. Highlight Outline Setup / Init offscreenCanvas = document.createElement('canvas'); offscreenCanvas.setAttribute('width', image.width); offscreencanvas.setAttribute('height', image.height); offscreenContext = offscreenCanvas.getContext('2d'); offscreenContext.drawImage(image, 0, 0); imageData = offscreenContext.getImageData(0, 0, image.width, image.height); while(...) { ... pixelAlphaValue = imageData.data[(x + y * image.width) * 4 + 3]; ... } Draw Highlight Vectorization (Simplified potrace algorithm) mainContext.beginPath(); mainContext.moveTo(point[0][0], point[0][1]); while(...) { context.lineTo(point[i][0], point[i][1]); } context.stroke();
  • 19. Transparent Masking Draw Masked Sprite maskBufferContext.clearRect(0, 0, spriteWidth, spriteHeight); maskBufferContext.drawImage(spriteImage, 0, 0, spriteWidth, spriteHeight); gradient = maskBufferContextctx.createRadialGradient(midX, midY, 0, midX, midY, spriteWidth/2); gradient.addColorStop(0.2, 'white'); gradient.addColorStop(1, 'rgba(255,255,255,0)'); maskBufferContext.fillStyle = gradient; maskBufferContext.globalCompositeOperation = 'destination-out'; maskBufferContext.beginPath(); maskBufferContext.arc(midX, midY, spriteWidth/2, 0, 360); maskBufferContext.closePath(); maskBufferContext.fill(); mainContext.drawImage(maskBufferContext.canvas, spriteX, spriteY, spriteWidth, spriteHeight);
  • 20. Animation Sprite Animation drawImage(image, source rectangle, destination rectangle) 2D Animation 2D Transformations Translate Scale Rotate Matrix Stack
  • 21. Outline Introduction HTML 5 Developing with HTML and JavaScript Showcases Conclusion
  • 22. Performance HTML5 Canvas 2D performance comparable with Flash and Java performance HW acceleration can not be presumed Comparable Flash Game Topia Island ~13 FPS ~18 FPS
  • 23. Conclusion Browser Game Development with HTML5 Chances Browser Plug-in-less Increasing support High quality, high performance graphics Pitfalls Large scale JavaScript undersupported Disciplined development required Different competing HTML5 technologies