SlideShare a Scribd company logo
Brewing Your
                Own Game
                  Engine
 The Pros & Cons of Using Open Source Software to
Rapidly Develop Cross-platform Indie Games and Tools
                      Ye Feng
What’s In The Talk


•   No rocket science

    From practical experience
•   Arguable
Who We Are
Project OneTap

    2D Action

 One            Casual


Button          Simple
                Puzzle
 Customizable
    Levels
Challenge:
Level Design
Level Design
Wise Man Builds His
House On The Rock


•   Option 1: Cheap Commercial Engine
•   Option 2: Open Source Engine
Cheap Commercial
             Engine
•   Pros
                            Cons
        IDE
                        •   Offline IDE
    •   Cross
        platform(when
                        •   Portability(when not
        officially          officially supported)
        supported)      •   No source code
        Moderate        •   Pure script driven
        license fee
Open Source Engine

•   Pros                  Cons

        Source code   •   No IDE
    •   Cross         •   Pure native code
        platform          driven

        Free          •   Open Source
                          License
Choice

•   Option 1: Cheap Commercial Engine

    Option 2: Open Source Engine
•   Option 3: Open Source Engine + Game
    Support Layer
    •   Allegro                         ✔
    •   http://alleg.sourceforge.net/
Demo
Why

•   Script + native code

    IDE for specific game type
•   In-game editor
•   Performance
•   etc...
What’s In It
•   Game Object System

    Script Integration
•   Physics Integration
•   Content pipeline tools

    Others
    •   Simple Scene Management

    •   Action System

        Script Key-Value Dictionary

    •   etc...
Game Object System
Inheritance &
Gameplay Development

 •   Gameplay dev nature: iteration

     Iteration causes changes
 •   Inheritance: not change-friendly
Good
Bad
Brewing Your Own Game Engie eng
Brewing Your Own Game Engie eng
Brewing Your Own Game Engie eng
Brewing Your Own Game Engie eng
Brewing Your Own Game Engie eng
Hypothesis:
Composition
Design Pattern



Favor object composition over class
inheritance
Game Object &
    Game Component

•   Composition instead of inheritance

        A object of gameplay logic
    •   Is composed by multiple functional
        components
                  Component #1
    Game           Component #2
    Object
                      Component #3
Game Object &
    Game Component


•   Add/remove component in runtime
    •   Key to build an IDE
Composition To The
     Rescue
Basic Components
•   Positioning info: Transform

    2D rendering: Sprite
•   Bitmap info: Bitmap Source
•   Input processing: Event Receiver

    Rigid body entity: Body
•   Collider entity: Fixture
•   Particle effect: Particle Emitter
•   etc...
User Components
•   Arbitrary stuff that gameplay needs

        Rotation forever
    •   A goal in level
    •   The behavior of characters

        A spike need to be avoided
    •   Line drawer needed by editor

        etc...
Demo
Script Integration
Dilemma of Native

•   Compilation time
•   Runtime modification
•   Advanced language feature
•   “Glue” code
2-tiers System To
       The Rescue

•   Core: native code
•   Editor and gameplay: script
    •   Lua
Related Works


•   Communication between native and
    script
    •   Export tools/libraries
    •   Script API
Communication -
    Native & Script
•   Simple interfaces/engine API
    •   tolua
    •   http://www.tecgraf.puc-rio.br/~celes/
    •   Simple, no compilation cost
•   Complex interfaces
    •   Lua C API
Related Works cont.

•   Serialization
    •   Load/save, editor
    •   Support for advanced features
        •   Reference
        •   Function object, closure
        •   etc...
Serialization
•   Pluto
    •   https://github.com/hoelzro/pluto
•   Write serialization code for every
    component
•   1000 lines of Lua code
Prefabricated Object
 •   Take snapshot of object
     •   Parameters
     •   References
     •   Hierarchy
 •   Assisted object design
     •   Level editor ➔ object editor
Patching



Patching binary ➔ patching data
Demo
Content Pipeline
     Tools
DCC Tools



Flash?
Pipeline


Flash
              ☹
             Export              IDE
 Animation            Manually
                      Created
                       Atlas
                                 Game
Photoshop
  Static
Solution

•   swfdec
    •   Open source Flash player
    •   LGPL
•   swfdec-dumper
    •   Surface ➔ disk
    •   https://github.com/fengye/swfdec-dum
Pipeline 2.0

            ☺
Flash      swfdec
                      ☹
 Animation dumper   Manually
                               IDE
                    Created
                     Atlas
                               Game
