Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Using Lua to Build a Component-based Architecture for Game Apps

Jheng Wei Ciao
August 05, 2013

Using Lua to Build a Component-based Architecture for Game Apps

Presented on COSCUP 2013 http://coscup.org/2013/en/

Jheng Wei Ciao

August 05, 2013


  1. Lua

  2. Pitfalls of IBA Deep and tangled hierarchies Diamond ring inheritance

    Copy-paste code here and there Special cases Magic: don’t touch it
  3. Component-based Architecture Each functionality is a game component Data-driven method

    for objects creation Design Patterns: “Favor composition over inheritance”
  4. Don’t use CBA... yet CBA can’t save your world OOD

    can do good things too Don’t make everything a component Leave messy code alone You might need an editor or tool
  5. Drawbacks of Lua Most editors don’t support auto-completion code Goodbye

    to debuggers & breakpoints Hello to loggers & print() No excuse for coffee break time
  6. Pitfalls of Lua Naming convention for global variables Do garbage

    collection manually Don’t forget to compile scripts & strip debug info
  7. My Lua Trilogy Lua 5.1.5 Luabind 0.9.1 Time-saver & OO-like

    Boost Luabind depends: template programming
  8. My Programming Trilogy C++ Generic framework Objective-C iOS platform-specific OpenGL

    ES implementation Lua Data description Game logic 10% 65% 25% C++ Lua Objectitve-C
  9. Traditional OOP Game Objects Update #1 #2 #3 #4 #5

    Game Objects Render #1 #2 #3 #4 #5