SlideShare une entreprise Scribd logo
1  sur  26
Télécharger pour lire hors ligne
Applying Old Videogame
                    Performance Techniques
                  to Modern Web-Based Games
                                 M. Andrés Pagella - andres.pagella@rga.com

                                 @mapagella - http://www.andrespagella.com

                         https://github.com/andrespagella/Making-Isometric-Real-time-Games



Thursday, 16 August 12
Thursday, 16 August 12
Having such an enormous reach,
             why do most indie game devs keep
             choosing Flash instead of HTML5?



                     Applying Old Videogame Performance Techniques to Modern Web-Based Games - M. Andrés Pagella

Thursday, 16 August 12
The Reasons:
                                IP Protection
                         Buggy/Unreliable Components
                              Low Performance


                     Applying Old Videogame Performance Techniques to Modern Web-Based Games - M. Andrés Pagella

Thursday, 16 August 12
IP Protection

               It’s an Ongoing subject of research

                               VNC/RDC-like solution?

                                                Obfuscation

                     Applying Old Videogame Performance Techniques to Modern Web-Based Games - M. Andrés Pagella

Thursday, 16 August 12
Buggy/Unreliable Components

         • Pick the “Lowest Common Denominator”
         • Graceful Degradation vs. Progressive
                 Enhancement? Depends on the game/product
         • ‘Autodetect’ device capabilities, but let the user
                 change them if they want to
         • Use clever techniques
                     Applying Old Videogame Performance Techniques to Modern Web-Based Games - M. Andrés Pagella

Thursday, 16 August 12
Buggy/Unreliable Components




                     Applying Old Videogame Performance Techniques to Modern Web-Based Games - M. Andrés Pagella

Thursday, 16 August 12
Buggy/Unreliable Components

                           Simple performance benchmark:

            Calculate how many DOM elements you can
                 generate in N amount of seconds.
                Alternatively (more reliable but less
                compatible): Use Canvas’ fillRect()


                     Applying Old Videogame Performance Techniques to Modern Web-Based Games - M. Andrés Pagella

Thursday, 16 August 12
Buggy/Unreliable Components

                “Lowest Common Denominator”?

             Yep, AKA Progressive Enhancement

          (Before you ask, depending on the genre, Yes, it is possible to
             make responsive, progressively enhanced web games)

                     Applying Old Videogame Performance Techniques to Modern Web-Based Games - M. Andrés Pagella

Thursday, 16 August 12
Buggy/Unreliable Components

                                     Three things to keep in mind...

                                              • Loading times
                                              • Rendering speed
                                              • Application
                                                   Responsiveness


                     Applying Old Videogame Performance Techniques to Modern Web-Based Games - M. Andrés Pagella

Thursday, 16 August 12
Buggy/Unreliable Components
                                We’re all familiar with spritesheets




                     Applying Old Videogame Performance Techniques to Modern Web-Based Games - M. Andrés Pagella

Thursday, 16 August 12
Buggy/Unreliable Components
                    Introducing... Soundsheets (AKA Audio Sprites)



                               A                                          A+ B
                                B                                                    Old school, yo


                     Applying Old Videogame Performance Techniques to Modern Web-Based Games - M. Andrés Pagella

Thursday, 16 August 12
Buggy/Unreliable Components
                    Introducing... Soundsheets (AKA Audio Sprites)


   • SoundManager 2: http://www.schillmania.com/
          projects/soundmanager2
   • Zynga’s Jukebox: https://github.com/zynga/jukebox

                     Applying Old Videogame Performance Techniques to Modern Web-Based Games - M. Andrés Pagella

Thursday, 16 August 12
Buggy/Unreliable Components
                                                      Heightmaps




                     Applying Old Videogame Performance Techniques to Modern Web-Based Games - M. Andrés Pagella

Thursday, 16 August 12
Buggy/Unreliable Components
                                                      Heightmaps




        Small 32px x 24px Image


               http://www.andrespagella.com/using-an-image-editor-as-a-mapeditor
                     Applying Old Videogame Performance Techniques to Modern Web-Based Games - M. Andrés Pagella

