SlideShare uma empresa Scribd logo
1 de 17
Baixar para ler offline
CONFIDENTIAL © 2015 MentorMate, Inc. All rights reserved.
by
Petar Kadakevliev
Make your HTML5 game multiplayer
CONFIDENTIAL © 2015 MentorMate, Inc. All rights reserved.
A ( little ) { bit } of [ history ] & < definition >
What is WebSocket?
➢ Full bi-directional
communication technology over
TCP connection
➢ Introduced in 2011.
➢ Almost full support.
How was it achieved before?
➢ Commet
➢ AJAX long-polling
What does it provide us with?
➢ Less overhead
➢ Server push to client (before SSE)
CONFIDENTIAL © 2015 MentorMate, Inc. All rights reserved.
(Technologies) {explained} …
The good old AJAX WebSocketsSSEAJAX long polling
Link :)Polling …
CONFIDENTIAL © 2015 MentorMate, Inc. All rights reserved.
(The) {Browser} [support]
How to check if browser supports it? What if browser doesn’t support it?
➢ Tries WebSocket connection
➢ fallsback to LongPolling ajax
➢ fallsback to other approach:
like
○ AJAX multipart streaming
○ JSONP polling
> window.WebSocket
||
/
function WebSocket() { [native code] }
CONFIDENTIAL © 2015 MentorMate, Inc. All rights reserved.
(How) {to} [debug]
Chrome, Chromium, Opera: in-built tool, inside the Developer-Tools.
Let’s see it :)
Fiddler
➢ Safari:
➢ Firefox:
➢ IE:
CONFIDENTIAL © 2015 MentorMate, Inc. All rights reserved.
(Your) {options} to [choose] <from>
Client side (JS):
➢ Pusher
➢ MeteorJS
➢ SocketIO
➢ SockJS
➢ Faye
Server side …
➢ NodeJS - SocketIO, EngineIO
➢ PHP - Ratchet
➢ Ruby - Faye, Juggernaut, Cramp
➢ Java - jWebSocket, WaterSpout
➢ .NET - XSockets
Client side (AS):
➢ AS3WebSocket
CONFIDENTIAL © 2015 MentorMate, Inc. All rights reserved.
(Let’s) {get} to [business] …
Setup the server:
➢ Include the socket.io module;
➢ Build the listeners and logic for
emitting messages.
➢ Run the server.
Setup the client:
➢ Include the socket.io JS file.
➢ Create the socket object.
➢ Start listening for and/or emit
messages.
CONFIDENTIAL © 2015 MentorMate, Inc. All rights reserved.
(Is) {it} <that> [easy] indeed :O …
And yes … And no …
➢ You’ve got the tools right away …
➢ You’ve got the support right away …
➢ You just have to start coding …
➢ (and eventually learn JavaScript)
➢ You still have to write code :)
➢ You have to make the logic.
➢ You have to have the server …
➢ You are entering a relatively new area
CONFIDENTIAL © 2015 MentorMate, Inc. All rights reserved.
(The) {process} of [making] a <multiplayer> |game|
Starts from a single player game:
➢ You already have the gameplay built
➢ You need to make the server side
➢ You need to extend the front-end
logic
➢ Front-end ⇒ Back-end
Directly start building a multiplayer game:
➢ You need a server from the beginning
➢ You can have the FE built, but not required
➢ You need to bind the FE to the BE
➢ Back-end ⇒ Front-end
CONFIDENTIAL © 2015 MentorMate, Inc. All rights reserved.
(Example) {one}
The single player game:
➢ A puzzle game;
➢ Single player only, round based;
➢ Let’s see it :)
➢ Link :)
How it became a multiplayer one:
➢ Adding server - it’s logic, state, DB, etc.;
➢ Adding challenge mode.
➢ Let’s see it :)
➢ Link ;)
CONFIDENTIAL © 2015 MentorMate, Inc. All rights reserved.
(Some) {interesting} [cases]
What would happen if:
➢ The internet stops
➢ this affects the client(s) first, then the server.
➢ The server crashes
➢ affects the server first, then the client.
➢ Simultaneous actions from the people
➢ affects both clients and server equaly
➢ Let’s see …
CONFIDENTIAL © 2015 MentorMate, Inc. All rights reserved.
(The) {problem} [with] <simultaneous> /actions/
The “World of Warcraft” scenario:
➢ Case: a simple duel
➢ Defining the server state - duel
➢ Processing the requests:
➢ request changes the state
➢ the state sends info to clients
➢ the “looser” indicates the new state
The puzzle scenario:
➢ Case: users finish at the same time
➢ Defining the server state - match
➢ Processing the requests
➢ request changes the state
➢ latter request ignored
➢ clients indicate the new state
CONFIDENTIAL © 2015 MentorMate, Inc. All rights reserved.
(WebSocket) vs. {Ajax}
Pros and cons.
➢ Support
➢ Developing
➢ Debugging
Let’s fight them :D
➢ A simple test :)
➢ Go :)
Why this comparison?
CONFIDENTIAL © 2015 MentorMate, Inc. All rights reserved.
(When) {speed} [matters]
When all is a matter of time :)
➢ The legend of the 2-week depression
➢ The distance
➢ The data being transferred
Let’s think of another scenario …
➢ The story of the 2 deadly fishes
➢ Extremely responsive server
➢ Short distance … small transferred
data … or something else ? :)
When speed doesn’t matter ?
Let’s see an example
CONFIDENTIAL © 2015 MentorMate, Inc. All rights reserved.
(Example) {two}
The “Chasing” game:
➢ Concept
➢ Extremely light front-end;
➢ Very minimal data transferred;
➢ Built just basic challenging system
In action:
➢ On a server in USA:
➢ Link :)
➢ On a server in BG:
➢ Link :)
CONFIDENTIAL © 2015 MentorMate, Inc. All rights reserved.
(Some) {resources} & [starting] [points]
Some resources on the topic:
➢ The jackal article …
➢ HTML5games
Some starting points:
➢ Access to a server
➢ Concept
➢ HTML5 games tutorials
➢ Youtube video tutorials
➢ Passion …
The missing wheel:
➢ Canvas
➢ Comparison …
CONFIDENTIAL © 2015 MentorMate, Inc. All rights reserved.
Any questions ? :)
(Thanks) {for} [watching]
How can you find me?
petar.kadakevliev@mentormate.com

