SlideShare uma empresa Scribd logo
1 de 56
Baixar para ler offline
Entity system architecture
with Unity
Maxim Zaks | @icex33 | github.com/mzaks
Simon Schmid | @s_schmid | github.com/sschmid
Wooga
Unity pain points
4 Testability
4 Code sharing
4 Co-dependent logic
4 Querying
4 Deleting code
Testability
Code sharing
Co-dependent logic
Co-dependent logic
Co-dependent logic
Querying
Deleting code
Entitas
Match One Demo
Components are just data
4 no Methods, no Start(), no Update()
4 no inheritance
+-----------+
| Component |
|-----------|
| Data |
+-----------+
PositionComponent
using Entitas;
public class PositionComponent : IComponent
{
public int x;
public int y;
}
GameBoardElementComponent
using Entitas;
public class GameBoardElementComponent : IComponent
{
}
Entity is a container for components
+-----------+
| Entity |
|-----------|
| Component |
| |
| Component |
| |
| Component |
+-----------+
Entity
4 Add Components
4 Replace Components
4 Remove Components
Create Blocker Entity
public static Entity CreateBlocker(this Pool pool, int x, int y)
{
return pool.CreateEntity()
.IsGameBoardElement(true)
.AddPosition(x, y)
.AddResource(Res.Blocker);
}
Pool contains all entities
+------------------+
| Pool |
|------------------|
| e e |
| e e |
| e e |
| e e e |
| e e |
| e e |
| e e e |
| e e e |
+------------------+
Pool
4 Create Entity
4 Destroy Entity
4 Get all Entities
4 Get Group
Groups are subsets of entities
4 Performance optimization for querying
4 Matcher is a filter description
+-------------+ Groups:
| e | Subsets of entities in the pool
| e e | for blazing fast querying
| +------------+
| e | | |
| e | e | e |
+--------|----+ e |
| e |
| e e |
+------------+
Get Group from pool
_pool.GetGroup(
Matcher.AllOf(
Matcher.GameBoardElement,
Matcher.Position
)
);
+------------------+
| Pool | Entitas in a nutshell
|------------------|
| e e | +-----------+
| e e---|----> | Entity |
| e e | |-----------|
| e e e | | Component |
| e e | | | +-----------+
| e e | | Component-|----> | Component |
| e e e | | | |-----------|
| e e e | | Component | | Data |
+------------------+ +-----------+ +-----------+
|
|
| +-------------+ Groups:
| | e | Subsets of entities in the pool
| | e e | for blazing fast querying
+---> | +------------+
| e | | |
| e | e | e |
+--------|----+ e |
| e |
| e e |
+------------+
Behaviour
System
4 Start / Execute
4 No State!!!
+------------------+ +-----------------------------+
| Pool | | System |
|------------------| |-----------------------------|
| e e | | - Execute |
| e e | | |
| e e | | +-------------+ |
| e e e | | | e | Groups |
| e e |+----|->| e e | |
| e e | | | +------------+ |
| e e e | | | e | | | |
| e e e | | | e | e | e | |
+------------------+ | +--------|----+ e | |
| | e | |
| | e e | |
| +------------+ |
+-----------------------------+
MoveSystem
public void Execute() {
var movables = _pool.GetGroup(
Matcher.AllOf(
Matcher.Move,
Matcher.Position
));
foreach (var e in movables.GetEntities()) {
var move = e.move;
var pos = e.position;
e.ReplacePosition(pos.x, pos.y + move.speed, pos.z);
}
}
Chain of Responsibility
| |
|-------------------------------- Game Loop --------------------------------|
| |
+------------+ +------------+ +------------+ +------------+
| | | | | | | |
| System | +---> | System | +---> | System | +---> | System |
| | | | | | | |
+------------+ +------------+ +------------+ +------------+
return new Systems()
.Add( pool.CreateGameBoardSystem ())
.Add( pool.CreateCreateGameBoardCacheSystem ())
.Add( pool.CreateFallSystem ())
.Add( pool.CreateFillSystem ())
.Add( pool.CreateProcessInputSystem ())
.Add( pool.CreateRemoveViewSystem ())
.Add( pool.CreateAddViewSystem ())
.Add( pool.CreateRenderPositionSystem ())
.Add( pool.CreateDestroySystem ())
.Add( pool.CreateScoreSystem ());
Reacting to changes in a Group
4 On Entity added
4 On Entity removed
ScoreLabelController
void Start() {
_pool.GetGroup(Matcher.Score).OnEntityAdded +=
(group, entity) => updateScore(entity.score.value);
updateScore(_pool.score.value);
}
void updateScore(int score) {
_label.text = "Score " + score;
}
Reactive System
4 Executed only when entities in a group have changed
4 Aggregate and process changes
Render Position System
public class RenderPositionSystem : IReactiveSystem {
public IMatcher trigger { get { return Matcher.AllOf(Matcher.Position, Matcher.View); } }
public GroupEventType eventType { get { return GroupEventType.OnEntityAdded; } }
public void Execute(Entity[] entities) {
foreach (var e in entities) {
var pos = e.position;
e.view.gameObject.transform.position = new Vector3(pos.x, pos.y);
}
}
}
Optimizations
Components
mutable vs immutable
Entity
Dictionary vs Array
Dictionary
e.AddComponent(new PositionComponent());
var component = e.GetComponent<PositionComponent>();
Array
e.AddComponent(new PositionComponent(), 5);
var component = (PositionComponent)e.GetComponent(5);
Code Generator
Before Code Generation
PositionComponent component;
if (e.HasComponent(ComponentIds.Position)) {
e.WillRemoveComponent(ComponentIds.Position);
component = (PositionComponent)e.GetComponent(ComponentIds.Position);
} else {
component = new PositionComponent();
}
component.x = 10;
component.y = 10;
e.ReplaceComponent(ComponentIds.Position, component);
After Code Generation
e.ReplacePosition(10, 10);
Code Generator Demo
var pool = Pools.pool;
var e = pool.CreateEntity();
e.AddPosition(1, 2, 3);
e.ReplacePosition(4, 5, 6);
e.RemovePosition();
var posX = e.position.x;
var hasPos = e.hasPosition;
e.isMovable = true;
e.isMovable = false;
var isMovable = e.isMovable;
Visual Debugging Demo
Entitas is
open sourcegithub.com/sschmid/Entitas-CSharp
Recap
Unity pain points
4 Testability
4 Code sharing
4 Co-dependent logic
4 Querying
4 Deleting code
Advantages
4 Straightforward to achieve Determinism and
therefore Replay
4 Simulation Speed (2x, 4x)
4 Headless Simulation, just remove systems which rely
on GameObjects (render systems)
4 Save Game (Serialization / Deserialization) send
data to backend on change
Q&AMaxim Zaks | @icex33 | github.com/mzaks
Simon Schmid | @s_schmid | github.com/sschmid
tinyurl.com/entitas

