SlideShare a Scribd company logo
1 of 38
Download to read offline
A Multiplatform
Architecture for
Games
FISL 14
Thiago Figueredo Cardoso, Thiago de Barros Lacerda
Multiplatform development
At one extreme...
... one code per platform/device
Expensive
Hard to mantain
At the other extreme...
... same code for all platforms/devices
Needs a framework
Not every aspect of the code can be easily adapted
The intermediate path
We need to split platform-dependent from platform-independent
code and rewrite only the former
Game development
Architeture
Sprite.prototype.update = function (delta) {
// update position, animation, ...
};
Sprite.prototype.draw = function (context) {
< // draw on the screen
};
function mainLoop () {
for (var i in sprites) {
sprites[i].update();
sprites[i].draw();
}
}
Sprite's update deals with UI (platform-dependent) and
behavior (platform-independent)
What kinds of problems do we
face with this kind of
architecture?
1. Physics parameters change
when resolution changes
RectSprite.prototype.update = function (delta) {
this.x += this.velocity * delta;
};
RectSprite.prototype.draw = function (context) {
context.fillStyle = "black";
context.fillRect(this.x, this.y, this.width, this.height);
};
Velocity (pixel/sec): 10 Play
The velocity needs to be
scaled
1. Before setting the sprite parameter:
2. Inside the sprite's update:
var rect = new RectSprite();
rect.velocity = config.velocity / UI.SCALE;
RectSprite.prototype.update = function (delta) {
this.x += (this.velocity / UI.SCALE) * delta;
};
2. Scaling can introduce
rounding errors
3. Testing can become harder
Circus v1
It wasn't modeled for multiple platforms
Problems with Circus v1
class Sprite : public QGraphicsObject
{
Q_OBJECT
...
};
Elements are implemented as objects of the graphic system
Problems with Circus v1
Behavior and UI mixed
Problems with Circus v1
void GameWorld::step(qreal dt)
{
...
const QPointF &ds = dt * sprite->velocity() * worldScaleFactor;
...
}
Multiple resolutions handled with scales in the physics
Circus v1 on Windows Phone
No Qt, no C++, no reuse :(
On top on the Sparta engine
Circus v2
New elements
Bug fixes
Problems with Circus v2
Implementation of classes/functionalities of the Qt framework in C#:
QtPropertyAnimation
Rotation
Object tree
Collision
Problems with Circus v2
No testing framework
Step-by-step debugging in many cases
Circus v3?
Oh, please, let's start from scratch!
A multiplatform architecture
for Circus
Three layer architecture, separation of concerns
Platform deals with platform-dependent issues (UI, audio and
filesystem)
Tests uses the Core directly
Core deals with the behavior of the elements and game logic (score,
world)
Physics deals with collisions and its resolution
How a game element is
represented?
Physics
Elements are bodies, interactions are collisions
Core
Elements are entities that have a group of bodies
Interactions are input events and collisions between entities
UI
Elements are sprites that display an entity
No interactions, only forwarding of events (the UI doesn't alter the
game)
How do we use it in multiple
platforms?
Rewrite only the Platform layer
Summary
Behavior consistency guaranteed by having only one code for
behavior
No framework dependency, making it easy to translate to other
languages (C++?)
Tests are easier to write (no frameworks) and need to be written
once (one code)
Porting effort is clear
Let's try it!
INdT @ FISL
Workshop de Jogos HTML5 - Sala 714 - 14h
A Multiplatform
Architecture for
Games
FISL 14
Thiago Figueredo Cardoso, Thiago de Barros Lacerda

More Related Content

Viewers also liked

Dr. Jusuf Kardavi - Obligimet e të rinjëve të sotshëm muslimanë
Dr. Jusuf Kardavi - Obligimet e të rinjëve të sotshëm muslimanëDr. Jusuf Kardavi - Obligimet e të rinjëve të sotshëm muslimanë
Dr. Jusuf Kardavi - Obligimet e të rinjëve të sotshëm muslimanë
Shkumbim Jakupi
 
Catalogue francais 2014
Catalogue francais 2014Catalogue francais 2014
Catalogue francais 2014
EUROPAGES
 
Desarrollo territorial
Desarrollo territorialDesarrollo territorial
Desarrollo territorial
Gustavo Sosa
 

Viewers also liked (20)

Presentación 1
Presentación 1Presentación 1
Presentación 1
 
Memoria Red Salud 2012
Memoria Red Salud 2012Memoria Red Salud 2012
Memoria Red Salud 2012
 
Driving Value Through Video - Michael Weissman – General Manager, Creator Pla...
Driving Value Through Video - Michael Weissman – General Manager, Creator Pla...Driving Value Through Video - Michael Weissman – General Manager, Creator Pla...
Driving Value Through Video - Michael Weissman – General Manager, Creator Pla...
 
Thought up in Barcelona 1
Thought up in Barcelona 1Thought up in Barcelona 1
Thought up in Barcelona 1
 
Charla Tryve en Expobike 2015
Charla Tryve en Expobike 2015Charla Tryve en Expobike 2015
Charla Tryve en Expobike 2015
 
Dr. Jusuf Kardavi - Obligimet e të rinjëve të sotshëm muslimanë
Dr. Jusuf Kardavi - Obligimet e të rinjëve të sotshëm muslimanëDr. Jusuf Kardavi - Obligimet e të rinjëve të sotshëm muslimanë
Dr. Jusuf Kardavi - Obligimet e të rinjëve të sotshëm muslimanë
 
Huella Líquida, el Liderazgo Inspirador en el Ecosistema Interno
Huella Líquida, el Liderazgo Inspirador en el Ecosistema InternoHuella Líquida, el Liderazgo Inspirador en el Ecosistema Interno
Huella Líquida, el Liderazgo Inspirador en el Ecosistema Interno
 
Pay stream and basware einvoicing trends and truths 12.11.14 final
Pay stream and basware einvoicing trends and truths 12.11.14 finalPay stream and basware einvoicing trends and truths 12.11.14 final
Pay stream and basware einvoicing trends and truths 12.11.14 final
 
TIM SA - podsumowanie I kwartału 2016 r.
TIM SA - podsumowanie I kwartału 2016 r.TIM SA - podsumowanie I kwartału 2016 r.
TIM SA - podsumowanie I kwartału 2016 r.
 
Csr
CsrCsr
Csr
 
Felicidad y desarrollo de la cultura organizacional
Felicidad y desarrollo de la cultura organizacionalFelicidad y desarrollo de la cultura organizacional
Felicidad y desarrollo de la cultura organizacional
 
Searle Vitamin Water (Realization of New Category)
Searle Vitamin Water (Realization of New Category)Searle Vitamin Water (Realization of New Category)
Searle Vitamin Water (Realization of New Category)
 
Tratamiento de aguas residuales
Tratamiento de aguas residualesTratamiento de aguas residuales
Tratamiento de aguas residuales
 
Kevin Hillstrom - How The Future of Retail is Like Professional Sports
Kevin Hillstrom - How The Future of Retail is Like Professional SportsKevin Hillstrom - How The Future of Retail is Like Professional Sports
Kevin Hillstrom - How The Future of Retail is Like Professional Sports
 
Conociendo el interior de filtros para aceite
Conociendo el interior de filtros para aceiteConociendo el interior de filtros para aceite
Conociendo el interior de filtros para aceite
 
Catalogue francais 2014
Catalogue francais 2014Catalogue francais 2014
Catalogue francais 2014
 
Desarrollo territorial
Desarrollo territorialDesarrollo territorial
Desarrollo territorial
 
Reforç i ampliacio matem 2
Reforç i ampliacio matem 2Reforç i ampliacio matem 2
Reforç i ampliacio matem 2
 
UX & RIAs: UI Design Challenges (ERGOSIGN)
UX & RIAs: UI Design Challenges (ERGOSIGN)UX & RIAs: UI Design Challenges (ERGOSIGN)
UX & RIAs: UI Design Challenges (ERGOSIGN)
 
Clima Oceánico y Clima Chino
Clima Oceánico y Clima ChinoClima Oceánico y Clima Chino
Clima Oceánico y Clima Chino
 

Similar to FISL14 - A Multiplatform Architecture for Games

Gdc09 Minigames
Gdc09 MinigamesGdc09 Minigames
Gdc09 Minigames
Susan Gold
 
Track c-High speed transaction-based hw-sw coverification -eve
Track c-High speed transaction-based hw-sw coverification -eveTrack c-High speed transaction-based hw-sw coverification -eve
Track c-High speed transaction-based hw-sw coverification -eve
chiportal
 
Y1 gd engine_terminology (1) (4)
Y1 gd engine_terminology (1) (4) Y1 gd engine_terminology (1) (4)
Y1 gd engine_terminology (1) (4)
TomCrook
 

Similar to FISL14 - A Multiplatform Architecture for Games (20)

Gdc09 Minigames
Gdc09 MinigamesGdc09 Minigames
Gdc09 Minigames
 
C# Variables and Operators
C# Variables and OperatorsC# Variables and Operators
C# Variables and Operators
 
Parallelizing Conqueror's Blade
Parallelizing Conqueror's BladeParallelizing Conqueror's Blade
Parallelizing Conqueror's Blade
 
Unity3D Programming
Unity3D ProgrammingUnity3D Programming
Unity3D Programming
 
Java parallel programming made simple
Java parallel programming made simpleJava parallel programming made simple
Java parallel programming made simple
 
Unite 2013 optimizing unity games for mobile platforms
Unite 2013 optimizing unity games for mobile platformsUnite 2013 optimizing unity games for mobile platforms
Unite 2013 optimizing unity games for mobile platforms
 
UniRx - Reactive Extensions for Unity(EN)
UniRx - Reactive Extensions for Unity(EN)UniRx - Reactive Extensions for Unity(EN)
UniRx - Reactive Extensions for Unity(EN)
 
Game development via_sprite_kit
Game development via_sprite_kitGame development via_sprite_kit
Game development via_sprite_kit
 
Using High-Rising Cities to Visualize Performance in Real-Time
Using High-Rising Cities to Visualize Performance in Real-TimeUsing High-Rising Cities to Visualize Performance in Real-Time
Using High-Rising Cities to Visualize Performance in Real-Time
 
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)
 