Mais conteúdo relacionado

Mais procurados

DevOps Fest 2019. Игорь Фесенко. DevOps: Be good, Get good or Give up
DevOps Fest 2019. Игорь Фесенко. DevOps: Be good, Get good or Give upDevOps Fest 2019. Игорь Фесенко. DevOps: Be good, Get good or Give up
DevOps Fest 2019. Игорь Фесенко. DevOps: Be good, Get good or Give upDevOps_Fest
 
NodeJS & Socket IO on Microsoft Azure Cloud Web Sites - DWX 2014
NodeJS & Socket IO on Microsoft Azure Cloud Web Sites - DWX 2014NodeJS & Socket IO on Microsoft Azure Cloud Web Sites - DWX 2014
NodeJS & Socket IO on Microsoft Azure Cloud Web Sites - DWX 2014Stéphane ESCANDELL
 
WebSockets Jump Start
WebSockets Jump StartWebSockets Jump Start
WebSockets Jump StartHaim Michael
 
Understanding Non Blocking I/O with Python
Understanding Non Blocking I/O with PythonUnderstanding Non Blocking I/O with Python
Understanding Non Blocking I/O with PythonVaidik Kapoor
 
Altitude SF 2017: Reddit - How we built and scaled r/place
Altitude SF 2017: Reddit - How we built and scaled r/placeAltitude SF 2017: Reddit - How we built and scaled r/place
Altitude SF 2017: Reddit - How we built and scaled r/placeFastly
 
Using Websockets in Play !
Using Websockets in Play !Using Websockets in Play !
Using Websockets in Play !Knoldus Inc.
 
ClusterDesktop and VPN or how-to create a VPN network between ClusterDesktop ...
ClusterDesktop and VPN or how-to create a VPN network between ClusterDesktop ...ClusterDesktop and VPN or how-to create a VPN network between ClusterDesktop ...
ClusterDesktop and VPN or how-to create a VPN network between ClusterDesktop ...Emil Parashkevov
 
Breaking the Server-Client Divide with Node.js and React
Breaking the Server-Client Divide with Node.js and ReactBreaking the Server-Client Divide with Node.js and React
Breaking the Server-Client Divide with Node.js and ReactDejan Glozic
 
[Back2 basic] from c10k problem to concurrency concept
[Back2 basic] from c10k problem to concurrency concept[Back2 basic] from c10k problem to concurrency concept
[Back2 basic] from c10k problem to concurrency conceptTrịnh Thế Thành
 
Altitude San Francisco 2018: HTTP Invalidation Workshop
Altitude San Francisco 2018: HTTP Invalidation WorkshopAltitude San Francisco 2018: HTTP Invalidation Workshop
Altitude San Francisco 2018: HTTP Invalidation WorkshopFastly
 
Extreme Javascript Minification
Extreme Javascript MinificationExtreme Javascript Minification
Extreme Javascript MinificationDavid Goemans
 
Inside election night at The New York Times | Altitude NYC
Inside election night at The New York Times | Altitude NYCInside election night at The New York Times | Altitude NYC
Inside election night at The New York Times | Altitude NYCFastly
 
