SlideShare a Scribd company logo
1 of 18
+
Component-based
Entity system
in Mobile Game Development
CodyNguyen
Mobile Game Developer, Vinova VN
cody@vinova.vn
+
Start small: cute infinite fly game
Gasboy
+
After that: a cooler (and bigger) game
Stickman
Traps
Skills
God’s Rage
+
architecture problems start to pop out
As with any software getting more complex,
+
Game entities share capabilities among
each others
deal_damage_around
deal_damage_around deal_damage_around
deal_damage_around
movable
movable movable
throwable
throwable
lie_on_ground
lie_on_ground
delay_on_activating
delay_on_activating
activate_on_touch
activate_on_touch
+
Game entities share capabilities among
each others
Impossible to build a good OOP class hierarchy!
natural relationships welcome changes code reuse
+
First solution comes to mind:
mix-ins via multiple-inheritance
1. Just a small portion of the tree is a mess already
2. Multiple inheritance smells
3. Where to put logic that evolves object of different classes?
Capability
Moveable DealDamage ActivateOnTouch Throwable
Thorn Cloud Bomb Bull
+
Need a better solution
Component-based entity system has been
a hot topic for years.
It helps solve our problem in an elegant way!
+
Component-based entity system
Multitude of ways to represent and
implement
This talk discusses one way which we found
practical and easy to understand
Three elements:
 Entity
 Component
 System
+
Component-based entity system
Decompose game entities by capabilities into
reusable components.
Prefer aggregation over inheritance, i.e.,
entity has components, not is a type of
some component.
+
Entity and Component
Velocity Damage Graphic ThrowAngle ActivateOnTouch
Thorn x x x
Cloud x x x
Bomb x x x x
Bull x x x x
Entity is: an unique ID + a list of components
Component contains only data
+
Where does the logic go?
The systems.
Bull Light
-ning
Thorn
Cloud
Stick
-man
Game has a bunch of
entities
Entities are processed by
systems
M o v e m e n t S y s t e m
A n i m a t i o n S y s t e m
P h y s i c s S y s t e m
C o l l i s i o n S y s t e m
H e a l t h S y s t e m
+
Systems only process entities they
“care” about
Entities are keys Systems are locks
http://gamedev.stackexchange.com/a/31491
Components are teeth
+
Entity system sum up
 Entity
 Is just a unique ID with a bunch of components
 Doesn’t need a separate Class for each entity
 Component
 Is the “ingredient” to make entities.
 Contains data only.
 System
 Contains game logic
 Run on every game loop, process entities who has a set of
components it care about.
+
Other benefits of using entity
system
 Goes hand-in-hand with Data-Driven development:
 Entities are defined as bags of components, in text file.
 “No engineer required”, game designer can create new or edit
existing entities easily.
 Easy to change or fine-tune entities
 Promote multi-threading
 Systems are independent from one another, so they can run on
separate threads
+
Artemis Entity System
 An Entity system framework written in Java:
http://gamadu.com/artemis/tutorial.html
 Is open-source, active project
 Ported to many different languages
+
Artemis Entity System and Cocos2d
 Sidar Talei ported to C++, we forked, modified and maintain:
https://github.com/vinova/Artemis-Cpp
 Our port:
 Works great with cocos2d-x!
 Work great with any C++ framework. No external libs or C++11
compiler are required
 JavaScript binding coming soon
+
References
 A Data-Driven Game Object System
http://scottbilas.com/files/2002/gdc_san_jose/game_objects_slides.ppt
 Entity Systems are the future of MMOG development
http://t-machine.org/index.php/2007/11/11/entity-systems-are-the-future-of-mmog-
development-part-2/
 Evolve Your Hierarchy
http://cowboyprogramming.com/2007/01/05/evolve-your-heirachy/

More Related Content

What's hot

What's hot (20)

What Would Blizzard Do
What Would Blizzard DoWhat Would Blizzard Do
What Would Blizzard Do
 
School For Games 2015 - Unity Engine Basics
School For Games 2015 - Unity Engine BasicsSchool For Games 2015 - Unity Engine Basics
School For Games 2015 - Unity Engine Basics
 
Choosing A Game Engine - More Than Frames Per Second
Choosing A Game Engine - More Than Frames Per SecondChoosing A Game Engine - More Than Frames Per Second
Choosing A Game Engine - More Than Frames Per Second
 
Unity scene file collaboration
Unity scene file collaborationUnity scene file collaboration
Unity scene file collaboration
 
