Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Sign up for free
Menu
Search
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Pricing
Search
Sign in
Sign up for free
Using Lua to Build a Component-based Architectu...
Search
Jheng Wei Ciao
August 05, 2013
2.4k
8
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
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
More Decks by Jheng Wei Ciao
See All by Jheng Wei Ciao
Casual Connect Asia 見聞錄
halflucifer
0
440
GDC 2013 半路異聞錄
halflucifer
5
1k
Designing a Component-based Architecture in Lua for Game Apps
halflucifer
11
2.3k
Kaohsiung Indie Devs Summit 2012 Keynote
halflucifer
7
1.1k
從《邦妮的早午餐》談女性遊戲與遊戲跨文化
halflucifer
7
920
半路叛逃之遊戲APP魔藥學
halflucifer
7
2k
Why You Shall Not Quit Your Day Job To Make A Game App
halflucifer
2
2.2k
為什麼你不該離職創業搞 APP
halflucifer
7
6.7k
What The Hell Game Industry Is Doing
halflucifer
3
1.7k
Featured
See All Featured
Marketing Yourself as an Engineer | Alaka | Gurzu
gurzu
0
320
Jess Joyce - The Pitfalls of Following Frameworks
techseoconnect
PRO
1
440
Templates, Plugins, & Blocks: Oh My! Creating the theme that thinks of everything
marktimemedia
31
2.9k
Responsive Adventures: Dirty Tricks From The Dark Corners of Front-End
smashingmag
254
22k
The Curse of the Amulet
leimatthew05
3
15k
Designing Powerful Visuals for Engaging Learning
tmiket
1
590
Max Prin - Stacking Signals: How International SEO Comes Together (And Falls Apart)
techseoconnect
PRO
0
480
Un-Boring Meetings
codingconduct
0
440
SEO Brein meetup: CTRL+C is not how to scale international SEO
lindahogenes
2
2.9k
End of SEO as We Know It (SMX Advanced Version)
ipullrank
3
4.4k
Building a A Zero-Code AI SEO Workflow
portentint
PRO
0
760
How to Ace a Technical Interview
jacobian
280
24k
Transcript
Using Lua to Build a Component-based Architecture for Game Apps
半路 / Jheng Wei Ciao
Component Based Architecture
Lua
Pitfalls of Object-Oriented Design ?!
Traditional OOD Object-Oriented Design Class Inheritance Virtualization Polymorphism Inheritance-based Architecture
Player Enemy WalkableObject Actor CollidableObject
None
FlyableObject Player Enemy Actor WalkableObject CollidableObject
CollidableObject FlyableObject FlyingEnemy Actor WalkableObject How?
CollidableObject FlyableObject FlyingEnemy FlyingActor How?
Pitfalls of IBA Deep and tangled hierarchies Diamond ring inheritance
Copy-paste code here and there Special cases Magic: don’t touch it
Component-based Architecture Each functionality is a game component Data-driven method
for objects creation Design Patterns: “Favor composition over inheritance”
Player WalkableObject CollidableObject FlyableObject Enemy WalkableObject CollidableObject FlyableObject
WalkableObject CollidableObject FlyableObject Game Components
WalkingEnemy FlyingEnemy WalkableObject CollidableObject CollidableObject FlyableObject
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
None
Who Are Using Lua
Advantages of Lua Lightweight Extensible Cross-platform Robust Openness Community
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
Pitfalls of Lua Naming convention for global variables Do garbage
collection manually Don’t forget to compile scripts & strip debug info
My Lua Trilogy Lua 5.1.5 Luabind 0.9.1 Time-saver & OO-like
Boost Luabind depends: template programming
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
Player Transform BoundingBox Quad
Meet Powerful ‘Table’ Player = {} Player[“Transform”] Player[“Quad”] Player[“Transform”]:SetTranslate(50, 100)
Player[“Quad”]:SetSize(120, 120)
None
Traditional OOP Game Objects Update #1 #2 #3 #4 #5
Game Objects Render #1 #2 #3 #4 #5
Component-Based Architecture Game Components Update #1 #2 #3 #4 #5
Game Components Render #1 #2 #3 #4 #5
Game Object = Container Game Object Transform Bounding Sprite Motion
StateMachine Timer
Object Factory Game Component Templates Game Object Templates Game-based
Interpolator GC 0 255 0.1 1.0 SetAlpha() SetScale()
Memory Management C++ Transform Sprite ...... Lua Game Object Transform
Sprite
User Interfaces & Widgets Widgets Button Picture Text Number Radio
Button Progress Bar
Widgets = Container Widgets Button Render/Update Movement Scale Up/Down Fade
In/Out Sprite Motion Transform Fade
MainMenu Button Sprite Interpolator Input Events
Lua + CBA = 100% Awesome!
[Launching Xcode] Live Demo
Live Game Apps?
Lua for Game Apps
CBA for Game Apps
Lua + CBA ......?
We’re recruiting one Android engineer
Open Mind, Happy Coding, Make Great Games!