More efficient, usable web
More efficient, usable webMore efficient, usable web
More efficient, usable webChris Mills
 
Node js (runtime environment + js library) platform
Node js (runtime environment + js library) platformNode js (runtime environment + js library) platform
Node js (runtime environment + js library) platformSreenivas Kappala
 
Telling Tales and Solving Crimes with New Relic
Telling Tales and Solving Crimes with New RelicTelling Tales and Solving Crimes with New Relic
Telling Tales and Solving Crimes with New RelicJames Ford
 
Into the Wild with Node.js and Web Apps
Into the Wild with Node.js and Web AppsInto the Wild with Node.js and Web Apps
Into the Wild with Node.js and Web AppsChristopher Bumgardner
 
Javascript why what and how
Javascript why what and howJavascript why what and how
Javascript why what and howsureshpraja1234
 

Mais procurados (20)

DevOps Fest 2019. Игорь Фесенко. DevOps: Be good, Get good or Give up
DevOps Fest 2019. Игорь Фесенко. DevOps: Be good, Get good or Give upDevOps Fest 2019. Игорь Фесенко. DevOps: Be good, Get good or Give up
DevOps Fest 2019. Игорь Фесенко. DevOps: Be good, Get good or Give up
 
NodeJS & Socket IO on Microsoft Azure Cloud Web Sites - DWX 2014
NodeJS & Socket IO on Microsoft Azure Cloud Web Sites - DWX 2014NodeJS & Socket IO on Microsoft Azure Cloud Web Sites - DWX 2014
NodeJS & Socket IO on Microsoft Azure Cloud Web Sites - DWX 2014
 
WebSockets Jump Start
WebSockets Jump StartWebSockets Jump Start
WebSockets Jump Start
 
Understanding Non Blocking I/O with Python
Understanding Non Blocking I/O with PythonUnderstanding Non Blocking I/O with Python
Understanding Non Blocking I/O with Python
 
Altitude SF 2017: Reddit - How we built and scaled r/place
Altitude SF 2017: Reddit - How we built and scaled r/placeAltitude SF 2017: Reddit - How we built and scaled r/place
Altitude SF 2017: Reddit - How we built and scaled r/place
 
Using Websockets in Play !
Using Websockets in Play !Using Websockets in Play !
Using Websockets in Play !
 
ClusterDesktop and VPN or how-to create a VPN network between ClusterDesktop ...
ClusterDesktop and VPN or how-to create a VPN network between ClusterDesktop ...ClusterDesktop and VPN or how-to create a VPN network between ClusterDesktop ...
ClusterDesktop and VPN or how-to create a VPN network between ClusterDesktop ...
 
Websockets and SockJS, Real time chatting
Websockets and SockJS, Real time chattingWebsockets and SockJS, Real time chatting
Websockets and SockJS, Real time chatting
 
Breaking the Server-Client Divide with Node.js and React
Breaking the Server-Client Divide with Node.js and ReactBreaking the Server-Client Divide with Node.js and React
Breaking the Server-Client Divide with Node.js and React
 
[Back2 basic] from c10k problem to concurrency concept
[Back2 basic] from c10k problem to concurrency concept[Back2 basic] from c10k problem to concurrency concept
[Back2 basic] from c10k problem to concurrency concept
 
Altitude San Francisco 2018: HTTP Invalidation Workshop
Altitude San Francisco 2018: HTTP Invalidation WorkshopAltitude San Francisco 2018: HTTP Invalidation Workshop
Altitude San Francisco 2018: HTTP Invalidation Workshop
 
Nodejs
NodejsNodejs
Nodejs
 
Extreme Javascript Minification
Extreme Javascript MinificationExtreme Javascript Minification
Extreme Javascript Minification
 
Inside election night at The New York Times | Altitude NYC
Inside election night at The New York Times | Altitude NYCInside election night at The New York Times | Altitude NYC
Inside election night at The New York Times | Altitude NYC
 
More efficient, usable web
More efficient, usable webMore efficient, usable web
More efficient, usable web
 
Node js (runtime environment + js library) platform
Node js (runtime environment + js library) platformNode js (runtime environment + js library) platform
Node js (runtime environment + js library) platform
 
Dancing with websocket
Dancing with websocketDancing with websocket
Dancing with websocket
 
Telling Tales and Solving Crimes with New Relic
Telling Tales and Solving Crimes with New RelicTelling Tales and Solving Crimes with New Relic
Telling Tales and Solving Crimes with New Relic
 
Into the Wild with Node.js and Web Apps
Into the Wild with Node.js and Web AppsInto the Wild with Node.js and Web Apps
Into the Wild with Node.js and Web Apps
 