Thursday, 16 August 12
Rendering Speed / Paint Ops
      •       Extremely ‘expensive’, specially on mobile

      •       Try to minimise calls to the paint function

      •       No WebGL yet, sorry

      •       DOM, Canvas or SVG?

      •       Embrace that flexibility! Why do you need to pick just one?

      •       Cheat! Who cares?

      •       Most 2D games can be developed easily using ‘grids’

                     Applying Old Videogame Performance Techniques to Modern Web-Based Games - M. Andrés Pagella

Thursday, 16 August 12
Rendering Speed / Paint Ops



                                                           for (var i = 0; i < 3; ++i) {
                                                               for (var j = 0; j < 3; ++j) {
                         VIEWPORT                                  paint();
                                                               }
                                                           }




                     Applying Old Videogame Performance Techniques to Modern Web-Based Games - M. Andrés Pagella

Thursday, 16 August 12
Rendering Speed / Paint Ops


                                                           for (var i = 0; i < 3; ++i) {
                                                               for (var j = 0; j < 3; ++j) {
                                                                   if (inside_viewport()) {
                         VIEWPORT                                      paint();
                                                                   }
                                                               }
                                                           }




                     Applying Old Videogame Performance Techniques to Modern Web-Based Games - M. Andrés Pagella

Thursday, 16 August 12
Rendering Speed / Paint Ops


                                                             Try that with 1.000.000 rows
                                                             and 1.000.000 columns...
                         VIEWPORT

                                                             Tip: It won’t work



          https://github.com/andrespagella/Making-Isometric-Real-time-Games/blob/master/examples/ex7-grid-canvas-alt.html


                     Applying Old Videogame Performance Techniques to Modern Web-Based Games - M. Andrés Pagella

Thursday, 16 August 12
Rendering Speed / Paint Ops
                                       Benchmarking tests using a 2500 x 2500 grid




                              * : Uses setTimeout(), not requestAnimFrame(), which is why I’m getting 87 FPS

                     Applying Old Videogame Performance Techniques to Modern Web-Based Games - M. Andrés Pagella

Thursday, 16 August 12
Rendering Speed / Paint Ops
                                                   “Dirty Rectangles” / ATR




                     Applying Old Videogame Performance Techniques to Modern Web-Based Games - M. Andrés Pagella

Thursday, 16 August 12
Rendering Speed / Paint Ops

                                             Layering / Compositing




                           Static Layer                                            Animated Layer


                     Applying Old Videogame Performance Techniques to Modern Web-Based Games - M. Andrés Pagella

Thursday, 16 August 12
Rendering Speed / Paint Ops

                                             Layering / Compositing




                     Applying Old Videogame Performance Techniques to Modern Web-Based Games - M. Andrés Pagella

Thursday, 16 August 12
Rendering Speed / Paint Ops

                                             Layering / Compositing




                             Video Layer                                    Static / Dynamic Layer


                     Applying Old Videogame Performance Techniques to Modern Web-Based Games - M. Andrés Pagella

Thursday, 16 August 12
Application Responsiveness


      • Object pools
      • Avoid instantiating objects inside loops
      • Keep your DOM Node count low!
      • Let your init() function take care of the instatiation


                     Applying Old Videogame Performance Techniques to Modern Web-Based Games - M. Andrés Pagella

Thursday, 16 August 12
Thank you!




Thursday, 16 August 12

Contenu connexe

Similaire à Applying Old Videogame Performance Techniques to Modern Web-Based Games

Mobile crossplatformchallenges siggraph
Mobile crossplatformchallenges siggraphMobile crossplatformchallenges siggraph
Mobile crossplatformchallenges siggraph
JP Lee
 
Apache Hadoop Talk at QCon
Apache Hadoop Talk at QConApache Hadoop Talk at QCon
Apache Hadoop Talk at QCon
Cloudera, Inc.
 
Droidcon2013 triangles gangolells_imagination
Droidcon2013 triangles gangolells_imaginationDroidcon2013 triangles gangolells_imagination
Droidcon2013 triangles gangolells_imagination
Droidcon Berlin
 

Similaire à Applying Old Videogame Performance Techniques to Modern Web-Based Games (12)

John Carmack talk at SMU, April 2014 - Virtual Reality
John Carmack talk at SMU, April 2014 - Virtual RealityJohn Carmack talk at SMU, April 2014 - Virtual Reality
John Carmack talk at SMU, April 2014 - Virtual Reality
 