Photoshop
  Static
Atlas Tool

•   Stitch bitmap into Atlas
•   Automation
•   Transparent process
Texture Atlas Gen
•   nVidia Texture Atlas Tools
    •   File format support☺
    •   Mipmap☺
    •   Free☺
    •   Only for sprite sheets☹
•   Pack algorithm
Pipeline 3.0

              ☺
Flash        swfdec
             dumper    ☺
 Animation            Texture   IDE
                       Atlas
                        Gen

Photoshop                       Game

  Static
Questions?
Issues

•   Debugger
    •   Coroutine/fiber
•   Reference leak
•   Script loader
Communication
Between Components

•   Query for interface
    •   Increase coupling
•   Register message
    •   Order of notification is not defined
iPhone Version
Naive Port
•   Mac➔iPhone
•   20 FPS + Crashes
•   Possible causes:
    •   Memory out of bound
    •   Script slowdown
    •   Performance of rendering
Memory Limitation


•   Unified memory architecture
•   User program up to 112M - iPhone 4
Beyond Memory
          Limitation
•   2D Games - bitmap texture heavy

        Preallocate bitmap space
    •   22 x 1M x 4 bpp = 88M
•   Atlas

        Stitch small bitmap into atlas
    •   Automation tool is a must
Beyond Memory
          Limitation
•   Memory fragmentation

        Heap allocation & deallocation
    •   Script
•   dmalloc
    •   Drop-in, just works
Detect Perf. Issue


•   Instruments

      Mac/iPhone
•   Code intrusive profiler
Detect Perf. Issue

•   Found by intrusive profiler:

        High draw call count
•   Found by instruments:
    •   Renderer utilization 100%
    •   Tiler utilization 9 %
Reduce Draw Call
•   Common trick in desktop app

    Implementation
    •   Collect draw calls
    •   Sort, cluster calls with same
        bitmap

        Batch draw
    •   Target: reduce pipeline stall caused
        by switching textures
Reduce Draw Call


•   Before
•   After
Rendering
          Optimization
•   Fillrate

        Number of texels written to
        memory per second
    •   Desktop app, pixel-shader heavy
•   Fillrate bottleneck


✔   •   Reduce framebuffer size ➔ boost
        frame rate
Fillrate Optimization
•   Hardware limit: 221M/sec

        60 FPS: 3.6M/frame
    •   30 FPS: 7.2M/frame
•   2D Game

        Alpha-blend heavy
    •   Hard to utilize Z-buffer
Fillrate Optimization


•   Reduce overdraw

        Use Z-buffer for strictly opaque
        objects
    •   Modify art asset guideline
Demo

More Related Content

PPTX
West Coast DevCon 2014: Game Programming in UE4 - Game Framework & Sample Pro...
Gerke Max Preussner
 
PDF
Game Programming 10 - Localization
Nick Pruehs
 
PPTX
FMX 2017: Extending Unreal Engine 4 with Plug-ins (Master Class)
Gerke Max Preussner
 
PPTX
GDCE 2015: Blueprint Components to C++
Gerke Max Preussner
 
PPTX
East Coast DevCon 2014: Programming in UE4 - A Quick Orientation for Coders
Gerke Max Preussner
 
PPTX
Supersize your production pipe enjmin 2013 v1.1 hd
slantsixgames
 
PPTX
East Coast DevCon 2014: The Slate UI Framework - Architecture & Tools
Gerke Max Preussner
 
PPTX
GDC Europe 2014: Unreal Engine 4 for Programmers - Lessons Learned & Things t...
Gerke Max Preussner
 
West Coast DevCon 2014: Game Programming in UE4 - Game Framework & Sample Pro...
Gerke Max Preussner
 
Game Programming 10 - Localization
Nick Pruehs
 
FMX 2017: Extending Unreal Engine 4 with Plug-ins (Master Class)
Gerke Max Preussner
 
GDCE 2015: Blueprint Components to C++
Gerke Max Preussner
 
East Coast DevCon 2014: Programming in UE4 - A Quick Orientation for Coders
Gerke Max Preussner
 
Supersize your production pipe enjmin 2013 v1.1 hd
slantsixgames
 
East Coast DevCon 2014: The Slate UI Framework - Architecture & Tools
Gerke Max Preussner
 
GDC Europe 2014: Unreal Engine 4 for Programmers - Lessons Learned & Things t...
Gerke Max Preussner
 

What's hot (18)