Javascript why what and how
Javascript why what and howJavascript why what and how
Javascript why what and how
 

Destaque

XXIII HR Weekend - Изграждане на собствени технически кадри
XXIII  HR Weekend - Изграждане на собствени технически кадриXXIII  HR Weekend - Изграждане на собствени технически кадри
XXIII HR Weekend - Изграждане на собствени технически кадриPolina Dekova
 
Как се печели от персонала? или Бъдещето на управлението на хора - Travel Аca...
Как се печели от персонала? или Бъдещето на управлението на хора - Travel Аca...Как се печели от персонала? или Бъдещето на управлението на хора - Travel Аca...
Как се печели от персонала? или Бъдещето на управлението на хора - Travel Аca...Polina Dekova
 
Be IT Conference 2015 | Dani Rangelov - Mobile Marketing Strategies
Be IT Conference 2015 | Dani Rangelov - Mobile Marketing StrategiesBe IT Conference 2015 | Dani Rangelov - Mobile Marketing Strategies
Be IT Conference 2015 | Dani Rangelov - Mobile Marketing StrategiesPolina Dekova
 
Be IT Conference 2015 | Skrill - How to protect your REST APIs with OAuth
Be IT Conference 2015 | Skrill - How to protect your REST APIs with OAuthBe IT Conference 2015 | Skrill - How to protect your REST APIs with OAuth
Be IT Conference 2015 | Skrill - How to protect your REST APIs with OAuthPolina Dekova
 
XXIV HR Weekend - „Наградата“, като инструмент за насърчаване на ангажираност...
XXIV HR Weekend - „Наградата“, като инструмент за насърчаване на ангажираност...XXIV HR Weekend - „Наградата“, като инструмент за насърчаване на ангажираност...
XXIV HR Weekend - „Наградата“, като инструмент за насърчаване на ангажираност...Polina Dekova
 
XXIII HR Weekend - Социалните мрежи в полза на намирането на таланти
XXIII HR Weekend - Социалните мрежи в полза на намирането на талантиXXIII HR Weekend - Социалните мрежи в полза на намирането на таланти
XXIII HR Weekend - Социалните мрежи в полза на намирането на талантиPolina Dekova
 
XXIV HR Weekend - Изграждане на собствени технически кадри
XXIV HR Weekend - Изграждане на собствени технически кадриXXIV HR Weekend - Изграждане на собствени технически кадри
XXIV HR Weekend - Изграждане на собствени технически кадриPolina Dekova
 
Internal company communication & employee engagement - Fraport
Internal company communication & employee engagement - FraportInternal company communication & employee engagement - Fraport
Internal company communication & employee engagement - FraportPolina Dekova
 
XXIV HR Weekend - Средния мениджмънт – ключът за организацията
XXIV HR Weekend - Средния мениджмънт – ключът за организациятаXXIV HR Weekend - Средния мениджмънт – ключът за организацията
XXIV HR Weekend - Средния мениджмънт – ключът за организациятаPolina Dekova
 
XXIII HR Weekend - Социалната ангажираност – дълг или потребност?
XXIII HR Weekend - Социалната ангажираност – дълг или потребност?XXIII HR Weekend - Социалната ангажираност – дълг или потребност?
XXIII HR Weekend - Социалната ангажираност – дълг или потребност?Polina Dekova
 
การสอนภาษาไทยในฐานะภาษาต่างประเทศ
การสอนภาษาไทยในฐานะภาษาต่างประเทศการสอนภาษาไทยในฐานะภาษาต่างประเทศ
การสอนภาษาไทยในฐานะภาษาต่างประเทศNuzzNussara
 
ConFoo 2015 - Securing RESTful resources with OAuth2
ConFoo 2015 - Securing RESTful resources with OAuth2ConFoo 2015 - Securing RESTful resources with OAuth2
ConFoo 2015 - Securing RESTful resources with OAuth2Rodrigo Cândido da Silva
 

Destaque (13)

XXIII HR Weekend - Изграждане на собствени технически кадри
XXIII  HR Weekend - Изграждане на собствени технически кадриXXIII  HR Weekend - Изграждане на собствени технически кадри
XXIII HR Weekend - Изграждане на собствени технически кадри
 
Как се печели от персонала? или Бъдещето на управлението на хора - Travel Аca...
Как се печели от персонала? или Бъдещето на управлението на хора - Travel Аca...Как се печели от персонала? или Бъдещето на управлението на хора - Travel Аca...
Как се печели от персонала? или Бъдещето на управлението на хора - Travel Аca...
 