JavaScript Makers: How JS is Helping Drive the Maker Movement
JavaScript Makers: How JS is Helping Drive the Maker MovementJavaScript Makers: How JS is Helping Drive the Maker Movement
JavaScript Makers: How JS is Helping Drive the Maker Movement
 
05 Mobile CSS
05 Mobile CSS05 Mobile CSS
05 Mobile CSS
 
GPU accelerated path rendering fastforward
GPU accelerated path rendering fastforwardGPU accelerated path rendering fastforward
GPU accelerated path rendering fastforward
 
Mobile crossplatformchallenges siggraph
Mobile crossplatformchallenges siggraphMobile crossplatformchallenges siggraph
Mobile crossplatformchallenges siggraph
 
Mobile crossplatformchallenges siggraph
Mobile crossplatformchallenges siggraphMobile crossplatformchallenges siggraph
Mobile crossplatformchallenges siggraph
 
ToolsProgrammerResume.pdf
ToolsProgrammerResume.pdfToolsProgrammerResume.pdf
ToolsProgrammerResume.pdf
 
Apache Hadoop Talk at QCon
Apache Hadoop Talk at QConApache Hadoop Talk at QCon
Apache Hadoop Talk at QCon
 
What Ops Can Learn From Design
What Ops Can Learn From DesignWhat Ops Can Learn From Design
What Ops Can Learn From Design
 
Droidcon2013 triangles gangolells_imagination
Droidcon2013 triangles gangolells_imaginationDroidcon2013 triangles gangolells_imagination
Droidcon2013 triangles gangolells_imagination
 
AKS Computing Schemes of Work 201314
AKS Computing Schemes of Work 201314AKS Computing Schemes of Work 201314
AKS Computing Schemes of Work 201314
 
01 Mobile Web Introduction
01 Mobile Web Introduction01 Mobile Web Introduction
01 Mobile Web Introduction
 

Plus de Andres Pagella

Plus de Andres Pagella (7)

Desarrollo de videojuegos con HTML5, CSS3 y JavaScript en el Mundo Real
Desarrollo de videojuegos con HTML5, CSS3 y JavaScript en el Mundo RealDesarrollo de videojuegos con HTML5, CSS3 y JavaScript en el Mundo Real
Desarrollo de videojuegos con HTML5, CSS3 y JavaScript en el Mundo Real
 
Resolviendo Problemas Imposibles
Resolviendo Problemas ImposiblesResolviendo Problemas Imposibles
Resolviendo Problemas Imposibles
 
Memmangementjs
MemmangementjsMemmangementjs
Memmangementjs
 
onGameStart
onGameStartonGameStart
onGameStart
 
EVA 2011 - Desarrollo de Videojuegos con HTML5, CSS3 and JavaScript
EVA 2011 - Desarrollo de Videojuegos con HTML5, CSS3 and JavaScriptEVA 2011 - Desarrollo de Videojuegos con HTML5, CSS3 and JavaScript
EVA 2011 - Desarrollo de Videojuegos con HTML5, CSS3 and JavaScript
 
Barcamp 2010 - Un vistazo al futuro de la web
Barcamp 2010 - Un vistazo al futuro de la webBarcamp 2010 - Un vistazo al futuro de la web
Barcamp 2010 - Un vistazo al futuro de la web
 
JSConf Argentina 2012 - Como el Desarrollo de Videojuegos puede ayudarnos a ...
JSConf Argentina 2012 - Como el Desarrollo de Videojuegos puede ayudarnos  a ...JSConf Argentina 2012 - Como el Desarrollo de Videojuegos puede ayudarnos  a ...
JSConf Argentina 2012 - Como el Desarrollo de Videojuegos puede ayudarnos a ...
 

Dernier

Karnal Call Girls 8860008073 Dyal Singh Colony Call Girls Service in Karnal E...
Karnal Call Girls 8860008073 Dyal Singh Colony Call Girls Service in Karnal E...Karnal Call Girls 8860008073 Dyal Singh Colony Call Girls Service in Karnal E...
Karnal Call Girls 8860008073 Dyal Singh Colony Call Girls Service in Karnal E...
Apsara Of India
 