PPTX
West Coast DevCon 2014: Build Automation - Epic’s Build Tools & Infrastructure
Gerke Max Preussner
 
PPTX
West Coast DevCon 2014: The Slate UI Framework (Part 2) - Game UI & Unreal Mo...
Gerke Max Preussner
 
PPTX
East Coast DevCon 2014: Game Programming in UE4 - Game Framework & Sample Pro...
Gerke Max Preussner
 
PPTX
Making an independend MMO - The Albion Online Story
David Salz
 
PDF
From Unity3D to Unreal Engine 4
Martin Pernica
 
PDF
Albion Online - Software Architecture of an MMO (talk at Quo Vadis 2016, Berlin)
David Salz
 
PDF
Confrontation Pipeline and SCons
slantsixgames
 
PPTX
West Coast DevCon 2014: Extensibility in UE4 - Customizing Your Games and the...
Gerke Max Preussner
 
PPTX
West Coast DevCon 2014: The Slate UI Framework (Part 1) - Introduction
Gerke Max Preussner
 
PPTX
03/2012 - Popping the gherkin stack
daveayan
 
PPTX
Endless runner game in unreal engine 4
Vasilis Kamakaris
 
PPT
.Net overviewrajnish
Rajnish Kalla
 
PDF
Making A Game Engine Is Easier Than You Think
Gorm Lai
 
PDF
2D Endless Runner in Unity for Mobile - GDG DevFest Istanbul 2014
Murat Gürel
 
PPTX
Tehran's 1st Android bootcamp - Part1
Mohsen Mirhoseini
 
PDF
Shell scripting with f
OnorioCatenacci
 
PDF
Future of unreal
Ning Hu
 
PPTX
Video game development for everybody
Sarah Sexton
 
West Coast DevCon 2014: Build Automation - Epic’s Build Tools & Infrastructure
Gerke Max Preussner
 
West Coast DevCon 2014: The Slate UI Framework (Part 2) - Game UI & Unreal Mo...
Gerke Max Preussner
 
East Coast DevCon 2014: Game Programming in UE4 - Game Framework & Sample Pro...
Gerke Max Preussner
 
Making an independend MMO - The Albion Online Story
David Salz
 
From Unity3D to Unreal Engine 4
Martin Pernica
 
Albion Online - Software Architecture of an MMO (talk at Quo Vadis 2016, Berlin)
David Salz
 
Confrontation Pipeline and SCons
slantsixgames
 
West Coast DevCon 2014: Extensibility in UE4 - Customizing Your Games and the...
Gerke Max Preussner
 
West Coast DevCon 2014: The Slate UI Framework (Part 1) - Introduction
Gerke Max Preussner
 
03/2012 - Popping the gherkin stack
daveayan
 
Endless runner game in unreal engine 4
Vasilis Kamakaris
 
.Net overviewrajnish
Rajnish Kalla
 
Making A Game Engine Is Easier Than You Think
Gorm Lai
 
2D Endless Runner in Unity for Mobile - GDG DevFest Istanbul 2014
Murat Gürel
 
Tehran's 1st Android bootcamp - Part1
Mohsen Mirhoseini
 
Shell scripting with f
OnorioCatenacci
 
Future of unreal
Ning Hu
 
Video game development for everybody
Sarah Sexton
 
Ad

Viewers also liked (18)

PPTX
1011 sas 實習課
景淳 許
 
PPTX
0227心理學史簡介
景淳 許
 
PDF
服務設計Ncku2013
景淳 許
 
PDF
2010淺談日本新產品開發之感心技術s
景淳 許
 
PPT
20130318 社群網路與人工智慧
景淳 許
 
PPTX
意識
景淳 許
 
PPTX
0220課程介紹(1)
景淳 許
 
KEY
独立游戏浅谈和中国独立游戏现状
Coconut Island
 
PPTX
10/04 SAS 實習課
景淳 許
 
PPTX
0313學習
景淳 許
 
PPTX
11/01 SAS 快速複習
景淳 許
 
PPTX
0927 sas實習課
景淳 許
 
PPTX
0306大腦與行為
景淳 許
 
PPTX
SAS 11/01
景淳 許
 
PPTX
0320記憶(2)
景淳 許
 
PPTX
Open data
景淳 許
 
PPTX
研究方法&工具
景淳 許
 
PPT
Class 1 f_mri_intro
景淳 許
 
1011 sas 實習課
景淳 許
 
0227心理學史簡介
景淳 許
 
服務設計Ncku2013
景淳 許
 
2010淺談日本新產品開發之感心技術s
景淳 許
 