Mais conteúdo relacionado

Destaque

Story of Warlords: Bringing a turn-based strategy game to mobile
Story of Warlords: Bringing a turn-based strategy game to mobile Story of Warlords: Bringing a turn-based strategy game to mobile
Story of Warlords: Bringing a turn-based strategy game to mobile Wooga
 
Heyworks: Cравнительный анализ решений для клиент-серверного взаимодействия и...
Heyworks: Cравнительный анализ решений для клиент-серверного взаимодействия и...Heyworks: Cравнительный анализ решений для клиент-серверного взаимодействия и...
Heyworks: Cравнительный анализ решений для клиент-серверного взаимодействия и...DevGAMM Conference
 
Deterministic Simulation - What modern online games can learn from the Game B...
Deterministic Simulation - What modern online games can learn from the Game B...Deterministic Simulation - What modern online games can learn from the Game B...
Deterministic Simulation - What modern online games can learn from the Game B...David Salz
 
Эволюция сервисов видео монетизации Unity Ads и сервиса реплей-шеринга Everyp...
Эволюция сервисов видео монетизации Unity Ads и сервиса реплей-шеринга Everyp...Эволюция сервисов видео монетизации Unity Ads и сервиса реплей-шеринга Everyp...
Эволюция сервисов видео монетизации Unity Ads и сервиса реплей-шеринга Everyp...DevGAMM Conference
 
2013 07-24 casual-connect_needle_in_haystack_slideshare
2013 07-24 casual-connect_needle_in_haystack_slideshare2013 07-24 casual-connect_needle_in_haystack_slideshare
2013 07-24 casual-connect_needle_in_haystack_slideshareWooga
 
Two Ann(e)s and one Julia_Wooga Lady Power from Berlin_SGA2014
Two Ann(e)s and one Julia_Wooga Lady Power from Berlin_SGA2014Two Ann(e)s and one Julia_Wooga Lady Power from Berlin_SGA2014
Two Ann(e)s and one Julia_Wooga Lady Power from Berlin_SGA2014Wooga
 
Leveling up in localization! - Susan Alma & Dario Quondamstefano
Leveling up in localization! - Susan Alma & Dario QuondamstefanoLeveling up in localization! - Susan Alma & Dario Quondamstefano
Leveling up in localization! - Susan Alma & Dario QuondamstefanoWooga
 
The Wooga way to create successful games_SBGames Brazil 2012_Thiago Apella
The Wooga way to create successful games_SBGames Brazil 2012_Thiago ApellaThe Wooga way to create successful games_SBGames Brazil 2012_Thiago Apella
The Wooga way to create successful games_SBGames Brazil 2012_Thiago ApellaWooga
 
2012_11_28_Dont think about working at other companies_BeuthHS_Anne
2012_11_28_Dont think about working at other companies_BeuthHS_Anne2012_11_28_Dont think about working at other companies_BeuthHS_Anne
2012_11_28_Dont think about working at other companies_BeuthHS_AnneWooga
 
From Keyboards to Fingertips - Rethink Game Design_QuoVadis 2013
From Keyboards to Fingertips - Rethink Game Design_QuoVadis 2013From Keyboards to Fingertips - Rethink Game Design_QuoVadis 2013
From Keyboards to Fingertips - Rethink Game Design_QuoVadis 2013Wooga
 
Evoloution of Ideas
Evoloution of IdeasEvoloution of Ideas
Evoloution of IdeasWooga
 
Social games and their clean code_Clean Code Days_Dresden 2013
Social games and their clean code_Clean Code Days_Dresden 2013Social games and their clean code_Clean Code Days_Dresden 2013
Social games and their clean code_Clean Code Days_Dresden 2013Wooga
 
Reaching the World with awesome Games_SGAC13
Reaching the World with awesome Games_SGAC13Reaching the World with awesome Games_SGAC13
Reaching the World with awesome Games_SGAC13Wooga
 