Developing applications and games in Unity engine - Matej Jariabka, Rudolf Ka...
Developing applications and games in Unity engine - Matej Jariabka, Rudolf Ka...Developing applications and games in Unity engine - Matej Jariabka, Rudolf Ka...
Developing applications and games in Unity engine - Matej Jariabka, Rudolf Ka...
 
Game Programming 07 - Procedural Content Generation
Game Programming 07 - Procedural Content GenerationGame Programming 07 - Procedural Content Generation
Game Programming 07 - Procedural Content Generation
 
Unity 3D VS your team
Unity 3D VS your teamUnity 3D VS your team
Unity 3D VS your team
 
Introduction to html5 game programming with impact js
Introduction to html5 game programming with impact jsIntroduction to html5 game programming with impact js
Introduction to html5 game programming with impact js
 
Unity
UnityUnity
Unity
 
unity basics
unity basicsunity basics
unity basics
 
Unity 3D, A game engine
Unity 3D, A game engineUnity 3D, A game engine
Unity 3D, A game engine
 
Unity Programming
Unity Programming Unity Programming
Unity Programming
 
Game development unity
Game development unityGame development unity
Game development unity
 
Unity 3d
Unity 3dUnity 3d
Unity 3d
 
Presentación Unity
Presentación UnityPresentación Unity
Presentación Unity
 
Unity introduction for programmers
Unity introduction for programmersUnity introduction for programmers
Unity introduction for programmers
 
Unity3D Programming
Unity3D ProgrammingUnity3D Programming
Unity3D Programming
 
Game Development with Unity
Game Development with UnityGame Development with Unity
Game Development with Unity
 
Creating a serious game with the Unity 3D Game Engine and the importance of m...
Creating a serious game with the Unity 3D Game Engine and the importance of m...Creating a serious game with the Unity 3D Game Engine and the importance of m...
Creating a serious game with the Unity 3D Game Engine and the importance of m...
 
Presentasi Seminar Unity (AMIKOM Game Dev)
Presentasi Seminar Unity (AMIKOM Game Dev)Presentasi Seminar Unity (AMIKOM Game Dev)
Presentasi Seminar Unity (AMIKOM Game Dev)
 

Similar to OGDC 2014: Component based entity system mobile game development

OGDC 2014_Entity system in mobile game development_Mr. Cody nguyen
OGDC 2014_Entity system in mobile game development_Mr. Cody nguyenOGDC 2014_Entity system in mobile game development_Mr. Cody nguyen
OGDC 2014_Entity system in mobile game development_Mr. Cody nguyen
ogdc
 

Similar to OGDC 2014: Component based entity system mobile game development (20)

The Guerrilla Guide to Game Code
The Guerrilla Guide to Game CodeThe Guerrilla Guide to Game Code
The Guerrilla Guide to Game Code
 
"it's time to kick ass and chew bubble gum...", a unity 3D live coding demo
"it's time to kick ass and chew bubble gum...", a unity 3D live coding demo"it's time to kick ass and chew bubble gum...", a unity 3D live coding demo
"it's time to kick ass and chew bubble gum...", a unity 3D live coding demo
 
DSC RNGPIT - Getting Started with Game Development Day 1
DSC RNGPIT - Getting Started with Game Development Day 1DSC RNGPIT - Getting Started with Game Development Day 1
DSC RNGPIT - Getting Started with Game Development Day 1
 
OGDC 2014_Entity system in mobile game development_Mr. Cody nguyen
OGDC 2014_Entity system in mobile game development_Mr. Cody nguyenOGDC 2014_Entity system in mobile game development_Mr. Cody nguyen
OGDC 2014_Entity system in mobile game development_Mr. Cody nguyen
 
unity gaming programing basics for students ppt
unity gaming programing basics for students pptunity gaming programing basics for students ppt
unity gaming programing basics for students ppt
 
A-Frame: building virtual reality experiences for the web
A-Frame: building virtual reality experiences for the webA-Frame: building virtual reality experiences for the web
A-Frame: building virtual reality experiences for the web
 
Biological organism simulation using procedural growth "Organimo 1.0"
Biological organism simulation using procedural growth "Organimo 1.0"Biological organism simulation using procedural growth "Organimo 1.0"
Biological organism simulation using procedural growth "Organimo 1.0"
 
IsoUnity: A retro-isometric toolkit for Unity
IsoUnity: A retro-isometric toolkit for UnityIsoUnity: A retro-isometric toolkit for Unity
IsoUnity: A retro-isometric toolkit for Unity
 
The Basics of Unity - The Game Engine
The Basics of Unity - The Game EngineThe Basics of Unity - The Game Engine
The Basics of Unity - The Game Engine
 