20130318 社群網路與人工智慧
景淳 許
 
意識
景淳 許
 
0220課程介紹(1)
景淳 許
 
独立游戏浅谈和中国独立游戏现状
Coconut Island
 
10/04 SAS 實習課
景淳 許
 
0313學習
景淳 許
 
11/01 SAS 快速複習
景淳 許
 
0927 sas實習課
景淳 許
 
0306大腦與行為
景淳 許
 
SAS 11/01
景淳 許
 
0320記憶(2)
景淳 許
 
Open data
景淳 許
 
研究方法&工具
景淳 許
 
Class 1 f_mri_intro
景淳 許
 
Ad

Similar to Brewing Your Own Game Engie eng (20)

PPTX
From Web to Mobile with Stage 3D
Jean-Philippe Doiron
 
PPTX
PRESENTATION ON Game Engine
Diksha Bhargava
 
PDF
Design your 3d game engine
Daosheng Mu
 
PPTX
Game Engines for AR VR and XR- Advancements in hardware, increased adoption i...
niepaacin
 
PDF
Mono for Game Developers - AltDevConf 2012
Xamarin
 
PPT
Delta Engine @ CeBit 2011
Karsten Wysk
 
PPTX
Introduction to Game Engine: Concepts & Components
Pouya Pournasir
 
DOCX
Funky game engines
eduriez
 
PDF
Developing applications and games in Unity engine - Matej Jariabka, Rudolf Ka...
gamifi.cc
 
PPTX
Game development -session on unity 3d
Muhammad Maaz Irfan
 
PDF
Introduction to android (and mobile) game development
Ruslan Novikov
 
PDF
Android game engine
Julian Chu
 
PDF
Cocos2d game programming 2
Changwon National University
 
KEY
Game Development
Matthew Mitchell
 
PDF
Android game development
milandinic
 
PPTX
ngGoBuilder and collaborative development between San Francisco and Tokyo
notolab
 
PDF
Unity: Introduction
Václav Vančura
 
PPTX
Developing Next-Generation Games with Stage3D (Molehill)
Jean-Philippe Doiron
 
PDF
Supersize Your Production Pipe
slantsixgames
 
PDF
Choosing your Game Engine (2009)
Mark DeLoura
 
From Web to Mobile with Stage 3D
Jean-Philippe Doiron
 
PRESENTATION ON Game Engine
Diksha Bhargava
 
Design your 3d game engine
Daosheng Mu
 
Game Engines for AR VR and XR- Advancements in hardware, increased adoption i...
niepaacin
 
Mono for Game Developers - AltDevConf 2012
Xamarin
 
Delta Engine @ CeBit 2011
Karsten Wysk
 
Introduction to Game Engine: Concepts & Components
Pouya Pournasir
 
Funky game engines
eduriez
 
Developing applications and games in Unity engine - Matej Jariabka, Rudolf Ka...
gamifi.cc
 
Game development -session on unity 3d
Muhammad Maaz Irfan
 
Introduction to android (and mobile) game development
Ruslan Novikov
 
Android game engine
Julian Chu
 
Cocos2d game programming 2
Changwon National University
 
Game Development
Matthew Mitchell
 
Android game development
milandinic
 
ngGoBuilder and collaborative development between San Francisco and Tokyo
notolab
 
Unity: Introduction
Václav Vančura
 
Developing Next-Generation Games with Stage3D (Molehill)
Jean-Philippe Doiron
 
Supersize Your Production Pipe
slantsixgames
 
Choosing your Game Engine (2009)
Mark DeLoura
 

Recently uploaded (20)

PPTX
AI and Robotics for Human Well-being.pptx
JAYMIN SUTHAR
 
PDF
Trying to figure out MCP by actually building an app from scratch with open s...
Julien SIMON
 
PDF
Make GenAI investments go further with the Dell AI Factory
Principled Technologies
 
PDF
A Strategic Analysis of the MVNO Wave in Emerging Markets.pdf
IPLOOK Networks
 
PDF
The Future of Artificial Intelligence (AI)
Mukul
 
PDF
Using Anchore and DefectDojo to Stand Up Your DevSecOps Function
Anchore
 
PDF
The Future of Mobile Is Context-Aware—Are You Ready?
iProgrammer Solutions Private Limited
 
PDF
Doc9.....................................
SofiaCollazos
 
PDF
Get More from Fiori Automation - What’s New, What Works, and What’s Next.pdf
Precisely
 