Prototyping_Wooga Game Jam
Prototyping_Wooga Game JamPrototyping_Wooga Game Jam
Prototyping_Wooga Game JamWooga
 
Instagram Celebrities: are they the new cats? - Targetsummit Berlin 2015
Instagram Celebrities: are they the new cats? - Targetsummit Berlin 2015Instagram Celebrities: are they the new cats? - Targetsummit Berlin 2015
Instagram Celebrities: are they the new cats? - Targetsummit Berlin 2015Wooga
 
What lies ahead of HTML5_Ooop Munich 2013_Krzysztof Szafranek
What lies ahead of HTML5_Ooop Munich 2013_Krzysztof SzafranekWhat lies ahead of HTML5_Ooop Munich 2013_Krzysztof Szafranek
What lies ahead of HTML5_Ooop Munich 2013_Krzysztof SzafranekWooga
 
In it for the long haul - How Wooga boosts long-term retention
In it for the long haul - How Wooga boosts long-term retentionIn it for the long haul - How Wooga boosts long-term retention
In it for the long haul - How Wooga boosts long-term retentionWooga
 
Storytelling in social games
Storytelling in social gamesStorytelling in social games
Storytelling in social gamesWooga
 
How to hire the best people for your startup-Gitta Blat-Head of People
How to hire the best people for your startup-Gitta Blat-Head of PeopleHow to hire the best people for your startup-Gitta Blat-Head of People
How to hire the best people for your startup-Gitta Blat-Head of PeopleWooga
 

Destaque (20)

Story of Warlords: Bringing a turn-based strategy game to mobile
Story of Warlords: Bringing a turn-based strategy game to mobile Story of Warlords: Bringing a turn-based strategy game to mobile
Story of Warlords: Bringing a turn-based strategy game to mobile
 
Heyworks: Cравнительный анализ решений для клиент-серверного взаимодействия и...
Heyworks: Cравнительный анализ решений для клиент-серверного взаимодействия и...Heyworks: Cравнительный анализ решений для клиент-серверного взаимодействия и...
Heyworks: Cравнительный анализ решений для клиент-серверного взаимодействия и...
 
Deterministic Simulation - What modern online games can learn from the Game B...
Deterministic Simulation - What modern online games can learn from the Game B...Deterministic Simulation - What modern online games can learn from the Game B...
Deterministic Simulation - What modern online games can learn from the Game B...
 
Intro To Starling Framework for ActionScript 3.0
Intro To Starling Framework for ActionScript 3.0Intro To Starling Framework for ActionScript 3.0
Intro To Starling Framework for ActionScript 3.0
 
Эволюция сервисов видео монетизации Unity Ads и сервиса реплей-шеринга Everyp...
Эволюция сервисов видео монетизации Unity Ads и сервиса реплей-шеринга Everyp...Эволюция сервисов видео монетизации Unity Ads и сервиса реплей-шеринга Everyp...
Эволюция сервисов видео монетизации Unity Ads и сервиса реплей-шеринга Everyp...
 
2013 07-24 casual-connect_needle_in_haystack_slideshare
2013 07-24 casual-connect_needle_in_haystack_slideshare2013 07-24 casual-connect_needle_in_haystack_slideshare
2013 07-24 casual-connect_needle_in_haystack_slideshare
 
Two Ann(e)s and one Julia_Wooga Lady Power from Berlin_SGA2014
Two Ann(e)s and one Julia_Wooga Lady Power from Berlin_SGA2014Two Ann(e)s and one Julia_Wooga Lady Power from Berlin_SGA2014
Two Ann(e)s and one Julia_Wooga Lady Power from Berlin_SGA2014
 
Leveling up in localization! - Susan Alma & Dario Quondamstefano
Leveling up in localization! - Susan Alma & Dario QuondamstefanoLeveling up in localization! - Susan Alma & Dario Quondamstefano
Leveling up in localization! - Susan Alma & Dario Quondamstefano
 
The Wooga way to create successful games_SBGames Brazil 2012_Thiago Apella
The Wooga way to create successful games_SBGames Brazil 2012_Thiago ApellaThe Wooga way to create successful games_SBGames Brazil 2012_Thiago Apella
The Wooga way to create successful games_SBGames Brazil 2012_Thiago Apella
 
2012_11_28_Dont think about working at other companies_BeuthHS_Anne
2012_11_28_Dont think about working at other companies_BeuthHS_Anne2012_11_28_Dont think about working at other companies_BeuthHS_Anne
2012_11_28_Dont think about working at other companies_BeuthHS_Anne
 
From Keyboards to Fingertips - Rethink Game Design_QuoVadis 2013
From Keyboards to Fingertips - Rethink Game Design_QuoVadis 2013From Keyboards to Fingertips - Rethink Game Design_QuoVadis 2013
From Keyboards to Fingertips - Rethink Game Design_QuoVadis 2013
 
Evoloution of Ideas
Evoloution of IdeasEvoloution of Ideas
Evoloution of Ideas
 
Social games and their clean code_Clean Code Days_Dresden 2013
Social games and their clean code_Clean Code Days_Dresden 2013Social games and their clean code_Clean Code Days_Dresden 2013
Social games and their clean code_Clean Code Days_Dresden 2013
 
Reaching the World with awesome Games_SGAC13
Reaching the World with awesome Games_SGAC13Reaching the World with awesome Games_SGAC13
Reaching the World with awesome Games_SGAC13
 
