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

What's hot (18)

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

Viewers also liked (18)

PPTX
1011 sas 實習課
PPTX
0227心理學史簡介
PDF
服務設計Ncku2013
PDF
2010淺談日本新產品開發之感心技術s
PPT
20130318 社群網路與人工智慧
PPTX
意識
PPTX
0220課程介紹(1)
KEY
独立游戏浅谈和中国独立游戏现状
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)
独立游戏浅谈和中国独立游戏现状
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
PDF
De Re PlayStation Vita
PPTX
Maximize Your Production Effort (English)
PPTX
Unity 3D VS your team
PDF
Game design & development
PDF
Developing applications and games in Unity engine - Matej Jariabka, Rudolf Ka...
PDF
Mono for Game Developers - AltDevConf 2012
PDF
Supersize Your Production Pipe
PDF
Native Code is Dead AKA Cross Platform Development with Unity 3D
PDF
Cross-Platform Desktop Apps with Electron
PPTX
Making HTML5 Games with Phaser
PDF
Masterin Large Scale Java Script Applications
PPTX
The next generation of GPU APIs for Game Engines
PPTX
Game development -session on unity 3d
PPT
2004: Söldner - a Post Mortem
PPTX
Radu vunvulea building and testing windows 8 metro style applications using ...
KEY
20120802 timisoara
PPTX
Massively Social != Massively Multiplayer
PDF
Creating Casual Games for Windows 8
PPTX
Шлигін Олександр “Розробка ігор в Unity загальні помилки” GameDev Conference ...
From Web to Mobile with Stage 3D
De Re PlayStation Vita
Maximize Your Production Effort (English)
Unity 3D VS your team
Game design & development
Developing applications and games in Unity engine - Matej Jariabka, Rudolf Ka...
Mono for Game Developers - AltDevConf 2012
Supersize Your Production Pipe
Native Code is Dead AKA Cross Platform Development with Unity 3D
Cross-Platform Desktop Apps with Electron
Making HTML5 Games with Phaser
Masterin Large Scale Java Script Applications
The next generation of GPU APIs for Game Engines
Game development -session on unity 3d
2004: Söldner - a Post Mortem
Radu vunvulea building and testing windows 8 metro style applications using ...
20120802 timisoara
Massively Social != Massively Multiplayer
Creating Casual Games for Windows 8
Шлигін Олександр “Розробка ігор в Unity загальні помилки” GameDev Conference ...

Recently uploaded (20)

PDF
gpt5_lecture_notes_comprehensive_20250812015547.pdf
PPTX
TLE Review Electricity (Electricity).pptx
PDF
ENT215_Completing-a-large-scale-migration-and-modernization-with-AWS.pdf
PDF
Enhancing emotion recognition model for a student engagement use case through...
PDF
DASA ADMISSION 2024_FirstRound_FirstRank_LastRank.pdf
PDF
WOOl fibre morphology and structure.pdf for textiles
PDF
Developing a website for English-speaking practice to English as a foreign la...
PPTX
Programs and apps: productivity, graphics, security and other tools
PDF
NewMind AI Weekly Chronicles - August'25-Week II
PDF
Video forgery: An extensive analysis of inter-and intra-frame manipulation al...
PDF
August Patch Tuesday
PPTX
Modernising the Digital Integration Hub
PDF
Transform Your ITIL® 4 & ITSM Strategy with AI in 2025.pdf
PDF
Getting Started with Data Integration: FME Form 101
PDF
TrustArc Webinar - Click, Consent, Trust: Winning the Privacy Game
PPTX
observCloud-Native Containerability and monitoring.pptx
PDF
How ambidextrous entrepreneurial leaders react to the artificial intelligence...
PDF
Architecture types and enterprise applications.pdf
PPTX
TechTalks-8-2019-Service-Management-ITIL-Refresh-ITIL-4-Framework-Supports-Ou...
PDF
Web App vs Mobile App What Should You Build First.pdf
gpt5_lecture_notes_comprehensive_20250812015547.pdf
TLE Review Electricity (Electricity).pptx
ENT215_Completing-a-large-scale-migration-and-modernization-with-AWS.pdf
Enhancing emotion recognition model for a student engagement use case through...
DASA ADMISSION 2024_FirstRound_FirstRank_LastRank.pdf
WOOl fibre morphology and structure.pdf for textiles
Developing a website for English-speaking practice to English as a foreign la...
Programs and apps: productivity, graphics, security and other tools
NewMind AI Weekly Chronicles - August'25-Week II
Video forgery: An extensive analysis of inter-and intra-frame manipulation al...
August Patch Tuesday
Modernising the Digital Integration Hub
Transform Your ITIL® 4 & ITSM Strategy with AI in 2025.pdf
Getting Started with Data Integration: FME Form 101
TrustArc Webinar - Click, Consent, Trust: Winning the Privacy Game
observCloud-Native Containerability and monitoring.pptx
How ambidextrous entrepreneurial leaders react to the artificial intelligence...
Architecture types and enterprise applications.pdf
TechTalks-8-2019-Service-Management-ITIL-Refresh-ITIL-4-Framework-Supports-Ou...
Web App vs Mobile App What Should You Build First.pdf

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