Albion Online - Software Architecture of an MMO (talk at Quo Vadis 2016, Berlin)
Albion Online - Software Architecture of an MMO (talk at Quo Vadis 2016, Berlin)Albion Online - Software Architecture of an MMO (talk at Quo Vadis 2016, Berlin)
Albion Online - Software Architecture of an MMO (talk at Quo Vadis 2016, Berlin)
 
Unity Game Engine - Basics
Unity Game Engine - BasicsUnity Game Engine - Basics
Unity Game Engine - Basics
 
Computer investigatroy project c++ class 12
Computer investigatroy project c++ class 12Computer investigatroy project c++ class 12
Computer investigatroy project c++ class 12
 
What does OOP stand for?
What does OOP stand for?What does OOP stand for?
What does OOP stand for?
 
RustConf 2020: My First Rust Project
RustConf 2020: My First Rust Project RustConf 2020: My First Rust Project
RustConf 2020: My First Rust Project
 
Entity Component System
Entity Component SystemEntity Component System
Entity Component System
 
a data driven game object system
a data driven game object systema data driven game object system
a data driven game object system
 
Better Game Design with Object-Oriented User Experience (OOUX)
Better Game Design with Object-Oriented User Experience (OOUX)Better Game Design with Object-Oriented User Experience (OOUX)
Better Game Design with Object-Oriented User Experience (OOUX)
 
Data Con LA 2018 - What I’ve Learned About How Machines Learn by Luis Bitenco...
Data Con LA 2018 - What I’ve Learned About How Machines Learn by Luis Bitenco...Data Con LA 2018 - What I’ve Learned About How Machines Learn by Luis Bitenco...
Data Con LA 2018 - What I’ve Learned About How Machines Learn by Luis Bitenco...
 
Cmd unity withc
Cmd unity withcCmd unity withc
Cmd unity withc
 
Kautilya: Teensy beyond shell
Kautilya: Teensy beyond shellKautilya: Teensy beyond shell
Kautilya: Teensy beyond shell
 

More from GameLandVN

OGDC 2014: Animation workflow with Spine in Tiny Busters
OGDC 2014: Animation workflow with Spine in Tiny BustersOGDC 2014: Animation workflow with Spine in Tiny Busters
OGDC 2014: Animation workflow with Spine in Tiny Busters
GameLandVN
 
OGDC 2014: Vietnam Smartphone game market 2013 overview
OGDC 2014: Vietnam Smartphone game market 2013 overviewOGDC 2014: Vietnam Smartphone game market 2013 overview
OGDC 2014: Vietnam Smartphone game market 2013 overview
GameLandVN
 
OGDC 2014: Speed up and make quality for your 3d models
OGDC 2014: Speed up and make quality for your 3d modelsOGDC 2014: Speed up and make quality for your 3d models
OGDC 2014: Speed up and make quality for your 3d models
GameLandVN
 
OGDC 2014: Sky Garden Mobile conceptualization: From PC to Mobile
OGDC 2014: Sky Garden Mobile conceptualization: From PC to MobileOGDC 2014: Sky Garden Mobile conceptualization: From PC to Mobile
OGDC 2014: Sky Garden Mobile conceptualization: From PC to Mobile
GameLandVN
 
OGDC 2014: One-Man Studio: How to make a game prototype
OGDC 2014: One-Man Studio: How to make a game prototypeOGDC 2014: One-Man Studio: How to make a game prototype
OGDC 2014: One-Man Studio: How to make a game prototype
GameLandVN
 

More from GameLandVN (20)

Mobile Game Asia 2015 Ho Chi Minh City: Mobile games for Asian women
Mobile Game Asia 2015 Ho Chi Minh City: Mobile games for Asian womenMobile Game Asia 2015 Ho Chi Minh City: Mobile games for Asian women
Mobile Game Asia 2015 Ho Chi Minh City: Mobile games for Asian women
 
Mobile Game Asia 2015 Ho Chi Minh City: Vietnam online mobile game market ins...
Mobile Game Asia 2015 Ho Chi Minh City: Vietnam online mobile game market ins...Mobile Game Asia 2015 Ho Chi Minh City: Vietnam online mobile game market ins...
Mobile Game Asia 2015 Ho Chi Minh City: Vietnam online mobile game market ins...
 
Mobile Game Asia 2015 Ho Chi Minh City: Mobile game market in India
Mobile Game Asia 2015 Ho Chi Minh City: Mobile game market in IndiaMobile Game Asia 2015 Ho Chi Minh City: Mobile game market in India
Mobile Game Asia 2015 Ho Chi Minh City: Mobile game market in India
 