Prototyping_Wooga Game Jam
Prototyping_Wooga Game JamPrototyping_Wooga Game Jam
Prototyping_Wooga Game Jam
 
Instagram Celebrities: are they the new cats? - Targetsummit Berlin 2015
Instagram Celebrities: are they the new cats? - Targetsummit Berlin 2015Instagram Celebrities: are they the new cats? - Targetsummit Berlin 2015
Instagram Celebrities: are they the new cats? - Targetsummit Berlin 2015
 
What lies ahead of HTML5_Ooop Munich 2013_Krzysztof Szafranek
What lies ahead of HTML5_Ooop Munich 2013_Krzysztof SzafranekWhat lies ahead of HTML5_Ooop Munich 2013_Krzysztof Szafranek
What lies ahead of HTML5_Ooop Munich 2013_Krzysztof Szafranek
 
In it for the long haul - How Wooga boosts long-term retention
In it for the long haul - How Wooga boosts long-term retentionIn it for the long haul - How Wooga boosts long-term retention
In it for the long haul - How Wooga boosts long-term retention
 
Storytelling in social games
Storytelling in social gamesStorytelling in social games
Storytelling in social games
 
How to hire the best people for your startup-Gitta Blat-Head of People
How to hire the best people for your startup-Gitta Blat-Head of PeopleHow to hire the best people for your startup-Gitta Blat-Head of People
How to hire the best people for your startup-Gitta Blat-Head of People
 

Semelhante a Entitas System Architecture with Unity - Maxim Zaks and Simon Schmid

Entity system architecture with Unity @Unite Europe 2015
Entity system architecture with Unity @Unite Europe 2015 Entity system architecture with Unity @Unite Europe 2015
Entity system architecture with Unity @Unite Europe 2015 Maxim Zaks
 
MySQL Kitchen : spice up your everyday SQL queries
MySQL Kitchen : spice up your everyday SQL queriesMySQL Kitchen : spice up your everyday SQL queries
MySQL Kitchen : spice up your everyday SQL queriesDamien Seguy
 
15 protips for mysql users pfz
15 protips for mysql users   pfz15 protips for mysql users   pfz
15 protips for mysql users pfzJoshua Thijssen
 
Observability of InfluxDB IOx: Tracing, Metrics and System Tables
Observability of InfluxDB IOx: Tracing, Metrics and System TablesObservability of InfluxDB IOx: Tracing, Metrics and System Tables
Observability of InfluxDB IOx: Tracing, Metrics and System TablesInfluxData
 
BigQuery implementation
BigQuery implementationBigQuery implementation
BigQuery implementationSimon Su
 
M|18 User Defined Function
M|18 User Defined FunctionM|18 User Defined Function
M|18 User Defined FunctionMariaDB plc
 
The story and tech of Read the Docs
The story and tech of Read the DocsThe story and tech of Read the Docs
The story and tech of Read the Docsericholscher
 
ITGM8. Всеволод Брекелов (Grid Dinamics) Component tests. let's do that!
ITGM8. Всеволод Брекелов (Grid Dinamics) Component tests. let's do that!ITGM8. Всеволод Брекелов (Grid Dinamics) Component tests. let's do that!
ITGM8. Всеволод Брекелов (Grid Dinamics) Component tests. let's do that!SPB SQA Group
 
CoreOS in anger : firing up wordpress across a 3 machine CoreOS cluster
CoreOS in anger : firing up wordpress across a 3 machine CoreOS cluster CoreOS in anger : firing up wordpress across a 3 machine CoreOS cluster
CoreOS in anger : firing up wordpress across a 3 machine CoreOS cluster Shaun Domingo
 
pytest로 파이썬 코드 테스트하기
pytest로 파이썬 코드 테스트하기pytest로 파이썬 코드 테스트하기
pytest로 파이썬 코드 테스트하기Yeongseon Choe
 
How to build and run oci containers
How to build and run oci containersHow to build and run oci containers
How to build and run oci containersSpyros Trigazis
 
Running automated tests with Sparx Enterprise Architect add-ins, London EA Us...
Running automated tests with Sparx Enterprise Architect add-ins, London EA Us...Running automated tests with Sparx Enterprise Architect add-ins, London EA Us...
Running automated tests with Sparx Enterprise Architect add-ins, London EA Us...Guillaume Finance
 
Cruel (SQL) Intentions
Cruel (SQL) IntentionsCruel (SQL) Intentions
Cruel (SQL) Intentionsezra_c
 
Planet-HTML5-Game-Engine Javascript Performance Enhancement
Planet-HTML5-Game-Engine Javascript Performance EnhancementPlanet-HTML5-Game-Engine Javascript Performance Enhancement
Planet-HTML5-Game-Engine Javascript Performance Enhancementup2soul
 
忙しい人のためのSphinx 入門 demo
忙しい人のためのSphinx 入門 demo忙しい人のためのSphinx 入門 demo
忙しい人のためのSphinx 入門 demoFumihito Yokoyama
 
Quick and Dirty GUI Applications using GUIDeFATE
Quick and Dirty GUI Applications using GUIDeFATEQuick and Dirty GUI Applications using GUIDeFATE
Quick and Dirty GUI Applications using GUIDeFATEConnie New
 
Introduction to Git Source Control
Introduction to Git Source ControlIntroduction to Git Source Control
Introduction to Git Source ControlJohn Valentino
 

Semelhante a Entitas System Architecture with Unity - Maxim Zaks and Simon Schmid (20)