Game Programming I - Introduction
Game Programming I - IntroductionGame Programming I - Introduction
Game Programming I - Introduction
 
OpenGL ES based UI Development on TI Platforms
OpenGL ES based UI Development on TI PlatformsOpenGL ES based UI Development on TI Platforms
OpenGL ES based UI Development on TI Platforms
 
Csharp dot net
Csharp dot netCsharp dot net
Csharp dot net
 
Monogame Introduction (ENG)
Monogame Introduction (ENG)Monogame Introduction (ENG)
Monogame Introduction (ENG)
 
Skiron - Experiments in CPU Design in D
Skiron - Experiments in CPU Design in DSkiron - Experiments in CPU Design in D
Skiron - Experiments in CPU Design in D
 
PVS-Studio, a solution for resource intensive applications development
PVS-Studio, a solution for resource intensive applications developmentPVS-Studio, a solution for resource intensive applications development
PVS-Studio, a solution for resource intensive applications development
 
Track c-High speed transaction-based hw-sw coverification -eve
Track c-High speed transaction-based hw-sw coverification -eveTrack c-High speed transaction-based hw-sw coverification -eve
Track c-High speed transaction-based hw-sw coverification -eve
 
Introduction to Xamarin Mobile Platform
Introduction to Xamarin Mobile PlatformIntroduction to Xamarin Mobile Platform
Introduction to Xamarin Mobile Platform
 