Mobile Game Asia 2015 Ho Chi Minh City: Building a sustainable eSports ecosys...
Mobile Game Asia 2015 Ho Chi Minh City: Building a sustainable eSports ecosys...Mobile Game Asia 2015 Ho Chi Minh City: Building a sustainable eSports ecosys...
Mobile Game Asia 2015 Ho Chi Minh City: Building a sustainable eSports ecosys...
 
Mobile Game Asia 2015 Ho Chi Minh City: An overview of the mobile game market...
Mobile Game Asia 2015 Ho Chi Minh City: An overview of the mobile game market...Mobile Game Asia 2015 Ho Chi Minh City: An overview of the mobile game market...
Mobile Game Asia 2015 Ho Chi Minh City: An overview of the mobile game market...
 
Mobile Game Asia 2015 Ho Chi Minh City: Monetization strategies in Southeast ...
Mobile Game Asia 2015 Ho Chi Minh City: Monetization strategies in Southeast ...Mobile Game Asia 2015 Ho Chi Minh City: Monetization strategies in Southeast ...
Mobile Game Asia 2015 Ho Chi Minh City: Monetization strategies in Southeast ...
 
Mobile Game Asia 2015 Ho Chi Minh City: Rewarded video ads
Mobile Game Asia 2015 Ho Chi Minh City: Rewarded video adsMobile Game Asia 2015 Ho Chi Minh City: Rewarded video ads
Mobile Game Asia 2015 Ho Chi Minh City: Rewarded video ads
 
Mobile Game Asia 2015 Ho Chi Minh City: The role of a game publisher in Vietnam
Mobile Game Asia 2015 Ho Chi Minh City: The role of a game publisher in VietnamMobile Game Asia 2015 Ho Chi Minh City: The role of a game publisher in Vietnam
Mobile Game Asia 2015 Ho Chi Minh City: The role of a game publisher in Vietnam
 
Mobile Game Asia 2015 Ho Chi Minh City: Predictive monetization
Mobile Game Asia 2015 Ho Chi Minh City: Predictive monetizationMobile Game Asia 2015 Ho Chi Minh City: Predictive monetization
Mobile Game Asia 2015 Ho Chi Minh City: Predictive monetization
 
Mobile Game Asia 2015 Ho Chi Minh City: The roadmap of IP creation
Mobile Game Asia 2015 Ho Chi Minh City: The roadmap of IP creationMobile Game Asia 2015 Ho Chi Minh City: The roadmap of IP creation
Mobile Game Asia 2015 Ho Chi Minh City: The roadmap of IP creation
 
Cloud Powered Mobile Apps with Azure
Cloud Powered Mobile Apps with AzureCloud Powered Mobile Apps with Azure
Cloud Powered Mobile Apps with Azure
 
Windows app & Microsoft's support
Windows app & Microsoft's supportWindows app & Microsoft's support
Windows app & Microsoft's support
 
Kinh nghiệm phát triển Captain Strike
Kinh nghiệm phát triển Captain StrikeKinh nghiệm phát triển Captain Strike
Kinh nghiệm phát triển Captain Strike
 
Microsoft BizSpark
Microsoft BizSparkMicrosoft BizSpark
Microsoft BizSpark
 
Microsoft Azure Introduction
Microsoft Azure IntroductionMicrosoft Azure Introduction
Microsoft Azure Introduction
 
OGDC 2014: Animation workflow with Spine in Tiny Busters
OGDC 2014: Animation workflow with Spine in Tiny BustersOGDC 2014: Animation workflow with Spine in Tiny Busters
OGDC 2014: Animation workflow with Spine in Tiny Busters
 
OGDC 2014: Vietnam Smartphone game market 2013 overview
OGDC 2014: Vietnam Smartphone game market 2013 overviewOGDC 2014: Vietnam Smartphone game market 2013 overview
OGDC 2014: Vietnam Smartphone game market 2013 overview
 
OGDC 2014: Speed up and make quality for your 3d models
OGDC 2014: Speed up and make quality for your 3d modelsOGDC 2014: Speed up and make quality for your 3d models
OGDC 2014: Speed up and make quality for your 3d models
 
OGDC 2014: Sky Garden Mobile conceptualization: From PC to Mobile
OGDC 2014: Sky Garden Mobile conceptualization: From PC to MobileOGDC 2014: Sky Garden Mobile conceptualization: From PC to Mobile
OGDC 2014: Sky Garden Mobile conceptualization: From PC to Mobile
 
OGDC 2014: One-Man Studio: How to make a game prototype
OGDC 2014: One-Man Studio: How to make a game prototypeOGDC 2014: One-Man Studio: How to make a game prototype
OGDC 2014: One-Man Studio: How to make a game prototype
 