PDF
Security features in Dell, HP, and Lenovo PC systems: A research-based compar...
Principled Technologies
 
PDF
Responsible AI and AI Ethics - By Sylvester Ebhonu
Sylvester Ebhonu
 
PDF
Brief History of Internet - Early Days of Internet
sutharharshit158
 
PDF
Research-Fundamentals-and-Topic-Development.pdf
ayesha butalia
 
PDF
Presentation about Hardware and Software in Computer
snehamodhawadiya
 
PPTX
IT Runs Better with ThousandEyes AI-driven Assurance
ThousandEyes
 
PPTX
New ThousandEyes Product Innovations: Cisco Live June 2025
ThousandEyes
 
PPTX
Dev Dives: Automate, test, and deploy in one place—with Unified Developer Exp...
AndreeaTom
 
PPTX
OA presentation.pptx OA presentation.pptx
pateldhruv002338
 
PDF
SparkLabs Primer on Artificial Intelligence 2025
SparkLabs Group
 
PPTX
Agile Chennai 18-19 July 2025 Ideathon | AI Powered Microfinance Literacy Gui...
AgileNetwork
 
AI and Robotics for Human Well-being.pptx
JAYMIN SUTHAR
 
Trying to figure out MCP by actually building an app from scratch with open s...
Julien SIMON
 
Make GenAI investments go further with the Dell AI Factory
Principled Technologies
 
A Strategic Analysis of the MVNO Wave in Emerging Markets.pdf
IPLOOK Networks
 
The Future of Artificial Intelligence (AI)
Mukul
 
Using Anchore and DefectDojo to Stand Up Your DevSecOps Function
Anchore
 
The Future of Mobile Is Context-Aware—Are You Ready?
iProgrammer Solutions Private Limited
 
Doc9.....................................
SofiaCollazos
 
Get More from Fiori Automation - What’s New, What Works, and What’s Next.pdf
Precisely
 
Security features in Dell, HP, and Lenovo PC systems: A research-based compar...
Principled Technologies
 
Responsible AI and AI Ethics - By Sylvester Ebhonu
Sylvester Ebhonu
 
Brief History of Internet - Early Days of Internet
sutharharshit158
 
Research-Fundamentals-and-Topic-Development.pdf
ayesha butalia
 
Presentation about Hardware and Software in Computer
snehamodhawadiya
 
IT Runs Better with ThousandEyes AI-driven Assurance
ThousandEyes
 
New ThousandEyes Product Innovations: Cisco Live June 2025
ThousandEyes
 
Dev Dives: Automate, test, and deploy in one place—with Unified Developer Exp...
AndreeaTom
 
OA presentation.pptx OA presentation.pptx
pateldhruv002338
 
SparkLabs Primer on Artificial Intelligence 2025
SparkLabs Group
 
Agile Chennai 18-19 July 2025 Ideathon | AI Powered Microfinance Literacy Gui...
AgileNetwork
 

