SlideShare uma empresa Scribd logo
1 de 20
A Game­play Architecture for 
          Performance
            Terrance Cohen
           Insomniac Games
                7/6/2007

                   
Outline
• Preface
• Case study: Resistance GP Optimization
    – Drones
    – Aspects experiment
    Cell Performance – High Level
•
    Aspects for Performance – a Proposal
•
    Summary
•
    Moderated Discussion
•
                            
Preface
• Qualifications?
  – Performance considerations for game­play

• Not what we’re used to
  – Comments encouraged

• Looking to the future

• Many variations possible within the 
  proposed framework *
                      
Resistance GP Optimization – 
         Problem Statement
• AI and Move were expensive
• Profile was pretty flat, ie. few hot­spots
• Deferred targeting collision checks – small 
  improvement
• Designer contributions
  – Limited effect
  – Too labor­intensive to be a general­purpose 
    solution
“Massive Monolithic Updates are Bad.”
                      
Resistance GP Optimization –
               the Technique
• Decided to implement Drones
    – Very cheap (by comparison) but Convincing
    – No AI or Move
• Abilities
        Select target
    –
        Shoot
    –
        Cover (low or medium, but not full)
    –
        Die
    –
        Promote
    –
• Drones could not relocate *
                                 
Resistance GP Optimization –
            Drone Planning
• Who is a Drone and when
• Desired population
    – 3 “Affinities”: No, Medium, High
    – Fill from High Affinity if possible
    – If desired population can’t be filled with High 
      Affinity candidates, use Low Affinity ones
    – Never demote No Affinity candidates
• For Resistance, A(moby) = f(distance)
    – 2 distances fully specify Affinity Zones *
                             
Resistance GP Optimization –
          Drone Planning (cont’d)
• Promotion triggers
        When is a Drone not a Drone?
    –
        Damaged by player
    –
        Zoomed­in on
    –
        No Affinity (part of Planning)
    –
        Timed, randomized interval
    –
• Planning updated continuously
• Planning data
    – 2 Affinity Zone border distances, Desired %
    – Global (level) planning
    – Optional per­squad planning override
                                
Resistance GP Optimization –
              Results
  Drones were ~ 10% of the cost
•
  Planning worked well
•
  Squad planning data used rarely
•
  With planning, affinity, and promotion 
•
  triggers, Drones are barely noticeable
• A few scenarios still needed to be trimmed
• AI & Move fit in budget

                       
Proposal: Aspects for Performance

• Idea of Aspects taken from Aspect Oriented 
  Programming
     – Help programmers in the separation of concerns:
     – Breaking down a program into distinct parts that 
       overlap in functionality as little as possible


• Consider the high­level elements of Cell 
  performance

                            
Cell Performance ­ High Level
• Weakness
  – High penalties for cache miss and mispredicted 
    branches

• Strength
  – Parallelism!

• Approach:
  – Separate concerns, run them in parallel
  – Goals match AOP!

• These factors are likely to be more prominent in 
  future hardware
                           
Proposal: Aspects for Performance
  Systems own their data (instead of mobys) 
•
  When a System updates, it tears through its data
•
  Systems could work in parallel with other systems
•
  Tighter loops with fewer conditionals and less 
•
  branching
   – No need to test if a Game Object has a particular 
     type of data to update
• Context switches are always expensive!
• Systems operating on local data can operate more 
  efficiently

                           
Proposal: Aspects for Performance
• Infrastructure for Drones exercise in AOP

• We’ve been heading in that direction!
         Components
     –
         Physics Instances
     –
         Update Classes (to an extent)
     –
         Anim Manager
     –

• Tools have moved toward Assets
     – Lends itself well to Aspects

                                 
Proposal: Aspects for Performance
• Ultimately, GameObject is just a container
     – The container is no longer necessary!

• Game Objects would exist only as IDs on Aspect 
  instances

• Query API:
     – Aspect* GetAspect(AspectType, GameObject ID)


• Not all­or­nothing
     – gradual transition is straightforward
                                 
Aspects for Performance 
           Current Technique
• Components
    – Abstract interface to Game Objects
    – Encourages synchronous processing




                         
Aspects for Performance 
           Looking Forward
• Aspects
    – Dynamically adding/removing Aspects 
      supported in a unified way
    – Systems own their data, processing is cache­
      friendly, encourages asynch processing
    – No overhead querying for Components




                          
AOGD
             Thought Experiments
• How granular should aspects be?
• Should they be hierarchical or flat?
• Consider forming a state machine out of Aspects
    – State transitions replace the current state aspect with 
      another
    – State initialized when Aspect added
    – Support for simultaneous states
    – States communicate via shared Blackboard 
      (effectively member data)  (like “dynamic pvars”)


                                