Entity system architecture with Unity @Unite Europe 2015
Entity system architecture with Unity @Unite Europe 2015 Entity system architecture with Unity @Unite Europe 2015
Entity system architecture with Unity @Unite Europe 2015
 
MySQL Kitchen : spice up your everyday SQL queries
MySQL Kitchen : spice up your everyday SQL queriesMySQL Kitchen : spice up your everyday SQL queries
MySQL Kitchen : spice up your everyday SQL queries
 
Pyspark
PysparkPyspark
Pyspark
 
15 protips for mysql users pfz
15 protips for mysql users   pfz15 protips for mysql users   pfz
15 protips for mysql users pfz
 
Observability of InfluxDB IOx: Tracing, Metrics and System Tables
Observability of InfluxDB IOx: Tracing, Metrics and System TablesObservability of InfluxDB IOx: Tracing, Metrics and System Tables
Observability of InfluxDB IOx: Tracing, Metrics and System Tables
 
BigQuery implementation
BigQuery implementationBigQuery implementation
BigQuery implementation
 
M|18 User Defined Function
M|18 User Defined FunctionM|18 User Defined Function
M|18 User Defined Function
 
The story and tech of Read the Docs
The story and tech of Read the DocsThe story and tech of Read the Docs
The story and tech of Read the Docs
 
ITGM8. Всеволод Брекелов (Grid Dinamics) Component tests. let's do that!
ITGM8. Всеволод Брекелов (Grid Dinamics) Component tests. let's do that!ITGM8. Всеволод Брекелов (Grid Dinamics) Component tests. let's do that!
ITGM8. Всеволод Брекелов (Grid Dinamics) Component tests. let's do that!
 
CoreOS in anger : firing up wordpress across a 3 machine CoreOS cluster
CoreOS in anger : firing up wordpress across a 3 machine CoreOS cluster CoreOS in anger : firing up wordpress across a 3 machine CoreOS cluster
CoreOS in anger : firing up wordpress across a 3 machine CoreOS cluster
 
pytest로 파이썬 코드 테스트하기
pytest로 파이썬 코드 테스트하기pytest로 파이썬 코드 테스트하기
pytest로 파이썬 코드 테스트하기
 
How to build and run oci containers
How to build and run oci containersHow to build and run oci containers
How to build and run oci containers
 
Real
RealReal
Real
 
Running automated tests with Sparx Enterprise Architect add-ins, London EA Us...
Running automated tests with Sparx Enterprise Architect add-ins, London EA Us...Running automated tests with Sparx Enterprise Architect add-ins, London EA Us...
Running automated tests with Sparx Enterprise Architect add-ins, London EA Us...
 
Cruel (SQL) Intentions
Cruel (SQL) IntentionsCruel (SQL) Intentions
Cruel (SQL) Intentions
 
Planet-HTML5-Game-Engine Javascript Performance Enhancement
Planet-HTML5-Game-Engine Javascript Performance EnhancementPlanet-HTML5-Game-Engine Javascript Performance Enhancement
Planet-HTML5-Game-Engine Javascript Performance Enhancement
 
忙しい人のためのSphinx 入門 demo
忙しい人のためのSphinx 入門 demo忙しい人のためのSphinx 入門 demo
忙しい人のためのSphinx 入門 demo
 
Quick and Dirty GUI Applications using GUIDeFATE
Quick and Dirty GUI Applications using GUIDeFATEQuick and Dirty GUI Applications using GUIDeFATE
Quick and Dirty GUI Applications using GUIDeFATE
 
Introduction to Git Source Control
Introduction to Git Source ControlIntroduction to Git Source Control
Introduction to Git Source Control
 
Perf Tuning Short
Perf Tuning ShortPerf Tuning Short
Perf Tuning Short
 

Mais de Wooga

Saying No to the CEO: A Deep Look at Independent Teams - Adam Telfer
Saying No to the CEO: A Deep Look at Independent Teams - Adam TelferSaying No to the CEO: A Deep Look at Independent Teams - Adam Telfer
Saying No to the CEO: A Deep Look at Independent Teams - Adam TelferWooga
 
Innovation dank DevOps (DevOpsCon Berlin 2015)
Innovation dank DevOps (DevOpsCon Berlin 2015)Innovation dank DevOps (DevOpsCon Berlin 2015)
Innovation dank DevOps (DevOpsCon Berlin 2015)Wooga
 
Big Fish, small pond - strategies for surviving in a maturing market - Ed Biden
Big Fish, small pond - strategies for surviving in a maturing market - Ed BidenBig Fish, small pond - strategies for surviving in a maturing market - Ed Biden
Big Fish, small pond - strategies for surviving in a maturing market - Ed BidenWooga
 
Review mining aps2014 berlin
Review mining aps2014 berlinReview mining aps2014 berlin
Review mining aps2014 berlinWooga
 
Riak & Wooga_Geeek2Geeek Meetup2014 Berlin
Riak & Wooga_Geeek2Geeek Meetup2014 BerlinRiak & Wooga_Geeek2Geeek Meetup2014 Berlin
Riak & Wooga_Geeek2Geeek Meetup2014 BerlinWooga
 
Staying in the Game: Game localization practices for the mobile market
Staying in the Game: Game localization practices for the mobile marketStaying in the Game: Game localization practices for the mobile market
Staying in the Game: Game localization practices for the mobile marketWooga
 