Be IT Conference 2015 | Dani Rangelov - Mobile Marketing Strategies
Be IT Conference 2015 | Dani Rangelov - Mobile Marketing StrategiesBe IT Conference 2015 | Dani Rangelov - Mobile Marketing Strategies
Be IT Conference 2015 | Dani Rangelov - Mobile Marketing Strategies
 
Be IT Conference 2015 | Skrill - How to protect your REST APIs with OAuth
Be IT Conference 2015 | Skrill - How to protect your REST APIs with OAuthBe IT Conference 2015 | Skrill - How to protect your REST APIs with OAuth
Be IT Conference 2015 | Skrill - How to protect your REST APIs with OAuth
 
XXIV HR Weekend - „Наградата“, като инструмент за насърчаване на ангажираност...
XXIV HR Weekend - „Наградата“, като инструмент за насърчаване на ангажираност...XXIV HR Weekend - „Наградата“, като инструмент за насърчаване на ангажираност...
XXIV HR Weekend - „Наградата“, като инструмент за насърчаване на ангажираност...
 
XXIII HR Weekend - Социалните мрежи в полза на намирането на таланти
XXIII HR Weekend - Социалните мрежи в полза на намирането на талантиXXIII HR Weekend - Социалните мрежи в полза на намирането на таланти
XXIII HR Weekend - Социалните мрежи в полза на намирането на таланти
 
XXIV HR Weekend - Изграждане на собствени технически кадри
XXIV HR Weekend - Изграждане на собствени технически кадриXXIV HR Weekend - Изграждане на собствени технически кадри
XXIV HR Weekend - Изграждане на собствени технически кадри
 
Internal company communication & employee engagement - Fraport
Internal company communication & employee engagement - FraportInternal company communication & employee engagement - Fraport
Internal company communication & employee engagement - Fraport
 
XXIV HR Weekend - Средния мениджмънт – ключът за организацията
XXIV HR Weekend - Средния мениджмънт – ключът за организациятаXXIV HR Weekend - Средния мениджмънт – ключът за организацията
XXIV HR Weekend - Средния мениджмънт – ключът за организацията
 
XXIII HR Weekend - Социалната ангажираност – дълг или потребност?
XXIII HR Weekend - Социалната ангажираност – дълг или потребност?XXIII HR Weekend - Социалната ангажираност – дълг или потребност?
XXIII HR Weekend - Социалната ангажираност – дълг или потребност?
 
การสอนภาษาไทยในฐานะภาษาต่างประเทศ
การสอนภาษาไทยในฐานะภาษาต่างประเทศการสอนภาษาไทยในฐานะภาษาต่างประเทศ
การสอนภาษาไทยในฐานะภาษาต่างประเทศ
 
ConFoo 2015 - Securing RESTful resources with OAuth2
ConFoo 2015 - Securing RESTful resources with OAuth2ConFoo 2015 - Securing RESTful resources with OAuth2
ConFoo 2015 - Securing RESTful resources with OAuth2
 
10 Amazing facts about WhatsApp
10 Amazing facts about WhatsApp10 Amazing facts about WhatsApp
10 Amazing facts about WhatsApp
 

Semelhante a Be IT Conference 2015 | MentorMate - Adding multiplayer to your mobile game: Introduction to WebSockets

Unite2014 Bunny Necropsy - Servers, Syncing Game State, Security and Optimiza...
Unite2014 Bunny Necropsy - Servers, Syncing Game State, Security and Optimiza...Unite2014 Bunny Necropsy - Servers, Syncing Game State, Security and Optimiza...
Unite2014 Bunny Necropsy - Servers, Syncing Game State, Security and Optimiza...David Geurts
 
Engage 2022: The Superpower of Integrating External APIs for Notes and Domino...
Engage 2022: The Superpower of Integrating External APIs for Notes and Domino...Engage 2022: The Superpower of Integrating External APIs for Notes and Domino...
Engage 2022: The Superpower of Integrating External APIs for Notes and Domino...Serdar Basegmez
 
Developing a Cross Platform Game with Java & HTML5
Developing a Cross Platform Game with Java & HTML5Developing a Cross Platform Game with Java & HTML5
Developing a Cross Platform Game with Java & HTML5Josep Prat
 
All Aboard The Stateful Train
All Aboard The Stateful TrainAll Aboard The Stateful Train
All Aboard The Stateful TrainSmartLogic
 
Comet: Making The Web a 2-Way Medium
Comet: Making The Web a 2-Way MediumComet: Making The Web a 2-Way Medium
Comet: Making The Web a 2-Way MediumJoe Walker
 
Investing in a good software factory and automating the build process
Investing in a good software factory and automating the build processInvesting in a good software factory and automating the build process
Investing in a good software factory and automating the build processNicolas Mas
 
Capstone Project Final Presentation
Capstone Project Final PresentationCapstone Project Final Presentation
Capstone Project Final PresentationMatthew Chang
 