Brewing Your Own Game Engie eng

  • 1. Brewing Your Own Game Engine The Pros & Cons of Using Open Source Software to Rapidly Develop Cross-platform Indie Games and Tools Ye Feng
  • 2. What’s In The Talk • No rocket science From practical experience • Arguable
  • 4. Project OneTap 2D Action One Casual Button Simple Puzzle Customizable Levels
  • 6. Wise Man Builds His House On The Rock • Option 1: Cheap Commercial Engine • Option 2: Open Source Engine
  • 7. Cheap Commercial Engine • Pros Cons IDE • Offline IDE • Cross platform(when • Portability(when not officially officially supported) supported) • No source code Moderate • Pure script driven license fee
  • 8. Open Source Engine • Pros Cons Source code • No IDE • Cross • Pure native code platform driven Free • Open Source License
  • 9. Choice • Option 1: Cheap Commercial Engine Option 2: Open Source Engine • Option 3: Open Source Engine + Game Support Layer • Allegro ✔ • http://alleg.sourceforge.net/
  • 10. Demo
  • 11. Why • Script + native code IDE for specific game type • In-game editor • Performance • etc...
  • 12. What’s In It • Game Object System Script Integration • Physics Integration • Content pipeline tools Others • Simple Scene Management • Action System Script Key-Value Dictionary • etc...
  • 14. Inheritance & Gameplay Development • Gameplay dev nature: iteration Iteration causes changes • Inheritance: not change-friendly
  • 15. Good
  • 16. Bad
  • 23. Design Pattern Favor object composition over class inheritance
  • 24. Game Object & Game Component • Composition instead of inheritance A object of gameplay logic • Is composed by multiple functional components Component #1 Game Component #2 Object Component #3
  • 25. Game Object & Game Component • Add/remove component in runtime • Key to build an IDE
  • 27. Basic Components • Positioning info: Transform 2D rendering: Sprite • Bitmap info: Bitmap Source • Input processing: Event Receiver Rigid body entity: Body • Collider entity: Fixture • Particle effect: Particle Emitter • etc...
  • 28. User Components • Arbitrary stuff that gameplay needs Rotation forever • A goal in level • The behavior of characters A spike need to be avoided • Line drawer needed by editor etc...
  • 29. Demo
  • 31. Dilemma of Native • Compilation time • Runtime modification • Advanced language feature • “Glue” code
  • 32. 2-tiers System To The Rescue • Core: native code • Editor and gameplay: script • Lua
  • 33. Related Works • Communication between native and script • Export tools/libraries • Script API
  • 34. Communication - Native & Script • Simple interfaces/engine API • tolua • http://www.tecgraf.puc-rio.br/~celes/ • Simple, no compilation cost • Complex interfaces • Lua C API
  • 35. Related Works cont. • Serialization • Load/save, editor • Support for advanced features • Reference • Function object, closure • etc...
  • 36. Serialization • Pluto • https://github.com/hoelzro/pluto • Write serialization code for every component • 1000 lines of Lua code
  • 37. Prefabricated Object • Take snapshot of object • Parameters • References • Hierarchy • Assisted object design • Level editor ➔ object editor
  • 39. Demo
  • 42. Pipeline Flash ☹ Export IDE Animation Manually Created Atlas Game Photoshop Static
  • 43. Solution • swfdec • Open source Flash player • LGPL • swfdec-dumper • Surface ➔ disk • https://github.com/fengye/swfdec-dum
  • 44. Pipeline 2.0 ☺ Flash swfdec ☹ Animation dumper Manually IDE Created Atlas Game Photoshop Static
  • 45. Atlas Tool • Stitch bitmap into Atlas • Automation • Transparent process
  • 46. Texture Atlas Gen • nVidia Texture Atlas Tools • File format support☺ • Mipmap☺ • Free☺ • Only for sprite sheets☹ • Pack algorithm
  • 47. Pipeline 3.0 ☺ Flash swfdec dumper ☺ Animation Texture IDE Atlas Gen Photoshop Game Static
  • 49. Issues • Debugger • Coroutine/fiber • Reference leak • Script loader
  • 50. Communication Between Components • Query for interface • Increase coupling • Register message • Order of notification is not defined
  • 52. Naive Port • Mac➔iPhone • 20 FPS + Crashes • Possible causes: • Memory out of bound • Script slowdown • Performance of rendering
  • 53. Memory Limitation • Unified memory architecture • User program up to 112M - iPhone 4
  • 54. Beyond Memory Limitation • 2D Games - bitmap texture heavy Preallocate bitmap space • 22 x 1M x 4 bpp = 88M • Atlas Stitch small bitmap into atlas • Automation tool is a must
  • 55. Beyond Memory Limitation • Memory fragmentation Heap allocation & deallocation • Script • dmalloc • Drop-in, just works
  • 56. Detect Perf. Issue • Instruments Mac/iPhone • Code intrusive profiler
  • 57. Detect Perf. Issue • Found by intrusive profiler: High draw call count • Found by instruments: • Renderer utilization 100% • Tiler utilization 9 %
  • 58. Reduce Draw Call • Common trick in desktop app Implementation • Collect draw calls • Sort, cluster calls with same bitmap Batch draw • Target: reduce pipeline stall caused by switching textures
  • 59. Reduce Draw Call • Before • After
  • 60. Rendering Optimization • Fillrate Number of texels written to memory per second • Desktop app, pixel-shader heavy • Fillrate bottleneck ✔ • Reduce framebuffer size ➔ boost frame rate
  • 61. Fillrate Optimization • Hardware limit: 221M/sec 60 FPS: 3.6M/frame • 30 FPS: 7.2M/frame • 2D Game Alpha-blend heavy • Hard to utilize Z-buffer
  • 62. Fillrate Optimization • Reduce overdraw Use Z-buffer for strictly opaque objects • Modify art asset guideline
  • 63. Demo

Editor's Notes

  • #24: GoF :我们的经验显示,设计师经常过分强调将继承作为重用技术,而事实上,如果着重以对象组合作为重用技术,则可以获得更多的可重用性以及简单的设计。