Nayabad Call Girls ✔ 8005736733 ✔ Hot Model With Sexy Bhabi Ready For Sex At ...
Nayabad Call Girls ✔ 8005736733 ✔ Hot Model With Sexy Bhabi Ready For Sex At ...Nayabad Call Girls ✔ 8005736733 ✔ Hot Model With Sexy Bhabi Ready For Sex At ...
Nayabad Call Girls ✔ 8005736733 ✔ Hot Model With Sexy Bhabi Ready For Sex At ...
aamir
 
Beautiful 😋 Call girls in Lahore 03210033448
Beautiful 😋 Call girls in Lahore 03210033448Beautiful 😋 Call girls in Lahore 03210033448
Beautiful 😋 Call girls in Lahore 03210033448
ont65320
 
Russian Escorts Agency In Goa 💚 9316020077 💚 Russian Call Girl Goa
Russian Escorts Agency In Goa  💚 9316020077 💚 Russian Call Girl GoaRussian Escorts Agency In Goa  💚 9316020077 💚 Russian Call Girl Goa
Russian Escorts Agency In Goa 💚 9316020077 💚 Russian Call Girl Goa
sexy call girls service in goa
 
Call Girls In Goa 9316020077 Goa Call Girl By Indian Call Girls Goa
Call Girls In Goa  9316020077 Goa  Call Girl By Indian Call Girls GoaCall Girls In Goa  9316020077 Goa  Call Girl By Indian Call Girls Goa
Call Girls In Goa 9316020077 Goa Call Girl By Indian Call Girls Goa
sexy call girls service in goa
 

Dernier (20)

Model Call Girls In Velappanchavadi WhatsApp Booking 7427069034 call girl ser...
Model Call Girls In Velappanchavadi WhatsApp Booking 7427069034 call girl ser...Model Call Girls In Velappanchavadi WhatsApp Booking 7427069034 call girl ser...
Model Call Girls In Velappanchavadi WhatsApp Booking 7427069034 call girl ser...
 
Behala ( Call Girls ) Kolkata ✔ 6297143586 ✔ Hot Model With Sexy Bhabi Ready ...
Behala ( Call Girls ) Kolkata ✔ 6297143586 ✔ Hot Model With Sexy Bhabi Ready ...Behala ( Call Girls ) Kolkata ✔ 6297143586 ✔ Hot Model With Sexy Bhabi Ready ...
Behala ( Call Girls ) Kolkata ✔ 6297143586 ✔ Hot Model With Sexy Bhabi Ready ...
 
Karnal Call Girls 8860008073 Dyal Singh Colony Call Girls Service in Karnal E...
Karnal Call Girls 8860008073 Dyal Singh Colony Call Girls Service in Karnal E...Karnal Call Girls 8860008073 Dyal Singh Colony Call Girls Service in Karnal E...
Karnal Call Girls 8860008073 Dyal Singh Colony Call Girls Service in Karnal E...
 
Independent Joka Escorts ✔ 8250192130 ✔ Full Night With Room Online Booking 2...
Independent Joka Escorts ✔ 8250192130 ✔ Full Night With Room Online Booking 2...Independent Joka Escorts ✔ 8250192130 ✔ Full Night With Room Online Booking 2...
Independent Joka Escorts ✔ 8250192130 ✔ Full Night With Room Online Booking 2...
 
𓀤Call On 6297143586 𓀤 Ultadanga Call Girls In All Kolkata 24/7 Provide Call W...
𓀤Call On 6297143586 𓀤 Ultadanga Call Girls In All Kolkata 24/7 Provide Call W...𓀤Call On 6297143586 𓀤 Ultadanga Call Girls In All Kolkata 24/7 Provide Call W...
𓀤Call On 6297143586 𓀤 Ultadanga Call Girls In All Kolkata 24/7 Provide Call W...
 
Nayabad Call Girls ✔ 8005736733 ✔ Hot Model With Sexy Bhabi Ready For Sex At ...
Nayabad Call Girls ✔ 8005736733 ✔ Hot Model With Sexy Bhabi Ready For Sex At ...Nayabad Call Girls ✔ 8005736733 ✔ Hot Model With Sexy Bhabi Ready For Sex At ...
Nayabad Call Girls ✔ 8005736733 ✔ Hot Model With Sexy Bhabi Ready For Sex At ...
 