Going Live! with Comet
Going Live! with CometGoing Live! with Comet
Going Live! with CometSimon Willison
 
Html5 Game Development with Canvas
Html5 Game Development with CanvasHtml5 Game Development with Canvas
Html5 Game Development with CanvasPham Huy Tung
 
WebSockets Everywhere: the Future Transport Protocol for Everything (Almost)
WebSockets Everywhere: the Future Transport Protocol for Everything (Almost)WebSockets Everywhere: the Future Transport Protocol for Everything (Almost)
WebSockets Everywhere: the Future Transport Protocol for Everything (Almost)Ericom Software
 
Silverlight vs HTML5 - Lessons learned from the real world...
Silverlight vs HTML5 - Lessons learned from the real world...Silverlight vs HTML5 - Lessons learned from the real world...
Silverlight vs HTML5 - Lessons learned from the real world...Peter Gfader
 
Wido den hollander cloud stack and ceph
Wido den hollander   cloud stack and cephWido den hollander   cloud stack and ceph
Wido den hollander cloud stack and cephShapeBlue
 
Better, Faster, Stronger Streaming: Your First Dive into Flink SQL
Better, Faster, Stronger Streaming: Your First Dive into Flink SQLBetter, Faster, Stronger Streaming: Your First Dive into Flink SQL
Better, Faster, Stronger Streaming: Your First Dive into Flink SQLCaito Scherr
 
ITT 2015 - Kirk Pepperdine - The (not so) Dark Art of Performance Tuning, fro...
ITT 2015 - Kirk Pepperdine - The (not so) Dark Art of Performance Tuning, fro...ITT 2015 - Kirk Pepperdine - The (not so) Dark Art of Performance Tuning, fro...
ITT 2015 - Kirk Pepperdine - The (not so) Dark Art of Performance Tuning, fro...Istanbul Tech Talks
 
Mobile Virtualization Management
Mobile Virtualization ManagementMobile Virtualization Management
Mobile Virtualization ManagementYaniv Bronhaim
 

Semelhante a Be IT Conference 2015 | MentorMate - Adding multiplayer to your mobile game: Introduction to WebSockets (20)

Unite2014 Bunny Necropsy - Servers, Syncing Game State, Security and Optimiza...
Unite2014 Bunny Necropsy - Servers, Syncing Game State, Security and Optimiza...Unite2014 Bunny Necropsy - Servers, Syncing Game State, Security and Optimiza...
Unite2014 Bunny Necropsy - Servers, Syncing Game State, Security and Optimiza...
 
Engage 2022: The Superpower of Integrating External APIs for Notes and Domino...
Engage 2022: The Superpower of Integrating External APIs for Notes and Domino...Engage 2022: The Superpower of Integrating External APIs for Notes and Domino...
Engage 2022: The Superpower of Integrating External APIs for Notes and Domino...
 
Developing a Cross Platform Game with Java & HTML5
Developing a Cross Platform Game with Java & HTML5Developing a Cross Platform Game with Java & HTML5
Developing a Cross Platform Game with Java & HTML5
 
All Aboard The Stateful Train
All Aboard The Stateful TrainAll Aboard The Stateful Train
All Aboard The Stateful Train
 
Comet: Making The Web a 2-Way Medium
Comet: Making The Web a 2-Way MediumComet: Making The Web a 2-Way Medium
Comet: Making The Web a 2-Way Medium
 
Investing in a good software factory and automating the build process
Investing in a good software factory and automating the build processInvesting in a good software factory and automating the build process
Investing in a good software factory and automating the build process
 
Realtime with websockets
Realtime with websocketsRealtime with websockets
Realtime with websockets
 
Capstone Project Final Presentation
Capstone Project Final PresentationCapstone Project Final Presentation
Capstone Project Final Presentation
 
Serverless
ServerlessServerless
Serverless
 
Going Live! with Comet
Going Live! with CometGoing Live! with Comet
Going Live! with Comet
 
Project Timbit
Project TimbitProject Timbit
Project Timbit
 
Html5 Game Development with Canvas
Html5 Game Development with CanvasHtml5 Game Development with Canvas
Html5 Game Development with Canvas
 
Connect 4
Connect 4Connect 4
Connect 4
 
WebSockets Everywhere: the Future Transport Protocol for Everything (Almost)
WebSockets Everywhere: the Future Transport Protocol for Everything (Almost)WebSockets Everywhere: the Future Transport Protocol for Everything (Almost)
WebSockets Everywhere: the Future Transport Protocol for Everything (Almost)
 
Silverlight vs HTML5 - Lessons learned from the real world...
Silverlight vs HTML5 - Lessons learned from the real world...Silverlight vs HTML5 - Lessons learned from the real world...
Silverlight vs HTML5 - Lessons learned from the real world...
 