Startup Weekend_Makers and Games_Philipp Stelzer
Startup Weekend_Makers and Games_Philipp StelzerStartup Weekend_Makers and Games_Philipp Stelzer
Startup Weekend_Makers and Games_Philipp StelzerWooga
 
DevOps goes Mobile (daho.am)
DevOps goes Mobile (daho.am)DevOps goes Mobile (daho.am)
DevOps goes Mobile (daho.am)Wooga
 
DevOps goes Mobile - Jax 2014 - Jesper Richter-Reichhelm
DevOps goes Mobile - Jax 2014 - Jesper Richter-ReichhelmDevOps goes Mobile - Jax 2014 - Jesper Richter-Reichhelm
DevOps goes Mobile - Jax 2014 - Jesper Richter-ReichhelmWooga
 
CodeFest 2014_Mobile Game Development
CodeFest 2014_Mobile Game DevelopmentCodeFest 2014_Mobile Game Development
CodeFest 2014_Mobile Game DevelopmentWooga
 
Jelly Splash: Puzzling your way to the top of the App Stores - GDC 2014
Jelly Splash: Puzzling your way to the top of the App Stores - GDC 2014Jelly Splash: Puzzling your way to the top of the App Stores - GDC 2014
Jelly Splash: Puzzling your way to the top of the App Stores - GDC 2014Wooga
 
Pocket Gamer Connects 2014_The Experience of Entering the Korean Market
Pocket Gamer Connects 2014_The Experience of Entering the Korean MarketPocket Gamer Connects 2014_The Experience of Entering the Korean Market
Pocket Gamer Connects 2014_The Experience of Entering the Korean MarketWooga
 
How to stand out in a hit driven business - Game Connection Paris 2013 - SebK...
How to stand out in a hit driven business - Game Connection Paris 2013 - SebK...How to stand out in a hit driven business - Game Connection Paris 2013 - SebK...
How to stand out in a hit driven business - Game Connection Paris 2013 - SebK...Wooga
 
DevOps the Wooga way (Webmontag Berlin)
DevOps the Wooga way (Webmontag Berlin)DevOps the Wooga way (Webmontag Berlin)
DevOps the Wooga way (Webmontag Berlin)Wooga
 
Why Having Impact Matters for Good Developers (GOTO Berlin)
Why Having Impact Matters for Good Developers (GOTO Berlin)Why Having Impact Matters for Good Developers (GOTO Berlin)
Why Having Impact Matters for Good Developers (GOTO Berlin)Wooga
 
Beyond Devops_GOTOBerlin2013_Tim Lossen
Beyond Devops_GOTOBerlin2013_Tim LossenBeyond Devops_GOTOBerlin2013_Tim Lossen
Beyond Devops_GOTOBerlin2013_Tim LossenWooga
 
2013 10-03-ngs-samuli snellman-bridging
2013 10-03-ngs-samuli snellman-bridging2013 10-03-ngs-samuli snellman-bridging
2013 10-03-ngs-samuli snellman-bridgingWooga
 
Reliving the history of multiplayer games
Reliving the history of multiplayer gamesReliving the history of multiplayer games
Reliving the history of multiplayer gamesWooga
 
Riak at Wooga_Riak Meetup Sept 2013
Riak at Wooga_Riak Meetup Sept 2013Riak at Wooga_Riak Meetup Sept 2013
Riak at Wooga_Riak Meetup Sept 2013Wooga
 
Programmin games - A 10 minute crash course
Programmin games - A 10 minute crash courseProgrammin games - A 10 minute crash course
Programmin games - A 10 minute crash courseWooga
 

Mais de Wooga (20)

Saying No to the CEO: A Deep Look at Independent Teams - Adam Telfer
Saying No to the CEO: A Deep Look at Independent Teams - Adam TelferSaying No to the CEO: A Deep Look at Independent Teams - Adam Telfer
Saying No to the CEO: A Deep Look at Independent Teams - Adam Telfer
 
Innovation dank DevOps (DevOpsCon Berlin 2015)
Innovation dank DevOps (DevOpsCon Berlin 2015)Innovation dank DevOps (DevOpsCon Berlin 2015)
Innovation dank DevOps (DevOpsCon Berlin 2015)
 
Big Fish, small pond - strategies for surviving in a maturing market - Ed Biden
Big Fish, small pond - strategies for surviving in a maturing market - Ed BidenBig Fish, small pond - strategies for surviving in a maturing market - Ed Biden
Big Fish, small pond - strategies for surviving in a maturing market - Ed Biden
 
Review mining aps2014 berlin
Review mining aps2014 berlinReview mining aps2014 berlin
Review mining aps2014 berlin
 
Riak & Wooga_Geeek2Geeek Meetup2014 Berlin
Riak & Wooga_Geeek2Geeek Meetup2014 BerlinRiak & Wooga_Geeek2Geeek Meetup2014 Berlin
Riak & Wooga_Geeek2Geeek Meetup2014 Berlin
 
Staying in the Game: Game localization practices for the mobile market
Staying in the Game: Game localization practices for the mobile marketStaying in the Game: Game localization practices for the mobile market
Staying in the Game: Game localization practices for the mobile market
 
Startup Weekend_Makers and Games_Philipp Stelzer
Startup Weekend_Makers and Games_Philipp StelzerStartup Weekend_Makers and Games_Philipp Stelzer
Startup Weekend_Makers and Games_Philipp Stelzer
 
DevOps goes Mobile (daho.am)
DevOps goes Mobile (daho.am)DevOps goes Mobile (daho.am)
DevOps goes Mobile (daho.am)
 