OGDC 2014: Component based entity system mobile game development

  • 1. + Component-based Entity system in Mobile Game Development CodyNguyen Mobile Game Developer, Vinova VN cody@vinova.vn
  • 2. + Start small: cute infinite fly game Gasboy
  • 3. + After that: a cooler (and bigger) game Stickman Traps Skills God’s Rage
  • 4. + architecture problems start to pop out As with any software getting more complex,
  • 5. + Game entities share capabilities among each others deal_damage_around deal_damage_around deal_damage_around deal_damage_around movable movable movable throwable throwable lie_on_ground lie_on_ground delay_on_activating delay_on_activating activate_on_touch activate_on_touch
  • 6. + Game entities share capabilities among each others Impossible to build a good OOP class hierarchy! natural relationships welcome changes code reuse
  • 7. + First solution comes to mind: mix-ins via multiple-inheritance 1. Just a small portion of the tree is a mess already 2. Multiple inheritance smells 3. Where to put logic that evolves object of different classes? Capability Moveable DealDamage ActivateOnTouch Throwable Thorn Cloud Bomb Bull
  • 8. + Need a better solution Component-based entity system has been a hot topic for years. It helps solve our problem in an elegant way!
  • 9. + Component-based entity system Multitude of ways to represent and implement This talk discusses one way which we found practical and easy to understand Three elements:  Entity  Component  System
  • 10. + Component-based entity system Decompose game entities by capabilities into reusable components. Prefer aggregation over inheritance, i.e., entity has components, not is a type of some component.
  • 11. + Entity and Component Velocity Damage Graphic ThrowAngle ActivateOnTouch Thorn x x x Cloud x x x Bomb x x x x Bull x x x x Entity is: an unique ID + a list of components Component contains only data
  • 12. + Where does the logic go? The systems. Bull Light -ning Thorn Cloud Stick -man Game has a bunch of entities Entities are processed by systems M o v e m e n t S y s t e m A n i m a t i o n S y s t e m P h y s i c s S y s t e m C o l l i s i o n S y s t e m H e a l t h S y s t e m
  • 13. + Systems only process entities they “care” about Entities are keys Systems are locks http://gamedev.stackexchange.com/a/31491 Components are teeth
  • 14. + Entity system sum up  Entity  Is just a unique ID with a bunch of components  Doesn’t need a separate Class for each entity  Component  Is the “ingredient” to make entities.  Contains data only.  System  Contains game logic  Run on every game loop, process entities who has a set of components it care about.
  • 15. + Other benefits of using entity system  Goes hand-in-hand with Data-Driven development:  Entities are defined as bags of components, in text file.  “No engineer required”, game designer can create new or edit existing entities easily.  Easy to change or fine-tune entities  Promote multi-threading  Systems are independent from one another, so they can run on separate threads
  • 16. + Artemis Entity System  An Entity system framework written in Java: http://gamadu.com/artemis/tutorial.html  Is open-source, active project  Ported to many different languages
  • 17. + Artemis Entity System and Cocos2d  Sidar Talei ported to C++, we forked, modified and maintain: https://github.com/vinova/Artemis-Cpp  Our port:  Works great with cocos2d-x!  Work great with any C++ framework. No external libs or C++11 compiler are required  JavaScript binding coming soon
  • 18. + References  A Data-Driven Game Object System http://scottbilas.com/files/2002/gdc_san_jose/game_objects_slides.ppt  Entity Systems are the future of MMOG development http://t-machine.org/index.php/2007/11/11/entity-systems-are-the-future-of-mmog- development-part-2/  Evolve Your Hierarchy http://cowboyprogramming.com/2007/01/05/evolve-your-heirachy/

Editor's Notes

  1. Introduction
  2. It’s always great to start small, release fast and learn a complete experience.
  3. Our second game is God’s Rage. The story is that you play the God. Your daughter is so beautiful that a “normal” guy felt in love with her. Of-course, as a God, you can’t accept that, so you try to prevent the guy from reaching to your daughter. Your weapons are traps, which were initially put on the road, and skills, which you can throw down
  4. And for any software being a bit complex, we need a good architecture for it.
  5. And for any software being a bit complex, we need a good architecture for it.
  6. Really don’t need separate classes for different entities. Just pick proper components and we have the entity we want
  7. Slice game by aspects into systems MovementSystem AnimationSys PhysicSys Systems run sequentially in each game loop, process entities they cares about. Which entities a system cares about? The ones that have a certain set of components. MovementSystem process entities having Position and Velocity components CollisionSystem process entities having RigidBody component. RenderSystem process entities having Sprite and Position components.
  8. Byte56 had a great explanation of the roles of component