AOGD
           Thought Experiments
• New ways of visualization / analysis
• Cool Aspect Analysis screens:
    – Aspects by owner (Game Object ID)
      • Point at Game Object and see his Aspects
      • Select an aspect and see its properties & values
         – Aspects could implement a DebugDump method
         – To TTY or to Viewport
    – Aspects by System w/ owner
    – Pivot data
                              
Aspects for Performance
           Misc. Considerations
• Sharing data between Aspects
    – “cross­cutting concerns” in AOP lingo
    – Implement as systems see fit
       • Shared Data uploaded with multiple systems
       • System refers to data owned by other system


• Debugging
    – Effectively the same as before
       • Debugging the affected system
    – Debugger scripting could assist in locating objects 
      within other systems

                                  
Summary
    Drones were a very effective optimization
•
    Provided a limited test of Aspects
•
    Cell performance demands parallelism
•
    Aspect oriented game development plays 
•
    directly into the strengths and weaknesses 
    of the Cell



                         
Moderated Discussion
• Speak Up




               

Mais conteúdo relacionado

Semelhante a A Game-play Architecture for Performance

PHX Session #1: Development Best Practices And How Microsoft Helps
PHX Session #1: Development  Best  Practices And  How  Microsoft  HelpsPHX Session #1: Development  Best  Practices And  How  Microsoft  Helps
PHX Session #1: Development Best Practices And How Microsoft HelpsSteve Lange
 
How To Write A SQL Server Performance Review
How To Write A SQL Server Performance ReviewHow To Write A SQL Server Performance Review
How To Write A SQL Server Performance ReviewQuest Software
 
“Practical DNN Quantization Techniques and Tools,” a Presentation from Facebook
“Practical DNN Quantization Techniques and Tools,” a Presentation from Facebook“Practical DNN Quantization Techniques and Tools,” a Presentation from Facebook
“Practical DNN Quantization Techniques and Tools,” a Presentation from FacebookEdge AI and Vision Alliance
 
Implementing a production Shibboleth IdP service at Cardiff University
Implementing a production Shibboleth IdP service at Cardiff UniversityImplementing a production Shibboleth IdP service at Cardiff University
Implementing a production Shibboleth IdP service at Cardiff UniversityJISC.AM
 
Distributed Caches: A Developer’s Guide to Unleashing Your Data in High-Perfo...
Distributed Caches: A Developer’s Guide to Unleashing Your Data in High-Perfo...Distributed Caches: A Developer’s Guide to Unleashing Your Data in High-Perfo...
Distributed Caches: A Developer’s Guide to Unleashing Your Data in High-Perfo...marcja
 
Android Bootcamp
Android   BootcampAndroid   Bootcamp
Android Bootcampahkjsdcsadc
 
Gridify your Spring application with Grid Gain @ Spring Italian Meeting 2008
Gridify your Spring application with Grid Gain @ Spring Italian Meeting 2008Gridify your Spring application with Grid Gain @ Spring Italian Meeting 2008
Gridify your Spring application with Grid Gain @ Spring Italian Meeting 2008Sergio Bossa
 
Rails Conf Europe 2007 Notes
Rails Conf  Europe 2007  NotesRails Conf  Europe 2007  Notes
Rails Conf Europe 2007 NotesRoss Lawley
 
Adopting Karpenter for Cost and Simplicity at Grafana Labs.pdf
Adopting Karpenter for Cost and Simplicity at Grafana Labs.pdfAdopting Karpenter for Cost and Simplicity at Grafana Labs.pdf
Adopting Karpenter for Cost and Simplicity at Grafana Labs.pdfMichaelOLeary82
 
Smart Client Development
Smart Client DevelopmentSmart Client Development
Smart Client DevelopmentTamir Khason
 
Automated Performance Testing With J Meter And Maven
Automated  Performance  Testing With  J Meter And  MavenAutomated  Performance  Testing With  J Meter And  Maven
Automated Performance Testing With J Meter And MavenPerconaPerformance
 
Analysis Services Best Practices From Large Deployments
Analysis Services   Best Practices From Large DeploymentsAnalysis Services   Best Practices From Large Deployments
Analysis Services Best Practices From Large Deploymentsrsnarayanan
 
Web 2.0 Performance and Reliability: How to Run Large Web Apps
Web 2.0 Performance and Reliability: How to Run Large Web AppsWeb 2.0 Performance and Reliability: How to Run Large Web Apps
Web 2.0 Performance and Reliability: How to Run Large Web Appsadunne
 