Y1 gd engine_terminology (1) (4)
Y1 gd engine_terminology (1) (4) Y1 gd engine_terminology (1) (4)
Y1 gd engine_terminology (1) (4)
 
Sprite js vs craftyjs
Sprite js vs craftyjsSprite js vs craftyjs
Sprite js vs craftyjs
 

Recently uploaded

Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slideHistor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slide
vu2urc
 
Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and Myths
Joaquim Jorge
 

Recently uploaded (20)

AWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of TerraformAWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of Terraform
 
presentation ICT roal in 21st century education
presentation ICT roal in 21st century educationpresentation ICT roal in 21st century education
presentation ICT roal in 21st century education
 
Advantages of Hiring UIUX Design Service Providers for Your Business
Advantages of Hiring UIUX Design Service Providers for Your BusinessAdvantages of Hiring UIUX Design Service Providers for Your Business
Advantages of Hiring UIUX Design Service Providers for Your Business
 
Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slideHistor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slide
 
Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Script
 
Real Time Object Detection Using Open CV
Real Time Object Detection Using Open CVReal Time Object Detection Using Open CV
Real Time Object Detection Using Open CV
 
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdfUnderstanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
 
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...
 
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
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
 
Strategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherStrategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a Fresher
 
Developing An App To Navigate The Roads of Brazil
Developing An App To Navigate The Roads of BrazilDeveloping An App To Navigate The Roads of Brazil
Developing An App To Navigate The Roads of Brazil
 
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
 
HTML Injection Attacks: Impact and Mitigation Strategies
HTML Injection Attacks: Impact and Mitigation StrategiesHTML Injection Attacks: Impact and Mitigation Strategies
HTML Injection Attacks: Impact and Mitigation Strategies
 
Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024
 
Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and Myths
 
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
 
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt Robison
 

FISL14 - A Multiplatform Architecture for Games