Wido den hollander cloud stack and ceph
Wido den hollander   cloud stack and cephWido den hollander   cloud stack and ceph
Wido den hollander cloud stack and ceph
 
Wt
WtWt
Wt
 
Better, Faster, Stronger Streaming: Your First Dive into Flink SQL
Better, Faster, Stronger Streaming: Your First Dive into Flink SQLBetter, Faster, Stronger Streaming: Your First Dive into Flink SQL
Better, Faster, Stronger Streaming: Your First Dive into Flink SQL
 
ITT 2015 - Kirk Pepperdine - The (not so) Dark Art of Performance Tuning, fro...
ITT 2015 - Kirk Pepperdine - The (not so) Dark Art of Performance Tuning, fro...ITT 2015 - Kirk Pepperdine - The (not so) Dark Art of Performance Tuning, fro...
ITT 2015 - Kirk Pepperdine - The (not so) Dark Art of Performance Tuning, fro...
 
Mobile Virtualization Management
Mobile Virtualization ManagementMobile Virtualization Management
Mobile Virtualization Management
 

Último

GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationMichael W. Hawkins
 
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
 
Salesforce Community Group Quito, Salesforce 101
Salesforce Community Group Quito, Salesforce 101Salesforce Community Group Quito, Salesforce 101
Salesforce Community Group Quito, Salesforce 101Paola De la Torre
 
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
 
Top 5 Benefits OF Using Muvi Live Paywall For Live Streams
Top 5 Benefits OF Using Muvi Live Paywall For Live StreamsTop 5 Benefits OF Using Muvi Live Paywall For Live Streams
Top 5 Benefits OF Using Muvi Live Paywall For Live StreamsRoshan Dwivedi
 
Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...
Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...
Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...gurkirankumar98700
 
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...Neo4j
 
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
 
🐬 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
 
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
 
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Igalia
 
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 slidevu2urc
 
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave 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
 
Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024The Digital Insurer
 
Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...Enterprise Knowledge
 
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
 
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 Scriptwesley chun
 
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
 
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure serviceWhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure servicePooja Nehwal
 

Último (20)

GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day Presentation
 
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
 
Salesforce Community Group Quito, Salesforce 101
Salesforce Community Group Quito, Salesforce 101Salesforce Community Group Quito, Salesforce 101
Salesforce Community Group Quito, Salesforce 101
 
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
 
Top 5 Benefits OF Using Muvi Live Paywall For Live Streams
Top 5 Benefits OF Using Muvi Live Paywall For Live StreamsTop 5 Benefits OF Using Muvi Live Paywall For Live Streams
Top 5 Benefits OF Using Muvi Live Paywall For Live Streams
 
Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...
Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...
Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...
 
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
 
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
 
🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘
 
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
 
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
 
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
 
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave 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
 
Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024
 
Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...
 
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
 
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
 
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...
 
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure serviceWhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
 