Perfmon And Profiler 101
Perfmon And Profiler 101Perfmon And Profiler 101
Perfmon And Profiler 101Quest Software
 

Semelhante a A Game-play Architecture for Performance (20)

PHX Session #1: Development Best Practices And How Microsoft Helps
PHX Session #1: Development  Best  Practices And  How  Microsoft  HelpsPHX Session #1: Development  Best  Practices And  How  Microsoft  Helps
PHX Session #1: Development Best Practices And How Microsoft Helps
 
How To Write A SQL Server Performance Review
How To Write A SQL Server Performance ReviewHow To Write A SQL Server Performance Review
How To Write A SQL Server Performance Review
 
Parallel Processing Concepts
Parallel Processing Concepts Parallel Processing Concepts
Parallel Processing Concepts
 
“Practical DNN Quantization Techniques and Tools,” a Presentation from Facebook
“Practical DNN Quantization Techniques and Tools,” a Presentation from Facebook“Practical DNN Quantization Techniques and Tools,” a Presentation from Facebook
“Practical DNN Quantization Techniques and Tools,” a Presentation from Facebook
 
Implementing a production Shibboleth IdP service at Cardiff University
Implementing a production Shibboleth IdP service at Cardiff UniversityImplementing a production Shibboleth IdP service at Cardiff University
Implementing a production Shibboleth IdP service at Cardiff University
 
Distributed Caches: A Developer’s Guide to Unleashing Your Data in High-Perfo...
Distributed Caches: A Developer’s Guide to Unleashing Your Data in High-Perfo...Distributed Caches: A Developer’s Guide to Unleashing Your Data in High-Perfo...
Distributed Caches: A Developer’s Guide to Unleashing Your Data in High-Perfo...
 
Synergis University 2014 - Inventor Performance Optimization
Synergis University 2014 - Inventor Performance OptimizationSynergis University 2014 - Inventor Performance Optimization
Synergis University 2014 - Inventor Performance Optimization
 
Android Bootcamp
Android   BootcampAndroid   Bootcamp
Android Bootcamp
 
Magee Dday2 Fixing App Performance Italiano
Magee Dday2 Fixing App Performance ItalianoMagee Dday2 Fixing App Performance Italiano
Magee Dday2 Fixing App Performance Italiano
 
Gridify your Spring application with Grid Gain @ Spring Italian Meeting 2008
Gridify your Spring application with Grid Gain @ Spring Italian Meeting 2008Gridify your Spring application with Grid Gain @ Spring Italian Meeting 2008
Gridify your Spring application with Grid Gain @ Spring Italian Meeting 2008
 
Rails Conf Europe 2007 Notes
Rails Conf  Europe 2007  NotesRails Conf  Europe 2007  Notes
Rails Conf Europe 2007 Notes
 
Qure Tech Presentation
Qure Tech PresentationQure Tech Presentation
Qure Tech Presentation
 
Adopting Karpenter for Cost and Simplicity at Grafana Labs.pdf
Adopting Karpenter for Cost and Simplicity at Grafana Labs.pdfAdopting Karpenter for Cost and Simplicity at Grafana Labs.pdf
Adopting Karpenter for Cost and Simplicity at Grafana Labs.pdf
 
Smart Client Development
Smart Client DevelopmentSmart Client Development
Smart Client Development
 
Automated Performance Testing With J Meter And Maven
Automated  Performance  Testing With  J Meter And  MavenAutomated  Performance  Testing With  J Meter And  Maven
Automated Performance Testing With J Meter And Maven
 
Seminar - JBoss Migration
Seminar - JBoss MigrationSeminar - JBoss Migration
Seminar - JBoss Migration
 
Android performance
Android performanceAndroid performance
Android performance
 
Analysis Services Best Practices From Large Deployments
Analysis Services   Best Practices From Large DeploymentsAnalysis Services   Best Practices From Large Deployments
Analysis Services Best Practices From Large Deployments
 
Web 2.0 Performance and Reliability: How to Run Large Web Apps
Web 2.0 Performance and Reliability: How to Run Large Web AppsWeb 2.0 Performance and Reliability: How to Run Large Web Apps
Web 2.0 Performance and Reliability: How to Run Large Web Apps
 
Perfmon And Profiler 101
Perfmon And Profiler 101Perfmon And Profiler 101
Perfmon And Profiler 101
 