5* Hotels Call Girls In Goa {{07028418221}} Call Girls In North Goa Escort Se...
5* Hotels Call Girls In Goa {{07028418221}} Call Girls In North Goa Escort Se...5* Hotels Call Girls In Goa {{07028418221}} Call Girls In North Goa Escort Se...
5* Hotels Call Girls In Goa {{07028418221}} Call Girls In North Goa Escort Se...
 
↑Top Model (Kolkata) Call Girls Rajpur ⟟ 8250192130 ⟟ High Class Call Girl In...
↑Top Model (Kolkata) Call Girls Rajpur ⟟ 8250192130 ⟟ High Class Call Girl In...↑Top Model (Kolkata) Call Girls Rajpur ⟟ 8250192130 ⟟ High Class Call Girl In...
↑Top Model (Kolkata) Call Girls Rajpur ⟟ 8250192130 ⟟ High Class Call Girl In...
 
Top Rated Pune Call Girls Dhayari ⟟ 6297143586 ⟟ Call Me For Genuine Sex Ser...
Top Rated  Pune Call Girls Dhayari ⟟ 6297143586 ⟟ Call Me For Genuine Sex Ser...Top Rated  Pune Call Girls Dhayari ⟟ 6297143586 ⟟ Call Me For Genuine Sex Ser...
Top Rated Pune Call Girls Dhayari ⟟ 6297143586 ⟟ Call Me For Genuine Sex Ser...
 
Book Paid Sonagachi Call Girls Kolkata 𖠋 8250192130 𖠋Low Budget Full Independ...
Book Paid Sonagachi Call Girls Kolkata 𖠋 8250192130 𖠋Low Budget Full Independ...Book Paid Sonagachi Call Girls Kolkata 𖠋 8250192130 𖠋Low Budget Full Independ...
Book Paid Sonagachi Call Girls Kolkata 𖠋 8250192130 𖠋Low Budget Full Independ...
 
VIP Model Call Girls Budhwar Peth ( Pune ) Call ON 8005736733 Starting From 5...
VIP Model Call Girls Budhwar Peth ( Pune ) Call ON 8005736733 Starting From 5...VIP Model Call Girls Budhwar Peth ( Pune ) Call ON 8005736733 Starting From 5...
VIP Model Call Girls Budhwar Peth ( Pune ) Call ON 8005736733 Starting From 5...
 
Beautiful 😋 Call girls in Lahore 03210033448
Beautiful 😋 Call girls in Lahore 03210033448Beautiful 😋 Call girls in Lahore 03210033448
Beautiful 😋 Call girls in Lahore 03210033448
 
Hotel And Home Service Available Kolkata Call Girls South End Park ✔ 62971435...
Hotel And Home Service Available Kolkata Call Girls South End Park ✔ 62971435...Hotel And Home Service Available Kolkata Call Girls South End Park ✔ 62971435...
Hotel And Home Service Available Kolkata Call Girls South End Park ✔ 62971435...
 
Top Rated Kolkata Call Girls Khardah ⟟ 6297143586 ⟟ Call Me For Genuine Sex S...
Top Rated Kolkata Call Girls Khardah ⟟ 6297143586 ⟟ Call Me For Genuine Sex S...Top Rated Kolkata Call Girls Khardah ⟟ 6297143586 ⟟ Call Me For Genuine Sex S...
Top Rated Kolkata Call Girls Khardah ⟟ 6297143586 ⟟ Call Me For Genuine Sex S...
 
↑Top Model (Kolkata) Call Girls Howrah ⟟ 8250192130 ⟟ High Class Call Girl In...
↑Top Model (Kolkata) Call Girls Howrah ⟟ 8250192130 ⟟ High Class Call Girl In...↑Top Model (Kolkata) Call Girls Howrah ⟟ 8250192130 ⟟ High Class Call Girl In...
↑Top Model (Kolkata) Call Girls Howrah ⟟ 8250192130 ⟟ High Class Call Girl In...
 
Russian Escorts Agency In Goa 💚 9316020077 💚 Russian Call Girl Goa
Russian Escorts Agency In Goa  💚 9316020077 💚 Russian Call Girl GoaRussian Escorts Agency In Goa  💚 9316020077 💚 Russian Call Girl Goa
Russian Escorts Agency In Goa 💚 9316020077 💚 Russian Call Girl Goa
 