Be IT Conference 2015 | MentorMate - Adding multiplayer to your mobile game: Introduction to WebSockets

  • 1. CONFIDENTIAL © 2015 MentorMate, Inc. All rights reserved. by Petar Kadakevliev Make your HTML5 game multiplayer
  • 2. CONFIDENTIAL © 2015 MentorMate, Inc. All rights reserved. A ( little ) { bit } of [ history ] & < definition > What is WebSocket? ➢ Full bi-directional communication technology over TCP connection ➢ Introduced in 2011. ➢ Almost full support. How was it achieved before? ➢ Commet ➢ AJAX long-polling What does it provide us with? ➢ Less overhead ➢ Server push to client (before SSE)
  • 3. CONFIDENTIAL © 2015 MentorMate, Inc. All rights reserved. (Technologies) {explained} … The good old AJAX WebSocketsSSEAJAX long polling Link :)Polling …
  • 4. CONFIDENTIAL © 2015 MentorMate, Inc. All rights reserved. (The) {Browser} [support] How to check if browser supports it? What if browser doesn’t support it? ➢ Tries WebSocket connection ➢ fallsback to LongPolling ajax ➢ fallsback to other approach: like ○ AJAX multipart streaming ○ JSONP polling > window.WebSocket || / function WebSocket() { [native code] }
  • 5. CONFIDENTIAL © 2015 MentorMate, Inc. All rights reserved. (How) {to} [debug] Chrome, Chromium, Opera: in-built tool, inside the Developer-Tools. Let’s see it :) Fiddler ➢ Safari: ➢ Firefox: ➢ IE:
  • 6. CONFIDENTIAL © 2015 MentorMate, Inc. All rights reserved. (Your) {options} to [choose] <from> Client side (JS): ➢ Pusher ➢ MeteorJS ➢ SocketIO ➢ SockJS ➢ Faye Server side … ➢ NodeJS - SocketIO, EngineIO ➢ PHP - Ratchet ➢ Ruby - Faye, Juggernaut, Cramp ➢ Java - jWebSocket, WaterSpout ➢ .NET - XSockets Client side (AS): ➢ AS3WebSocket
  • 7. CONFIDENTIAL © 2015 MentorMate, Inc. All rights reserved. (Let’s) {get} to [business] … Setup the server: ➢ Include the socket.io module; ➢ Build the listeners and logic for emitting messages. ➢ Run the server. Setup the client: ➢ Include the socket.io JS file. ➢ Create the socket object. ➢ Start listening for and/or emit messages.
  • 8. CONFIDENTIAL © 2015 MentorMate, Inc. All rights reserved. (Is) {it} <that> [easy] indeed :O … And yes … And no … ➢ You’ve got the tools right away … ➢ You’ve got the support right away … ➢ You just have to start coding … ➢ (and eventually learn JavaScript) ➢ You still have to write code :) ➢ You have to make the logic. ➢ You have to have the server … ➢ You are entering a relatively new area
  • 9. CONFIDENTIAL © 2015 MentorMate, Inc. All rights reserved. (The) {process} of [making] a <multiplayer> |game| Starts from a single player game: ➢ You already have the gameplay built ➢ You need to make the server side ➢ You need to extend the front-end logic ➢ Front-end ⇒ Back-end Directly start building a multiplayer game: ➢ You need a server from the beginning ➢ You can have the FE built, but not required ➢ You need to bind the FE to the BE ➢ Back-end ⇒ Front-end
  • 10. CONFIDENTIAL © 2015 MentorMate, Inc. All rights reserved. (Example) {one} The single player game: ➢ A puzzle game; ➢ Single player only, round based; ➢ Let’s see it :) ➢ Link :) How it became a multiplayer one: ➢ Adding server - it’s logic, state, DB, etc.; ➢ Adding challenge mode. ➢ Let’s see it :) ➢ Link ;)
  • 11. CONFIDENTIAL © 2015 MentorMate, Inc. All rights reserved. (Some) {interesting} [cases] What would happen if: ➢ The internet stops ➢ this affects the client(s) first, then the server. ➢ The server crashes ➢ affects the server first, then the client. ➢ Simultaneous actions from the people ➢ affects both clients and server equaly ➢ Let’s see …
  • 12. CONFIDENTIAL © 2015 MentorMate, Inc. All rights reserved. (The) {problem} [with] <simultaneous> /actions/ The “World of Warcraft” scenario: ➢ Case: a simple duel ➢ Defining the server state - duel ➢ Processing the requests: ➢ request changes the state ➢ the state sends info to clients ➢ the “looser” indicates the new state The puzzle scenario: ➢ Case: users finish at the same time ➢ Defining the server state - match ➢ Processing the requests ➢ request changes the state ➢ latter request ignored ➢ clients indicate the new state
  • 13. CONFIDENTIAL © 2015 MentorMate, Inc. All rights reserved. (WebSocket) vs. {Ajax} Pros and cons. ➢ Support ➢ Developing ➢ Debugging Let’s fight them :D ➢ A simple test :) ➢ Go :) Why this comparison?
  • 14. CONFIDENTIAL © 2015 MentorMate, Inc. All rights reserved. (When) {speed} [matters] When all is a matter of time :) ➢ The legend of the 2-week depression ➢ The distance ➢ The data being transferred Let’s think of another scenario … ➢ The story of the 2 deadly fishes ➢ Extremely responsive server ➢ Short distance … small transferred data … or something else ? :) When speed doesn’t matter ? Let’s see an example
  • 15. CONFIDENTIAL © 2015 MentorMate, Inc. All rights reserved. (Example) {two} The “Chasing” game: ➢ Concept ➢ Extremely light front-end; ➢ Very minimal data transferred; ➢ Built just basic challenging system In action: ➢ On a server in USA: ➢ Link :) ➢ On a server in BG: ➢ Link :)
  • 16. CONFIDENTIAL © 2015 MentorMate, Inc. All rights reserved. (Some) {resources} & [starting] [points] Some resources on the topic: ➢ The jackal article … ➢ HTML5games Some starting points: ➢ Access to a server ➢ Concept ➢ HTML5 games tutorials ➢ Youtube video tutorials ➢ Passion … The missing wheel: ➢ Canvas ➢ Comparison …
  • 17. CONFIDENTIAL © 2015 MentorMate, Inc. All rights reserved. Any questions ? :) (Thanks) {for} [watching] How can you find me? petar.kadakevliev@mentormate.com