DevOps goes Mobile - Jax 2014 - Jesper Richter-Reichhelm
DevOps goes Mobile - Jax 2014 - Jesper Richter-ReichhelmDevOps goes Mobile - Jax 2014 - Jesper Richter-Reichhelm
DevOps goes Mobile - Jax 2014 - Jesper Richter-Reichhelm
 
CodeFest 2014_Mobile Game Development
CodeFest 2014_Mobile Game DevelopmentCodeFest 2014_Mobile Game Development
CodeFest 2014_Mobile Game Development
 
Jelly Splash: Puzzling your way to the top of the App Stores - GDC 2014
Jelly Splash: Puzzling your way to the top of the App Stores - GDC 2014Jelly Splash: Puzzling your way to the top of the App Stores - GDC 2014
Jelly Splash: Puzzling your way to the top of the App Stores - GDC 2014
 
Pocket Gamer Connects 2014_The Experience of Entering the Korean Market
Pocket Gamer Connects 2014_The Experience of Entering the Korean MarketPocket Gamer Connects 2014_The Experience of Entering the Korean Market
Pocket Gamer Connects 2014_The Experience of Entering the Korean Market
 
How to stand out in a hit driven business - Game Connection Paris 2013 - SebK...
How to stand out in a hit driven business - Game Connection Paris 2013 - SebK...How to stand out in a hit driven business - Game Connection Paris 2013 - SebK...
How to stand out in a hit driven business - Game Connection Paris 2013 - SebK...
 
DevOps the Wooga way (Webmontag Berlin)
DevOps the Wooga way (Webmontag Berlin)DevOps the Wooga way (Webmontag Berlin)
DevOps the Wooga way (Webmontag Berlin)
 
Why Having Impact Matters for Good Developers (GOTO Berlin)
Why Having Impact Matters for Good Developers (GOTO Berlin)Why Having Impact Matters for Good Developers (GOTO Berlin)
Why Having Impact Matters for Good Developers (GOTO Berlin)
 
Beyond Devops_GOTOBerlin2013_Tim Lossen
Beyond Devops_GOTOBerlin2013_Tim LossenBeyond Devops_GOTOBerlin2013_Tim Lossen
Beyond Devops_GOTOBerlin2013_Tim Lossen
 
2013 10-03-ngs-samuli snellman-bridging
2013 10-03-ngs-samuli snellman-bridging2013 10-03-ngs-samuli snellman-bridging
2013 10-03-ngs-samuli snellman-bridging
 
Reliving the history of multiplayer games
Reliving the history of multiplayer gamesReliving the history of multiplayer games
Reliving the history of multiplayer games
 
Riak at Wooga_Riak Meetup Sept 2013
Riak at Wooga_Riak Meetup Sept 2013Riak at Wooga_Riak Meetup Sept 2013
Riak at Wooga_Riak Meetup Sept 2013
 
Programmin games - A 10 minute crash course
Programmin games - A 10 minute crash courseProgrammin games - A 10 minute crash course
Programmin games - A 10 minute crash course
 

Último

Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsHandwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsMaria Levchenko
 
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptxHampshireHUG
 
08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking MenDelhi Call girls
 
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...apidays
 
08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking MenDelhi Call girls
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024The Digital Insurer
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...Martijn de Jong
 
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024The Digital Insurer
 
Slack Application Development 101 Slides
Slack Application Development 101 SlidesSlack Application Development 101 Slides
Slack Application Development 101 Slidespraypatel2
 
🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘RTylerCroy
 
CNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of ServiceCNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of Servicegiselly40
 
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking MenDelhi Call girls
 
A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024Results
 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024Rafal Los
 
What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?Antenna Manufacturer Coco
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)Gabriella Davis
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processorsdebabhi2
 
Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)wesley chun
 
Presentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreterPresentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreternaman860154
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfsudhanshuwaghmare1
 

Último (20)

Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsHandwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed texts
 
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
 
08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men
 
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
 
08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...
 
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
 
Slack Application Development 101 Slides
Slack Application Development 101 SlidesSlack Application Development 101 Slides
Slack Application Development 101 Slides
 
🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘
 
CNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of ServiceCNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of Service
 
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
 
A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024
 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024
 
What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processors
 
Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)
 
Presentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreterPresentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreter
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdf
 