Independent Hatiara Escorts ✔ 9332606886✔ Full Night With Room Online Booking...
Independent Hatiara Escorts ✔ 9332606886✔ Full Night With Room Online Booking...Independent Hatiara Escorts ✔ 9332606886✔ Full Night With Room Online Booking...
Independent Hatiara Escorts ✔ 9332606886✔ Full Night With Room Online Booking...
 
Call Girls In Goa 9316020077 Goa Call Girl By Indian Call Girls Goa
Call Girls In Goa  9316020077 Goa  Call Girl By Indian Call Girls GoaCall Girls In Goa  9316020077 Goa  Call Girl By Indian Call Girls Goa
Call Girls In Goa 9316020077 Goa Call Girl By Indian Call Girls Goa
 
Science City Kolkata ( Call Girls ) Kolkata ✔ 6297143586 ✔ Hot Model With Sex...
Science City Kolkata ( Call Girls ) Kolkata ✔ 6297143586 ✔ Hot Model With Sex...Science City Kolkata ( Call Girls ) Kolkata ✔ 6297143586 ✔ Hot Model With Sex...
Science City Kolkata ( Call Girls ) Kolkata ✔ 6297143586 ✔ Hot Model With Sex...
 
Dakshineswar Call Girls ✔ 8005736733 ✔ Hot Model With Sexy Bhabi Ready For Se...
Dakshineswar Call Girls ✔ 8005736733 ✔ Hot Model With Sexy Bhabi Ready For Se...Dakshineswar Call Girls ✔ 8005736733 ✔ Hot Model With Sexy Bhabi Ready For Se...
Dakshineswar Call Girls ✔ 8005736733 ✔ Hot Model With Sexy Bhabi Ready For Se...
 