A Game-play Architecture for Performance

  • 1. A Game­play Architecture for  Performance Terrance Cohen Insomniac Games 7/6/2007    
  • 2. Outline • Preface • Case study: Resistance GP Optimization – Drones – Aspects experiment Cell Performance – High Level • Aspects for Performance – a Proposal • Summary • Moderated Discussion •    
  • 3. Preface • Qualifications? – Performance considerations for game­play • Not what we’re used to – Comments encouraged • Looking to the future • Many variations possible within the  proposed framework *    
  • 4. Resistance GP Optimization –  Problem Statement • AI and Move were expensive • Profile was pretty flat, ie. few hot­spots • Deferred targeting collision checks – small  improvement • Designer contributions – Limited effect – Too labor­intensive to be a general­purpose  solution “Massive Monolithic Updates are Bad.”    
  • 5. Resistance GP Optimization – the Technique • Decided to implement Drones – Very cheap (by comparison) but Convincing – No AI or Move • Abilities Select target – Shoot – Cover (low or medium, but not full) – Die – Promote – • Drones could not relocate *    
  • 6. Resistance GP Optimization – Drone Planning • Who is a Drone and when • Desired population – 3 “Affinities”: No, Medium, High – Fill from High Affinity if possible – If desired population can’t be filled with High  Affinity candidates, use Low Affinity ones – Never demote No Affinity candidates • For Resistance, A(moby) = f(distance) – 2 distances fully specify Affinity Zones *    
  • 7. Resistance GP Optimization – Drone Planning (cont’d) • Promotion triggers When is a Drone not a Drone? – Damaged by player – Zoomed­in on – No Affinity (part of Planning) – Timed, randomized interval – • Planning updated continuously • Planning data – 2 Affinity Zone border distances, Desired % – Global (level) planning – Optional per­squad planning override    
  • 8. Resistance GP Optimization – Results Drones were ~ 10% of the cost • Planning worked well • Squad planning data used rarely • With planning, affinity, and promotion  • triggers, Drones are barely noticeable • A few scenarios still needed to be trimmed • AI & Move fit in budget    
  • 9. Proposal: Aspects for Performance • Idea of Aspects taken from Aspect Oriented  Programming – Help programmers in the separation of concerns: – Breaking down a program into distinct parts that  overlap in functionality as little as possible • Consider the high­level elements of Cell  performance    
  • 10. Cell Performance ­ High Level • Weakness – High penalties for cache miss and mispredicted  branches • Strength – Parallelism! • Approach: – Separate concerns, run them in parallel – Goals match AOP! • These factors are likely to be more prominent in  future hardware    
  • 11. Proposal: Aspects for Performance Systems own their data (instead of mobys)  • When a System updates, it tears through its data • Systems could work in parallel with other systems • Tighter loops with fewer conditionals and less  • branching – No need to test if a Game Object has a particular  type of data to update • Context switches are always expensive! • Systems operating on local data can operate more  efficiently    
  • 12. Proposal: Aspects for Performance • Infrastructure for Drones exercise in AOP • We’ve been heading in that direction! Components – Physics Instances – Update Classes (to an extent) – Anim Manager – • Tools have moved toward Assets – Lends itself well to Aspects    
  • 13. Proposal: Aspects for Performance • Ultimately, GameObject is just a container – The container is no longer necessary! • Game Objects would exist only as IDs on Aspect  instances • Query API: – Aspect* GetAspect(AspectType, GameObject ID) • Not all­or­nothing – gradual transition is straightforward    
  • 14. Aspects for Performance  Current Technique • Components – Abstract interface to Game Objects – Encourages synchronous processing    
  • 15. Aspects for Performance  Looking Forward • Aspects – Dynamically adding/removing Aspects  supported in a unified way – Systems own their data, processing is cache­ friendly, encourages asynch processing – No overhead querying for Components    
  • 16. AOGD Thought Experiments • How granular should aspects be? • Should they be hierarchical or flat? • Consider forming a state machine out of Aspects – State transitions replace the current state aspect with  another – State initialized when Aspect added – Support for simultaneous states – States communicate via shared Blackboard  (effectively member data)  (like “dynamic pvars”)    
  • 17. AOGD Thought Experiments • New ways of visualization / analysis • Cool Aspect Analysis screens: – Aspects by owner (Game Object ID) • Point at Game Object and see his Aspects • Select an aspect and see its properties & values – Aspects could implement a DebugDump method – To TTY or to Viewport – Aspects by System w/ owner – Pivot data    
  • 18. Aspects for Performance Misc. Considerations • Sharing data between Aspects – “cross­cutting concerns” in AOP lingo – Implement as systems see fit • Shared Data uploaded with multiple systems • System refers to data owned by other system • Debugging – Effectively the same as before • Debugging the affected system – Debugger scripting could assist in locating objects  within other systems    
  • 19. Summary Drones were a very effective optimization • Provided a limited test of Aspects • Cell performance demands parallelism • Aspect oriented game development plays  • directly into the strengths and weaknesses  of the Cell