Entitas System Architecture with Unity - Maxim Zaks and Simon Schmid

  • 2. Maxim Zaks | @icex33 | github.com/mzaks Simon Schmid | @s_schmid | github.com/sschmid
  • 4.
  • 5. Unity pain points 4 Testability 4 Code sharing 4 Co-dependent logic 4 Querying 4 Deleting code
  • 13.
  • 15.
  • 16. Components are just data 4 no Methods, no Start(), no Update() 4 no inheritance +-----------+ | Component | |-----------| | Data | +-----------+
  • 17. PositionComponent using Entitas; public class PositionComponent : IComponent { public int x; public int y; }
  • 18. GameBoardElementComponent using Entitas; public class GameBoardElementComponent : IComponent { }
  • 19. Entity is a container for components +-----------+ | Entity | |-----------| | Component | | | | Component | | | | Component | +-----------+
  • 20. Entity 4 Add Components 4 Replace Components 4 Remove Components
  • 21. Create Blocker Entity public static Entity CreateBlocker(this Pool pool, int x, int y) { return pool.CreateEntity() .IsGameBoardElement(true) .AddPosition(x, y) .AddResource(Res.Blocker); }
  • 22. Pool contains all entities +------------------+ | Pool | |------------------| | e e | | e e | | e e | | e e e | | e e | | e e | | e e e | | e e e | +------------------+
  • 23. Pool 4 Create Entity 4 Destroy Entity 4 Get all Entities 4 Get Group
  • 24. Groups are subsets of entities 4 Performance optimization for querying 4 Matcher is a filter description +-------------+ Groups: | e | Subsets of entities in the pool | e e | for blazing fast querying | +------------+ | e | | | | e | e | e | +--------|----+ e | | e | | e e | +------------+
  • 25. Get Group from pool _pool.GetGroup( Matcher.AllOf( Matcher.GameBoardElement, Matcher.Position ) );
  • 26. +------------------+ | Pool | Entitas in a nutshell |------------------| | e e | +-----------+ | e e---|----> | Entity | | e e | |-----------| | e e e | | Component | | e e | | | +-----------+ | e e | | Component-|----> | Component | | e e e | | | |-----------| | e e e | | Component | | Data | +------------------+ +-----------+ +-----------+ | | | +-------------+ Groups: | | e | Subsets of entities in the pool | | e e | for blazing fast querying +---> | +------------+ | e | | | | e | e | e | +--------|----+ e | | e | | e e | +------------+
  • 28. System 4 Start / Execute 4 No State!!!
  • 29. +------------------+ +-----------------------------+ | Pool | | System | |------------------| |-----------------------------| | e e | | - Execute | | e e | | | | e e | | +-------------+ | | e e e | | | e | Groups | | e e |+----|->| e e | | | e e | | | +------------+ | | e e e | | | e | | | | | e e e | | | e | e | e | | +------------------+ | +--------|----+ e | | | | e | | | | e e | | | +------------+ | +-----------------------------+
  • 30. MoveSystem public void Execute() { var movables = _pool.GetGroup( Matcher.AllOf( Matcher.Move, Matcher.Position )); foreach (var e in movables.GetEntities()) { var move = e.move; var pos = e.position; e.ReplacePosition(pos.x, pos.y + move.speed, pos.z); } }
  • 31. Chain of Responsibility | | |-------------------------------- Game Loop --------------------------------| | | +------------+ +------------+ +------------+ +------------+ | | | | | | | | | System | +---> | System | +---> | System | +---> | System | | | | | | | | | +------------+ +------------+ +------------+ +------------+
  • 32. return new Systems() .Add( pool.CreateGameBoardSystem ()) .Add( pool.CreateCreateGameBoardCacheSystem ()) .Add( pool.CreateFallSystem ()) .Add( pool.CreateFillSystem ()) .Add( pool.CreateProcessInputSystem ()) .Add( pool.CreateRemoveViewSystem ()) .Add( pool.CreateAddViewSystem ()) .Add( pool.CreateRenderPositionSystem ()) .Add( pool.CreateDestroySystem ()) .Add( pool.CreateScoreSystem ());
  • 33. Reacting to changes in a Group 4 On Entity added 4 On Entity removed
  • 34. ScoreLabelController void Start() { _pool.GetGroup(Matcher.Score).OnEntityAdded += (group, entity) => updateScore(entity.score.value); updateScore(_pool.score.value); } void updateScore(int score) { _label.text = "Score " + score; }
  • 35. Reactive System 4 Executed only when entities in a group have changed 4 Aggregate and process changes
  • 36. Render Position System public class RenderPositionSystem : IReactiveSystem { public IMatcher trigger { get { return Matcher.AllOf(Matcher.Position, Matcher.View); } } public GroupEventType eventType { get { return GroupEventType.OnEntityAdded; } } public void Execute(Entity[] entities) { foreach (var e in entities) { var pos = e.position; e.view.gameObject.transform.position = new Vector3(pos.x, pos.y); } } }
  • 39.
  • 40.
  • 42. Dictionary e.AddComponent(new PositionComponent()); var component = e.GetComponent<PositionComponent>(); Array e.AddComponent(new PositionComponent(), 5); var component = (PositionComponent)e.GetComponent(5);
  • 43.
  • 44.
  • 46. Before Code Generation PositionComponent component; if (e.HasComponent(ComponentIds.Position)) { e.WillRemoveComponent(ComponentIds.Position); component = (PositionComponent)e.GetComponent(ComponentIds.Position); } else { component = new PositionComponent(); } component.x = 10; component.y = 10; e.ReplaceComponent(ComponentIds.Position, component);
  • 49. var pool = Pools.pool; var e = pool.CreateEntity(); e.AddPosition(1, 2, 3); e.ReplacePosition(4, 5, 6); e.RemovePosition(); var posX = e.position.x; var hasPos = e.hasPosition; e.isMovable = true; e.isMovable = false; var isMovable = e.isMovable;
  • 51.
  • 53. Recap
  • 54. Unity pain points 4 Testability 4 Code sharing 4 Co-dependent logic 4 Querying 4 Deleting code
  • 55. Advantages 4 Straightforward to achieve Determinism and therefore Replay 4 Simulation Speed (2x, 4x) 4 Headless Simulation, just remove systems which rely on GameObjects (render systems) 4 Save Game (Serialization / Deserialization) send data to backend on change
  • 56. Q&AMaxim Zaks | @icex33 | github.com/mzaks Simon Schmid | @s_schmid | github.com/sschmid tinyurl.com/entitas