Applying Old Videogame Performance Techniques to Modern Web-Based Games

  • 1. Applying Old Videogame Performance Techniques to Modern Web-Based Games M. Andrés Pagella - andres.pagella@rga.com @mapagella - http://www.andrespagella.com https://github.com/andrespagella/Making-Isometric-Real-time-Games Thursday, 16 August 12
  • 3. Having such an enormous reach, why do most indie game devs keep choosing Flash instead of HTML5? Applying Old Videogame Performance Techniques to Modern Web-Based Games - M. Andrés Pagella Thursday, 16 August 12
  • 4. The Reasons: IP Protection Buggy/Unreliable Components Low Performance Applying Old Videogame Performance Techniques to Modern Web-Based Games - M. Andrés Pagella Thursday, 16 August 12
  • 5. IP Protection It’s an Ongoing subject of research VNC/RDC-like solution? Obfuscation Applying Old Videogame Performance Techniques to Modern Web-Based Games - M. Andrés Pagella Thursday, 16 August 12
  • 6. Buggy/Unreliable Components • Pick the “Lowest Common Denominator” • Graceful Degradation vs. Progressive Enhancement? Depends on the game/product • ‘Autodetect’ device capabilities, but let the user change them if they want to • Use clever techniques Applying Old Videogame Performance Techniques to Modern Web-Based Games - M. Andrés Pagella Thursday, 16 August 12
  • 7. Buggy/Unreliable Components Applying Old Videogame Performance Techniques to Modern Web-Based Games - M. Andrés Pagella Thursday, 16 August 12
  • 8. Buggy/Unreliable Components Simple performance benchmark: Calculate how many DOM elements you can generate in N amount of seconds. Alternatively (more reliable but less compatible): Use Canvas’ fillRect() Applying Old Videogame Performance Techniques to Modern Web-Based Games - M. Andrés Pagella Thursday, 16 August 12
  • 9. Buggy/Unreliable Components “Lowest Common Denominator”? Yep, AKA Progressive Enhancement (Before you ask, depending on the genre, Yes, it is possible to make responsive, progressively enhanced web games) Applying Old Videogame Performance Techniques to Modern Web-Based Games - M. Andrés Pagella Thursday, 16 August 12
  • 10. Buggy/Unreliable Components Three things to keep in mind... • Loading times • Rendering speed • Application Responsiveness Applying Old Videogame Performance Techniques to Modern Web-Based Games - M. Andrés Pagella Thursday, 16 August 12
  • 11. Buggy/Unreliable Components We’re all familiar with spritesheets Applying Old Videogame Performance Techniques to Modern Web-Based Games - M. Andrés Pagella Thursday, 16 August 12
  • 12. Buggy/Unreliable Components Introducing... Soundsheets (AKA Audio Sprites) A A+ B B Old school, yo Applying Old Videogame Performance Techniques to Modern Web-Based Games - M. Andrés Pagella Thursday, 16 August 12
  • 13. Buggy/Unreliable Components Introducing... Soundsheets (AKA Audio Sprites) • SoundManager 2: http://www.schillmania.com/ projects/soundmanager2 • Zynga’s Jukebox: https://github.com/zynga/jukebox Applying Old Videogame Performance Techniques to Modern Web-Based Games - M. Andrés Pagella Thursday, 16 August 12
  • 14. Buggy/Unreliable Components Heightmaps Applying Old Videogame Performance Techniques to Modern Web-Based Games - M. Andrés Pagella Thursday, 16 August 12
  • 15. Buggy/Unreliable Components Heightmaps Small 32px x 24px Image http://www.andrespagella.com/using-an-image-editor-as-a-mapeditor Applying Old Videogame Performance Techniques to Modern Web-Based Games - M. Andrés Pagella Thursday, 16 August 12
  • 16. Rendering Speed / Paint Ops • Extremely ‘expensive’, specially on mobile • Try to minimise calls to the paint function • No WebGL yet, sorry • DOM, Canvas or SVG? • Embrace that flexibility! Why do you need to pick just one? • Cheat! Who cares? • Most 2D games can be developed easily using ‘grids’ Applying Old Videogame Performance Techniques to Modern Web-Based Games - M. Andrés Pagella Thursday, 16 August 12
  • 17. Rendering Speed / Paint Ops for (var i = 0; i < 3; ++i) { for (var j = 0; j < 3; ++j) { VIEWPORT paint(); } } Applying Old Videogame Performance Techniques to Modern Web-Based Games - M. Andrés Pagella Thursday, 16 August 12
  • 18. Rendering Speed / Paint Ops for (var i = 0; i < 3; ++i) { for (var j = 0; j < 3; ++j) { if (inside_viewport()) { VIEWPORT paint(); } } } Applying Old Videogame Performance Techniques to Modern Web-Based Games - M. Andrés Pagella Thursday, 16 August 12
  • 19. Rendering Speed / Paint Ops Try that with 1.000.000 rows and 1.000.000 columns... VIEWPORT Tip: It won’t work https://github.com/andrespagella/Making-Isometric-Real-time-Games/blob/master/examples/ex7-grid-canvas-alt.html Applying Old Videogame Performance Techniques to Modern Web-Based Games - M. Andrés Pagella Thursday, 16 August 12
  • 20. Rendering Speed / Paint Ops Benchmarking tests using a 2500 x 2500 grid * : Uses setTimeout(), not requestAnimFrame(), which is why I’m getting 87 FPS Applying Old Videogame Performance Techniques to Modern Web-Based Games - M. Andrés Pagella Thursday, 16 August 12
  • 21. Rendering Speed / Paint Ops “Dirty Rectangles” / ATR Applying Old Videogame Performance Techniques to Modern Web-Based Games - M. Andrés Pagella Thursday, 16 August 12
  • 22. Rendering Speed / Paint Ops Layering / Compositing Static Layer Animated Layer Applying Old Videogame Performance Techniques to Modern Web-Based Games - M. Andrés Pagella Thursday, 16 August 12
  • 23. Rendering Speed / Paint Ops Layering / Compositing Applying Old Videogame Performance Techniques to Modern Web-Based Games - M. Andrés Pagella Thursday, 16 August 12
  • 24. Rendering Speed / Paint Ops Layering / Compositing Video Layer Static / Dynamic Layer Applying Old Videogame Performance Techniques to Modern Web-Based Games - M. Andrés Pagella Thursday, 16 August 12
  • 25. Application Responsiveness • Object pools • Avoid instantiating objects inside loops • Keep your DOM Node count low! • Let your init() function take care of the instatiation Applying Old Videogame Performance Techniques to Modern Web-Based Games - M. Andrés Pagella Thursday, 16 August 12