SlideShare a Scribd company logo
1 of 26
Download to read offline
ROME 27-28 march 2015
Introduction to development of multiplayer
HTML5 games (with Socket.io)
Valerio «Lotti» Riva
valerio.riva@gmail.com
@ValerioRiva
http://it.linkedin.com/in/valerioriva/
ROME 27-28 march 2015 - Valerio Riva
Who am I?
• Web developer
• Game developer @Interactive Project
 MyGPTeam, MyGPTeam Turbo, OverVolt: crazy slot cars
 http://interactiveproject.com/
• Game Jammer
 https://www.facebook.com/RomeGameJams
• Mentor @CoderDojo Roma
 https://coderdojoroma.wordpress.com/
ROME 27-28 march 2015 - Valerio Riva
Intro
• Multiplayer architectures & technologies
• Multiplayer services
• Implementation of a simple multiplayer game
ROME 27-28 march 2015 - Valerio Riva
Multiplayer Architectures
• Client - Server
• Peer 2 Peer
• Hybrid (a mix of both)
ROME 27-28 march 2015 - Valerio Riva
Client - Server Paradigm
• Suitable for games that evolve over time
• Hard to maintain, high costs
• Lineage 2, World of Warcraft
ROME 27-28 march 2015 - Valerio Riva
Peer 2 Peer Paradigm
• Suitable for games that don’t evolve over time
• Easy to maintain, low costs
• Is it really used?
 Cheating, Modding, Pirates, Business
ROME 27-28 march 2015 - Valerio Riva
Hybrid Paradigm
• Most used!
• Client-Server duties: matchmaking, world data, …
• P2P duties: assets sharing, voip, …
ROME 27-28 march 2015 - Valerio Riva
«Multiplayer as a Service»
• Provides you infrastructure and algorithms
• Provides SDK for various game engines
• Reliability and auto-scaling
• Real-time / turn-based multiplayer
• Match-making, leaderboards, achievements
• Cloud storage (saved games)
• Free or paid services
ROME 27-28 march 2015 - Valerio Riva
Networking technologies
• Web API
 Request-Response system
 Identified by a url
 Permanent connection not required
 Suitable on asynchronous games
• Socket
 Bidirectional communication between softwares
 Identified by a protocol, an address and a port
 Permanet connection required
 Suitable on synchronous games
ROME 27-28 march 2015 - Valerio Riva
Networking technologies (2)
• Web API
• Socket
ROME 27-28 march 2015 - Valerio Riva
Socket instead of WebAPI
PRO
Full-duplex
communication
Real time!
Can use UDP protocol
CON
A stream of byte
Permanent connection
required
Firewall :
NAT :
ROME 27-28 march 2015 - Valerio Riva
WebSocket
• Works as an upgrade of standard HTTP connection
• Full-duplex channel over a single TCP connection
• WebSocket instead of Socket
PRO
Full-duplex
communication
Real time!
Firewall :)
CON
A stream of byte
Permanent connection
required
Can’t use UDP protocol
ROME 27-28 march 2015 - Valerio Riva
Socket.io
• A Javascript library that enhances WebSocket
• Easy to use
• Event-driven
• Falls back to other technologies if WebSocket is
not available
• Adds broadcasting
• Adds support to multiplexing with «namespaces»
• Adds support to rooms
ROME 27-28 march 2015 - Valerio Riva
Socket.io: Client example
<script src="/socket.io/socket.io.js"></script>
<script>
var socket = io();
socket.on('pong', function(data) {
//do something with received data
console.log(data);
});
socket.emit('ping', { user: "Lotti" });
</script>
ROME 27-28 march 2015 - Valerio Riva
Socket.io: Server example
var app = require('express')();
var http = require('http').Server(app);
var io = require('socket.io')(http);
io.on('connection', function(socket) {
//a socket just connected!
socket.on('ping', function(data) {
//do something with received data
console.log(data.user);
socket.emit('pong', 'hello!');
});
});
ROME 27-28 march 2015 - Valerio Riva
Socket.io instead of WebSocket
Full-duplex
communication
Real time!
Firewall :)
Event-driven
Rooms!
Permanent connection
required
Can’t use UDP protocol
ROME 27-28 march 2015 - Valerio Riva
Pong4
ROME 27-28 march 2015 - Valerio Riva
Pong4 (2)
• A simple real-time multiplayer "Pong" game
• Built with
 phaser.io (game)
 socket.io (networking)
 express.io (content delivery)
• Runs on node.js
• http://pong4.eu-gb.mybluemix.net
• https://github.com/Lotti/codemotion2015
ROME 27-28 march 2015 - Valerio Riva
Pong4 (3)
• Hybrid paradigm
 Server
Forwards events and data between clients
 Fat client (host): Game manager
Player movements
Checks collisions
Keeps scores
Starts and ends a game
 Thin client
Player movements
Can be promoted to host
ROME 27-28 march 2015 - Valerio Riva
Pong4 Server: host join event
socket.on('host', function(data, ack) {
var room = makeGameId();
socket.join(room, function (err) {
if (!err) {
clientPlayers[socket.id] = 0;
clients[socket.id] = room;
hosts[socket.id] = true;
ack(room);
log('host '+socket.id+' connected');
}
else {
log(err,'e');
sendError(1, "host: can't join room",
socket);
}
});
});
1
2
ROME 27-28 march 2015 - Valerio Riva
Pong4 Server: client join event
socket.on('join', function(data, ack) {
var room = data;
if (roomExists(room)) {
socket.join(room, function (err) {
if (!err) {
clients[socket.id] = room;
var players = socketsInRoom(room);
clientPlayers[socket.id] = players.length - 1;
ack({ playersCount: players.length });
io.to(room).emit('joined', { playersCount:
players.length });
}
else {
log(err, 'e');
sendError(3, "client: can't join room", socket);
}
});
}
else {
sendError(2, "that room doesn't exists", socket);
}
});
1
2
ROME 27-28 march 2015 - Valerio Riva
Pong4 Client: sending data
updateServer: function () {
//...
var data = { socketId: socket.id };
if (master) {
data['ball'] = true;
data['ballX'] = ball.position.x;
data['ballY'] = ball.position.y;
}
else data['ball'] = false;
data['player'] = parseInt(currentPlayer);
switch(data['player']) {
case 0: case 2:
data['paddle'] = paddles[currentPlayer].position.x;
break;
case 1: case 3:
data['paddle'] = paddles[currentPlayer].position.y;
break;
}
socket.emit('gameUpdate', data);
},
ROME 27-28 march 2015 - Valerio Riva
Pong4 Server: broadcasting data
socket.on('gameUpdate', function(data) {
var room = clients[data.socketId];
delete data.socketId;
io.to(room).emit('clientUpdate', data);
});
ROME 27-28 march 2015 - Valerio Riva
Pong4 Client: receiving data
updateClient: function (data) {
if (!master && data.ball == true) {
ball.position.x = data.ballX;
ball.position.y = data.ballY;
}
if (currentPlayer != data.player) {
switch(parseInt(data.player)) {
case 0: case 2:
paddles[data.player].position.x = data.paddle;
break;
case 1: case 3:
paddles[data.player].position.y = data.paddle;
break;
}
}
},
ROME 27-28 march 2015 - Valerio Riva
References
• http://socket.io/
• http://phaser.io/
• http://pong4.eu-gb.mybluemix.net/
• https://github.com/Lotti/codemotion2015/
• https://console.ng.bluemix.net/
• https://developers.google.com/games/services/
• https://www.exitgames.com/en/Realtime
• http://www.smartfoxserver.com/
• https://developer.apple.com/game-center/
• http://appwarp.shephertz.com/
ROME 27-28 march 2015 - Valerio Riva
Thank you!
Any Questions?
Leave your feedback on Joind.in!
https://joind.in/event/view/3347
valerio.riva@gmail.com
@ValerioRiva
http://it.linkedin.com/in/valerioriva/

More Related Content

What's hot

Heroes of Paragon: publishing Unity WebGL game on Facebook
Heroes of Paragon: publishing Unity WebGL game on FacebookHeroes of Paragon: publishing Unity WebGL game on Facebook
Heroes of Paragon: publishing Unity WebGL game on FacebookDevGAMM Conference
 
Building real time applications with Symfony2
Building real time applications with Symfony2Building real time applications with Symfony2
Building real time applications with Symfony2Antonio Peric-Mazar
 
Raspberry pi : how to get started
Raspberry pi : how to get startedRaspberry pi : how to get started
Raspberry pi : how to get started동호 손
 
Composer | PHP Dependency Manager
Composer | PHP Dependency ManagerComposer | PHP Dependency Manager
Composer | PHP Dependency ManagerUjjwal Ojha
 
Webinar - Auto-deploy Puppet Enterprise: Vagrant and Oscar
Webinar - Auto-deploy Puppet Enterprise: Vagrant and OscarWebinar - Auto-deploy Puppet Enterprise: Vagrant and Oscar
Webinar - Auto-deploy Puppet Enterprise: Vagrant and OscarOlinData
 
App::RemoteCommand
App::RemoteCommandApp::RemoteCommand
App::RemoteCommandShoichi Kaji
 
Building (localized) Vagrant boxes with Packer
Building (localized) Vagrant boxes with PackerBuilding (localized) Vagrant boxes with Packer
Building (localized) Vagrant boxes with PackerCristovao G. Verstraeten
 
Homer - Workshop at Kamailio World 2017
Homer - Workshop at Kamailio World 2017Homer - Workshop at Kamailio World 2017
Homer - Workshop at Kamailio World 2017Giacomo Vacca
 
Vagrant: The Oscar Plug-in
Vagrant: The Oscar Plug-inVagrant: The Oscar Plug-in
Vagrant: The Oscar Plug-inJeff Scelza
 
Game Programming - Cloud Development
Game Programming - Cloud DevelopmentGame Programming - Cloud Development
Game Programming - Cloud DevelopmentNick Pruehs
 
Oscar: Rapid Iteration with Vagrant and Puppet Enterprise - PuppetConf 2013
Oscar: Rapid Iteration with Vagrant and Puppet Enterprise - PuppetConf 2013Oscar: Rapid Iteration with Vagrant and Puppet Enterprise - PuppetConf 2013
Oscar: Rapid Iteration with Vagrant and Puppet Enterprise - PuppetConf 2013Puppet
 
Create your very own Development Environment with Vagrant and Packer
Create your very own Development Environment with Vagrant and PackerCreate your very own Development Environment with Vagrant and Packer
Create your very own Development Environment with Vagrant and Packerfrastel
 
Building A Streaming Apple TV App (CocoaConf San Jose, Nov 2016)
Building A Streaming Apple TV App (CocoaConf San Jose, Nov 2016)Building A Streaming Apple TV App (CocoaConf San Jose, Nov 2016)
Building A Streaming Apple TV App (CocoaConf San Jose, Nov 2016)Chris Adamson
 
Bash-ing brittle indicators: Red teaming mac-os without bash or python
Bash-ing brittle indicators: Red teaming mac-os without bash or pythonBash-ing brittle indicators: Red teaming mac-os without bash or python
Bash-ing brittle indicators: Red teaming mac-os without bash or pythonCody Thomas
 
Walking the Bifrost: An Operator's Guide to Heimdal & Kerberos on macOS
Walking the Bifrost: An Operator's Guide to Heimdal & Kerberos on macOSWalking the Bifrost: An Operator's Guide to Heimdal & Kerberos on macOS
Walking the Bifrost: An Operator's Guide to Heimdal & Kerberos on macOSCody Thomas
 
Get that Corner Office with Angular 2 and Electron
Get that Corner Office with Angular 2 and ElectronGet that Corner Office with Angular 2 and Electron
Get that Corner Office with Angular 2 and ElectronLukas Ruebbelke
 

What's hot (20)

Heroes of Paragon: publishing Unity WebGL game on Facebook
Heroes of Paragon: publishing Unity WebGL game on FacebookHeroes of Paragon: publishing Unity WebGL game on Facebook
Heroes of Paragon: publishing Unity WebGL game on Facebook
 
Building real time applications with Symfony2
Building real time applications with Symfony2Building real time applications with Symfony2
Building real time applications with Symfony2
 
Hello istio
Hello istioHello istio
Hello istio
 
XNA L01–Introduction
XNA L01–IntroductionXNA L01–Introduction
XNA L01–Introduction
 
Raspberry pi : how to get started
Raspberry pi : how to get startedRaspberry pi : how to get started
Raspberry pi : how to get started
 
Composer | PHP Dependency Manager
Composer | PHP Dependency ManagerComposer | PHP Dependency Manager
Composer | PHP Dependency Manager
 
Webinar - Auto-deploy Puppet Enterprise: Vagrant and Oscar
Webinar - Auto-deploy Puppet Enterprise: Vagrant and OscarWebinar - Auto-deploy Puppet Enterprise: Vagrant and Oscar
Webinar - Auto-deploy Puppet Enterprise: Vagrant and Oscar
 
App::RemoteCommand
App::RemoteCommandApp::RemoteCommand
App::RemoteCommand
 
Building (localized) Vagrant boxes with Packer
Building (localized) Vagrant boxes with PackerBuilding (localized) Vagrant boxes with Packer
Building (localized) Vagrant boxes with Packer
 
Homer - Workshop at Kamailio World 2017
Homer - Workshop at Kamailio World 2017Homer - Workshop at Kamailio World 2017
Homer - Workshop at Kamailio World 2017
 
2021laravelconftwslides6
2021laravelconftwslides62021laravelconftwslides6
2021laravelconftwslides6
 
Vagrant: The Oscar Plug-in
Vagrant: The Oscar Plug-inVagrant: The Oscar Plug-in
Vagrant: The Oscar Plug-in
 
Game Programming - Cloud Development
Game Programming - Cloud DevelopmentGame Programming - Cloud Development
Game Programming - Cloud Development
 
Oscar: Rapid Iteration with Vagrant and Puppet Enterprise - PuppetConf 2013
Oscar: Rapid Iteration with Vagrant and Puppet Enterprise - PuppetConf 2013Oscar: Rapid Iteration with Vagrant and Puppet Enterprise - PuppetConf 2013
Oscar: Rapid Iteration with Vagrant and Puppet Enterprise - PuppetConf 2013
 
Create your very own Development Environment with Vagrant and Packer
Create your very own Development Environment with Vagrant and PackerCreate your very own Development Environment with Vagrant and Packer
Create your very own Development Environment with Vagrant and Packer
 
Building A Streaming Apple TV App (CocoaConf San Jose, Nov 2016)
Building A Streaming Apple TV App (CocoaConf San Jose, Nov 2016)Building A Streaming Apple TV App (CocoaConf San Jose, Nov 2016)
Building A Streaming Apple TV App (CocoaConf San Jose, Nov 2016)
 
Bash-ing brittle indicators: Red teaming mac-os without bash or python
Bash-ing brittle indicators: Red teaming mac-os without bash or pythonBash-ing brittle indicators: Red teaming mac-os without bash or python
Bash-ing brittle indicators: Red teaming mac-os without bash or python
 
Walking the Bifrost: An Operator's Guide to Heimdal & Kerberos on macOS
Walking the Bifrost: An Operator's Guide to Heimdal & Kerberos on macOSWalking the Bifrost: An Operator's Guide to Heimdal & Kerberos on macOS
Walking the Bifrost: An Operator's Guide to Heimdal & Kerberos on macOS
 
Get that Corner Office with Angular 2 and Electron
Get that Corner Office with Angular 2 and ElectronGet that Corner Office with Angular 2 and Electron
Get that Corner Office with Angular 2 and Electron
 
BitTorrent on iOS
BitTorrent on iOSBitTorrent on iOS
BitTorrent on iOS
 

Viewers also liked

Building multiplayer games with angular, node, socket.io, and phaser.io
Building multiplayer games with angular, node, socket.io, and phaser.ioBuilding multiplayer games with angular, node, socket.io, and phaser.io
Building multiplayer games with angular, node, socket.io, and phaser.ioAri Lerner
 
Avoid loss of hair while coding Unity3D plugin for mobile
Avoid loss of hair while coding Unity3D plugin for mobileAvoid loss of hair while coding Unity3D plugin for mobile
Avoid loss of hair while coding Unity3D plugin for mobileValerio Riva
 
Html5 game, websocket e arduino
Html5 game, websocket e arduino Html5 game, websocket e arduino
Html5 game, websocket e arduino Giuseppe Modarelli
 
Realtime html5 multiplayer_games_with_node_js
Realtime html5 multiplayer_games_with_node_jsRealtime html5 multiplayer_games_with_node_js
Realtime html5 multiplayer_games_with_node_jsMario Gonzalez
 
Updates of socket.io@1.0
Updates of socket.io@1.0Updates of socket.io@1.0
Updates of socket.io@1.0Jxck Jxck
 
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
 
Real Time Communication using Node.js and Socket.io
Real Time Communication using Node.js and Socket.ioReal Time Communication using Node.js and Socket.io
Real Time Communication using Node.js and Socket.ioMindfire Solutions
 
Going realtime with Socket.IO
Going realtime with Socket.IOGoing realtime with Socket.IO
Going realtime with Socket.IOChristian Joudrey
 
Real-time Web Application with Socket.IO, Node.js, and Redis
Real-time Web Application with Socket.IO, Node.js, and RedisReal-time Web Application with Socket.IO, Node.js, and Redis
Real-time Web Application with Socket.IO, Node.js, and RedisYork Tsai
 
From Push Technology to Real-Time Messaging and WebSockets
From Push Technology to Real-Time Messaging and WebSocketsFrom Push Technology to Real-Time Messaging and WebSockets
From Push Technology to Real-Time Messaging and WebSocketsAlessandro Alinone
 
Nodejs Explained with Examples
Nodejs Explained with ExamplesNodejs Explained with Examples
Nodejs Explained with ExamplesGabriele Lana
 
Workshops, workflows & wooden trains
Workshops, workflows & wooden trainsWorkshops, workflows & wooden trains
Workshops, workflows & wooden trainsRick Prelinger
 
Estado de resultados
Estado de resultadosEstado de resultados
Estado de resultadosEmilmar15
 

Viewers also liked (20)

Building multiplayer games with angular, node, socket.io, and phaser.io
Building multiplayer games with angular, node, socket.io, and phaser.ioBuilding multiplayer games with angular, node, socket.io, and phaser.io
Building multiplayer games with angular, node, socket.io, and phaser.io
 
Avoid loss of hair while coding Unity3D plugin for mobile
Avoid loss of hair while coding Unity3D plugin for mobileAvoid loss of hair while coding Unity3D plugin for mobile
Avoid loss of hair while coding Unity3D plugin for mobile
 
Html5 game, websocket e arduino
Html5 game, websocket e arduino Html5 game, websocket e arduino
Html5 game, websocket e arduino
 
Realtime html5 multiplayer_games_with_node_js
Realtime html5 multiplayer_games_with_node_jsRealtime html5 multiplayer_games_with_node_js
Realtime html5 multiplayer_games_with_node_js
 
Updates of socket.io@1.0
Updates of socket.io@1.0Updates of socket.io@1.0
Updates of socket.io@1.0
 
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
 
Real Time Communication using Node.js and Socket.io
Real Time Communication using Node.js and Socket.ioReal Time Communication using Node.js and Socket.io
Real Time Communication using Node.js and Socket.io
 
Going realtime with Socket.IO
Going realtime with Socket.IOGoing realtime with Socket.IO
Going realtime with Socket.IO
 
Python, WebRTC and You
Python, WebRTC and YouPython, WebRTC and You
Python, WebRTC and You
 
Real-time Web Application with Socket.IO, Node.js, and Redis
Real-time Web Application with Socket.IO, Node.js, and RedisReal-time Web Application with Socket.IO, Node.js, and Redis
Real-time Web Application with Socket.IO, Node.js, and Redis
 
From Push Technology to Real-Time Messaging and WebSockets
From Push Technology to Real-Time Messaging and WebSocketsFrom Push Technology to Real-Time Messaging and WebSockets
From Push Technology to Real-Time Messaging and WebSockets
 
Nodejs Explained with Examples
Nodejs Explained with ExamplesNodejs Explained with Examples
Nodejs Explained with Examples
 
Lazer Angels
Lazer AngelsLazer Angels
Lazer Angels
 
Water Governance
Water GovernanceWater Governance
Water Governance
 
Small business
Small businessSmall business
Small business
 
competitionnnnn
competitionnnnncompetitionnnnn
competitionnnnn
 
Workshops, workflows & wooden trains
Workshops, workflows & wooden trainsWorkshops, workflows & wooden trains
Workshops, workflows & wooden trains
 
Flourish Marketing Video Mailer
Flourish Marketing Video MailerFlourish Marketing Video Mailer
Flourish Marketing Video Mailer
 
HT5_1-21
HT5_1-21HT5_1-21
HT5_1-21
 
Estado de resultados
Estado de resultadosEstado de resultados
Estado de resultados
 

Similar to Introduction to development of multiplayer HTML5 games (with Socket.io)

WebSockets wiith Scala and Play! Framework
WebSockets wiith Scala and Play! FrameworkWebSockets wiith Scala and Play! Framework
WebSockets wiith Scala and Play! FrameworkFabio Tiriticco
 
Nodejs and WebSockets
Nodejs and WebSocketsNodejs and WebSockets
Nodejs and WebSocketsGonzalo Ayuso
 
end-to-end-encryption-enroute-linkerd (1).pdf
end-to-end-encryption-enroute-linkerd (1).pdfend-to-end-encryption-enroute-linkerd (1).pdf
end-to-end-encryption-enroute-linkerd (1).pdfLibbySchulze
 
Clocker, the Docker Cloud Maker - Andrea Turli - Codemotion Rome 2015
Clocker, the Docker Cloud Maker - Andrea Turli - Codemotion Rome 2015Clocker, the Docker Cloud Maker - Andrea Turli - Codemotion Rome 2015
Clocker, the Docker Cloud Maker - Andrea Turli - Codemotion Rome 2015Codemotion
 
WebRTC 101 - How to get started building your first WebRTC application
WebRTC 101 - How to get started building your first WebRTC applicationWebRTC 101 - How to get started building your first WebRTC application
WebRTC 101 - How to get started building your first WebRTC applicationDan Jenkins
 
15年前に作ったアプリを現在に蘇らせてみた話
15年前に作ったアプリを現在に蘇らせてみた話15年前に作ったアプリを現在に蘇らせてみた話
15年前に作ったアプリを現在に蘇らせてみた話Naoki Nagazumi
 
Pushing the Boundaries of Sencha and HTML5′s WebRTC
Pushing the Boundaries of Sencha and HTML5′s WebRTCPushing the Boundaries of Sencha and HTML5′s WebRTC
Pushing the Boundaries of Sencha and HTML5′s WebRTCRich Waters
 
Matrix.org decentralised communication, Matthew Hodgson, TADSummit
Matrix.org decentralised communication, Matthew Hodgson, TADSummitMatrix.org decentralised communication, Matthew Hodgson, TADSummit
Matrix.org decentralised communication, Matthew Hodgson, TADSummitAlan Quayle
 
Websockets: Pushing the web forward
Websockets: Pushing the web forwardWebsockets: Pushing the web forward
Websockets: Pushing the web forwardMark Roden
 
Apidaze WebRTC Workshop barcelona 21st april 2013
Apidaze WebRTC Workshop barcelona 21st april 2013Apidaze WebRTC Workshop barcelona 21st april 2013
Apidaze WebRTC Workshop barcelona 21st april 2013Alan Quayle
 
[workshop] The Revolutionary WebRTC
[workshop] The Revolutionary WebRTC[workshop] The Revolutionary WebRTC
[workshop] The Revolutionary WebRTCGiacomo Vacca
 
Adding Realtime to your Projects
Adding Realtime to your ProjectsAdding Realtime to your Projects
Adding Realtime to your ProjectsIgnacio Martín
 
Blockchain Autopsies - Analyzing Ethereum Smart Contract Deaths
Blockchain Autopsies - Analyzing Ethereum Smart Contract DeathsBlockchain Autopsies - Analyzing Ethereum Smart Contract Deaths
Blockchain Autopsies - Analyzing Ethereum Smart Contract DeathsPriyanka Aash
 
Deep Dive into the Microsoft OpenStack CI Infrastructure (Alessandro Pilotti)
Deep Dive into the Microsoft OpenStack CI Infrastructure (Alessandro Pilotti)Deep Dive into the Microsoft OpenStack CI Infrastructure (Alessandro Pilotti)
Deep Dive into the Microsoft OpenStack CI Infrastructure (Alessandro Pilotti)ITCamp
 
A Polyglot Developer Experience on Kubernetes - KubeCon EU Valencia
A Polyglot Developer Experience on Kubernetes - KubeCon EU ValenciaA Polyglot Developer Experience on Kubernetes - KubeCon EU Valencia
A Polyglot Developer Experience on Kubernetes - KubeCon EU ValenciaMauricio (Salaboy) Salatino
 
AngularJS 2.0: A natural evolvement or a new beginning - Boyan Mihaylov - Cod...
AngularJS 2.0: A natural evolvement or a new beginning - Boyan Mihaylov - Cod...AngularJS 2.0: A natural evolvement or a new beginning - Boyan Mihaylov - Cod...
AngularJS 2.0: A natural evolvement or a new beginning - Boyan Mihaylov - Cod...Codemotion
 
Fully Reactive - from Data to UI with OrientDB + Node.js + Socket.io - Luigi ...
Fully Reactive - from Data to UI with OrientDB + Node.js + Socket.io - Luigi ...Fully Reactive - from Data to UI with OrientDB + Node.js + Socket.io - Luigi ...
Fully Reactive - from Data to UI with OrientDB + Node.js + Socket.io - Luigi ...Codemotion
 
Securing your apps with OAuth2 and OpenID Connect - Roland Guijt - Codemotion...
Securing your apps with OAuth2 and OpenID Connect - Roland Guijt - Codemotion...Securing your apps with OAuth2 and OpenID Connect - Roland Guijt - Codemotion...
Securing your apps with OAuth2 and OpenID Connect - Roland Guijt - Codemotion...Codemotion
 

Similar to Introduction to development of multiplayer HTML5 games (with Socket.io) (20)

WebSockets wiith Scala and Play! Framework
WebSockets wiith Scala and Play! FrameworkWebSockets wiith Scala and Play! Framework
WebSockets wiith Scala and Play! Framework
 
Nodejs and WebSockets
Nodejs and WebSocketsNodejs and WebSockets
Nodejs and WebSockets
 
end-to-end-encryption-enroute-linkerd (1).pdf
end-to-end-encryption-enroute-linkerd (1).pdfend-to-end-encryption-enroute-linkerd (1).pdf
end-to-end-encryption-enroute-linkerd (1).pdf
 
Swagger code motion talk
Swagger code motion talkSwagger code motion talk
Swagger code motion talk
 
Clocker, the Docker Cloud Maker - Andrea Turli - Codemotion Rome 2015
Clocker, the Docker Cloud Maker - Andrea Turli - Codemotion Rome 2015Clocker, the Docker Cloud Maker - Andrea Turli - Codemotion Rome 2015
Clocker, the Docker Cloud Maker - Andrea Turli - Codemotion Rome 2015
 
WebRTC 101 - How to get started building your first WebRTC application
WebRTC 101 - How to get started building your first WebRTC applicationWebRTC 101 - How to get started building your first WebRTC application
WebRTC 101 - How to get started building your first WebRTC application
 
15年前に作ったアプリを現在に蘇らせてみた話
15年前に作ったアプリを現在に蘇らせてみた話15年前に作ったアプリを現在に蘇らせてみた話
15年前に作ったアプリを現在に蘇らせてみた話
 
Pushing the Boundaries of Sencha and HTML5′s WebRTC
Pushing the Boundaries of Sencha and HTML5′s WebRTCPushing the Boundaries of Sencha and HTML5′s WebRTC
Pushing the Boundaries of Sencha and HTML5′s WebRTC
 
Rest, sockets em golang
Rest, sockets em golangRest, sockets em golang
Rest, sockets em golang
 
Matrix.org decentralised communication, Matthew Hodgson, TADSummit
Matrix.org decentralised communication, Matthew Hodgson, TADSummitMatrix.org decentralised communication, Matthew Hodgson, TADSummit
Matrix.org decentralised communication, Matthew Hodgson, TADSummit
 
Websockets: Pushing the web forward
Websockets: Pushing the web forwardWebsockets: Pushing the web forward
Websockets: Pushing the web forward
 
Apidaze WebRTC Workshop barcelona 21st april 2013
Apidaze WebRTC Workshop barcelona 21st april 2013Apidaze WebRTC Workshop barcelona 21st april 2013
Apidaze WebRTC Workshop barcelona 21st april 2013
 
[workshop] The Revolutionary WebRTC
[workshop] The Revolutionary WebRTC[workshop] The Revolutionary WebRTC
[workshop] The Revolutionary WebRTC
 
Adding Realtime to your Projects
Adding Realtime to your ProjectsAdding Realtime to your Projects
Adding Realtime to your Projects
 
Blockchain Autopsies - Analyzing Ethereum Smart Contract Deaths
Blockchain Autopsies - Analyzing Ethereum Smart Contract DeathsBlockchain Autopsies - Analyzing Ethereum Smart Contract Deaths
Blockchain Autopsies - Analyzing Ethereum Smart Contract Deaths
 
Deep Dive into the Microsoft OpenStack CI Infrastructure (Alessandro Pilotti)
Deep Dive into the Microsoft OpenStack CI Infrastructure (Alessandro Pilotti)Deep Dive into the Microsoft OpenStack CI Infrastructure (Alessandro Pilotti)
Deep Dive into the Microsoft OpenStack CI Infrastructure (Alessandro Pilotti)
 
A Polyglot Developer Experience on Kubernetes - KubeCon EU Valencia
A Polyglot Developer Experience on Kubernetes - KubeCon EU ValenciaA Polyglot Developer Experience on Kubernetes - KubeCon EU Valencia
A Polyglot Developer Experience on Kubernetes - KubeCon EU Valencia
 
AngularJS 2.0: A natural evolvement or a new beginning - Boyan Mihaylov - Cod...
AngularJS 2.0: A natural evolvement or a new beginning - Boyan Mihaylov - Cod...AngularJS 2.0: A natural evolvement or a new beginning - Boyan Mihaylov - Cod...
AngularJS 2.0: A natural evolvement or a new beginning - Boyan Mihaylov - Cod...
 
Fully Reactive - from Data to UI with OrientDB + Node.js + Socket.io - Luigi ...
Fully Reactive - from Data to UI with OrientDB + Node.js + Socket.io - Luigi ...Fully Reactive - from Data to UI with OrientDB + Node.js + Socket.io - Luigi ...
Fully Reactive - from Data to UI with OrientDB + Node.js + Socket.io - Luigi ...
 
Securing your apps with OAuth2 and OpenID Connect - Roland Guijt - Codemotion...
Securing your apps with OAuth2 and OpenID Connect - Roland Guijt - Codemotion...Securing your apps with OAuth2 and OpenID Connect - Roland Guijt - Codemotion...
Securing your apps with OAuth2 and OpenID Connect - Roland Guijt - Codemotion...
 

Recently uploaded

Data governance with Unity Catalog Presentation
Data governance with Unity Catalog PresentationData governance with Unity Catalog Presentation
Data governance with Unity Catalog PresentationKnoldus Inc.
 
Top 10 Hubspot Development Companies in 2024
Top 10 Hubspot Development Companies in 2024Top 10 Hubspot Development Companies in 2024
Top 10 Hubspot Development Companies in 2024TopCSSGallery
 
Passkey Providers and Enabling Portability: FIDO Paris Seminar.pptx
Passkey Providers and Enabling Portability: FIDO Paris Seminar.pptxPasskey Providers and Enabling Portability: FIDO Paris Seminar.pptx
Passkey Providers and Enabling Portability: FIDO Paris Seminar.pptxLoriGlavin3
 
Digital Identity is Under Attack: FIDO Paris Seminar.pptx
Digital Identity is Under Attack: FIDO Paris Seminar.pptxDigital Identity is Under Attack: FIDO Paris Seminar.pptx
Digital Identity is Under Attack: FIDO Paris Seminar.pptxLoriGlavin3
 
Transcript: New from BookNet Canada for 2024: BNC SalesData and LibraryData -...
Transcript: New from BookNet Canada for 2024: BNC SalesData and LibraryData -...Transcript: New from BookNet Canada for 2024: BNC SalesData and LibraryData -...
Transcript: New from BookNet Canada for 2024: BNC SalesData and LibraryData -...BookNet Canada
 
Generative AI - Gitex v1Generative AI - Gitex v1.pptx
Generative AI - Gitex v1Generative AI - Gitex v1.pptxGenerative AI - Gitex v1Generative AI - Gitex v1.pptx
Generative AI - Gitex v1Generative AI - Gitex v1.pptxfnnc6jmgwh
 
MuleSoft Online Meetup Group - B2B Crash Course: Release SparkNotes
MuleSoft Online Meetup Group - B2B Crash Course: Release SparkNotesMuleSoft Online Meetup Group - B2B Crash Course: Release SparkNotes
MuleSoft Online Meetup Group - B2B Crash Course: Release SparkNotesManik S Magar
 
The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptx
The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptxThe Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptx
The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptxLoriGlavin3
 
Modern Roaming for Notes and Nomad – Cheaper Faster Better Stronger
Modern Roaming for Notes and Nomad – Cheaper Faster Better StrongerModern Roaming for Notes and Nomad – Cheaper Faster Better Stronger
Modern Roaming for Notes and Nomad – Cheaper Faster Better Strongerpanagenda
 
Email Marketing Automation for Bonterra Impact Management (fka Social Solutio...
Email Marketing Automation for Bonterra Impact Management (fka Social Solutio...Email Marketing Automation for Bonterra Impact Management (fka Social Solutio...
Email Marketing Automation for Bonterra Impact Management (fka Social Solutio...Jeffrey Haguewood
 
Design pattern talk by Kaya Weers - 2024 (v2)
Design pattern talk by Kaya Weers - 2024 (v2)Design pattern talk by Kaya Weers - 2024 (v2)
Design pattern talk by Kaya Weers - 2024 (v2)Kaya Weers
 
A Deep Dive on Passkeys: FIDO Paris Seminar.pptx
A Deep Dive on Passkeys: FIDO Paris Seminar.pptxA Deep Dive on Passkeys: FIDO Paris Seminar.pptx
A Deep Dive on Passkeys: FIDO Paris Seminar.pptxLoriGlavin3
 
Varsha Sewlal- Cyber Attacks on Critical Critical Infrastructure
Varsha Sewlal- Cyber Attacks on Critical Critical InfrastructureVarsha Sewlal- Cyber Attacks on Critical Critical Infrastructure
Varsha Sewlal- Cyber Attacks on Critical Critical Infrastructureitnewsafrica
 
UiPath Community: Communication Mining from Zero to Hero
UiPath Community: Communication Mining from Zero to HeroUiPath Community: Communication Mining from Zero to Hero
UiPath Community: Communication Mining from Zero to HeroUiPathCommunity
 
Landscape Catalogue 2024 Australia-1.pdf
Landscape Catalogue 2024 Australia-1.pdfLandscape Catalogue 2024 Australia-1.pdf
Landscape Catalogue 2024 Australia-1.pdfAarwolf Industries LLC
 
Tampa BSides - The No BS SOC (slides from April 6, 2024 talk)
Tampa BSides - The No BS SOC (slides from April 6, 2024 talk)Tampa BSides - The No BS SOC (slides from April 6, 2024 talk)
Tampa BSides - The No BS SOC (slides from April 6, 2024 talk)Mark Simos
 
React Native vs Ionic - The Best Mobile App Framework
React Native vs Ionic - The Best Mobile App FrameworkReact Native vs Ionic - The Best Mobile App Framework
React Native vs Ionic - The Best Mobile App FrameworkPixlogix Infotech
 
So einfach geht modernes Roaming fuer Notes und Nomad.pdf
So einfach geht modernes Roaming fuer Notes und Nomad.pdfSo einfach geht modernes Roaming fuer Notes und Nomad.pdf
So einfach geht modernes Roaming fuer Notes und Nomad.pdfpanagenda
 
Abdul Kader Baba- Managing Cybersecurity Risks and Compliance Requirements i...
Abdul Kader Baba- Managing Cybersecurity Risks  and Compliance Requirements i...Abdul Kader Baba- Managing Cybersecurity Risks  and Compliance Requirements i...
Abdul Kader Baba- Managing Cybersecurity Risks and Compliance Requirements i...itnewsafrica
 
A Framework for Development in the AI Age
A Framework for Development in the AI AgeA Framework for Development in the AI Age
A Framework for Development in the AI AgeCprime
 

Recently uploaded (20)

Data governance with Unity Catalog Presentation
Data governance with Unity Catalog PresentationData governance with Unity Catalog Presentation
Data governance with Unity Catalog Presentation
 
Top 10 Hubspot Development Companies in 2024
Top 10 Hubspot Development Companies in 2024Top 10 Hubspot Development Companies in 2024
Top 10 Hubspot Development Companies in 2024
 
Passkey Providers and Enabling Portability: FIDO Paris Seminar.pptx
Passkey Providers and Enabling Portability: FIDO Paris Seminar.pptxPasskey Providers and Enabling Portability: FIDO Paris Seminar.pptx
Passkey Providers and Enabling Portability: FIDO Paris Seminar.pptx
 
Digital Identity is Under Attack: FIDO Paris Seminar.pptx
Digital Identity is Under Attack: FIDO Paris Seminar.pptxDigital Identity is Under Attack: FIDO Paris Seminar.pptx
Digital Identity is Under Attack: FIDO Paris Seminar.pptx
 
Transcript: New from BookNet Canada for 2024: BNC SalesData and LibraryData -...
Transcript: New from BookNet Canada for 2024: BNC SalesData and LibraryData -...Transcript: New from BookNet Canada for 2024: BNC SalesData and LibraryData -...
Transcript: New from BookNet Canada for 2024: BNC SalesData and LibraryData -...
 
Generative AI - Gitex v1Generative AI - Gitex v1.pptx
Generative AI - Gitex v1Generative AI - Gitex v1.pptxGenerative AI - Gitex v1Generative AI - Gitex v1.pptx
Generative AI - Gitex v1Generative AI - Gitex v1.pptx
 
MuleSoft Online Meetup Group - B2B Crash Course: Release SparkNotes
MuleSoft Online Meetup Group - B2B Crash Course: Release SparkNotesMuleSoft Online Meetup Group - B2B Crash Course: Release SparkNotes
MuleSoft Online Meetup Group - B2B Crash Course: Release SparkNotes
 
The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptx
The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptxThe Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptx
The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptx
 
Modern Roaming for Notes and Nomad – Cheaper Faster Better Stronger
Modern Roaming for Notes and Nomad – Cheaper Faster Better StrongerModern Roaming for Notes and Nomad – Cheaper Faster Better Stronger
Modern Roaming for Notes and Nomad – Cheaper Faster Better Stronger
 
Email Marketing Automation for Bonterra Impact Management (fka Social Solutio...
Email Marketing Automation for Bonterra Impact Management (fka Social Solutio...Email Marketing Automation for Bonterra Impact Management (fka Social Solutio...
Email Marketing Automation for Bonterra Impact Management (fka Social Solutio...
 
Design pattern talk by Kaya Weers - 2024 (v2)
Design pattern talk by Kaya Weers - 2024 (v2)Design pattern talk by Kaya Weers - 2024 (v2)
Design pattern talk by Kaya Weers - 2024 (v2)
 
A Deep Dive on Passkeys: FIDO Paris Seminar.pptx
A Deep Dive on Passkeys: FIDO Paris Seminar.pptxA Deep Dive on Passkeys: FIDO Paris Seminar.pptx
A Deep Dive on Passkeys: FIDO Paris Seminar.pptx
 
Varsha Sewlal- Cyber Attacks on Critical Critical Infrastructure
Varsha Sewlal- Cyber Attacks on Critical Critical InfrastructureVarsha Sewlal- Cyber Attacks on Critical Critical Infrastructure
Varsha Sewlal- Cyber Attacks on Critical Critical Infrastructure
 
UiPath Community: Communication Mining from Zero to Hero
UiPath Community: Communication Mining from Zero to HeroUiPath Community: Communication Mining from Zero to Hero
UiPath Community: Communication Mining from Zero to Hero
 
Landscape Catalogue 2024 Australia-1.pdf
Landscape Catalogue 2024 Australia-1.pdfLandscape Catalogue 2024 Australia-1.pdf
Landscape Catalogue 2024 Australia-1.pdf
 
Tampa BSides - The No BS SOC (slides from April 6, 2024 talk)
Tampa BSides - The No BS SOC (slides from April 6, 2024 talk)Tampa BSides - The No BS SOC (slides from April 6, 2024 talk)
Tampa BSides - The No BS SOC (slides from April 6, 2024 talk)
 
React Native vs Ionic - The Best Mobile App Framework
React Native vs Ionic - The Best Mobile App FrameworkReact Native vs Ionic - The Best Mobile App Framework
React Native vs Ionic - The Best Mobile App Framework
 
So einfach geht modernes Roaming fuer Notes und Nomad.pdf
So einfach geht modernes Roaming fuer Notes und Nomad.pdfSo einfach geht modernes Roaming fuer Notes und Nomad.pdf
So einfach geht modernes Roaming fuer Notes und Nomad.pdf
 
Abdul Kader Baba- Managing Cybersecurity Risks and Compliance Requirements i...
Abdul Kader Baba- Managing Cybersecurity Risks  and Compliance Requirements i...Abdul Kader Baba- Managing Cybersecurity Risks  and Compliance Requirements i...
Abdul Kader Baba- Managing Cybersecurity Risks and Compliance Requirements i...
 
A Framework for Development in the AI Age
A Framework for Development in the AI AgeA Framework for Development in the AI Age
A Framework for Development in the AI Age
 

Introduction to development of multiplayer HTML5 games (with Socket.io)

  • 1. ROME 27-28 march 2015 Introduction to development of multiplayer HTML5 games (with Socket.io) Valerio «Lotti» Riva valerio.riva@gmail.com @ValerioRiva http://it.linkedin.com/in/valerioriva/
  • 2. ROME 27-28 march 2015 - Valerio Riva Who am I? • Web developer • Game developer @Interactive Project  MyGPTeam, MyGPTeam Turbo, OverVolt: crazy slot cars  http://interactiveproject.com/ • Game Jammer  https://www.facebook.com/RomeGameJams • Mentor @CoderDojo Roma  https://coderdojoroma.wordpress.com/
  • 3. ROME 27-28 march 2015 - Valerio Riva Intro • Multiplayer architectures & technologies • Multiplayer services • Implementation of a simple multiplayer game
  • 4. ROME 27-28 march 2015 - Valerio Riva Multiplayer Architectures • Client - Server • Peer 2 Peer • Hybrid (a mix of both)
  • 5. ROME 27-28 march 2015 - Valerio Riva Client - Server Paradigm • Suitable for games that evolve over time • Hard to maintain, high costs • Lineage 2, World of Warcraft
  • 6. ROME 27-28 march 2015 - Valerio Riva Peer 2 Peer Paradigm • Suitable for games that don’t evolve over time • Easy to maintain, low costs • Is it really used?  Cheating, Modding, Pirates, Business
  • 7. ROME 27-28 march 2015 - Valerio Riva Hybrid Paradigm • Most used! • Client-Server duties: matchmaking, world data, … • P2P duties: assets sharing, voip, …
  • 8. ROME 27-28 march 2015 - Valerio Riva «Multiplayer as a Service» • Provides you infrastructure and algorithms • Provides SDK for various game engines • Reliability and auto-scaling • Real-time / turn-based multiplayer • Match-making, leaderboards, achievements • Cloud storage (saved games) • Free or paid services
  • 9. ROME 27-28 march 2015 - Valerio Riva Networking technologies • Web API  Request-Response system  Identified by a url  Permanent connection not required  Suitable on asynchronous games • Socket  Bidirectional communication between softwares  Identified by a protocol, an address and a port  Permanet connection required  Suitable on synchronous games
  • 10. ROME 27-28 march 2015 - Valerio Riva Networking technologies (2) • Web API • Socket
  • 11. ROME 27-28 march 2015 - Valerio Riva Socket instead of WebAPI PRO Full-duplex communication Real time! Can use UDP protocol CON A stream of byte Permanent connection required Firewall : NAT :
  • 12. ROME 27-28 march 2015 - Valerio Riva WebSocket • Works as an upgrade of standard HTTP connection • Full-duplex channel over a single TCP connection • WebSocket instead of Socket PRO Full-duplex communication Real time! Firewall :) CON A stream of byte Permanent connection required Can’t use UDP protocol
  • 13. ROME 27-28 march 2015 - Valerio Riva Socket.io • A Javascript library that enhances WebSocket • Easy to use • Event-driven • Falls back to other technologies if WebSocket is not available • Adds broadcasting • Adds support to multiplexing with «namespaces» • Adds support to rooms
  • 14. ROME 27-28 march 2015 - Valerio Riva Socket.io: Client example <script src="/socket.io/socket.io.js"></script> <script> var socket = io(); socket.on('pong', function(data) { //do something with received data console.log(data); }); socket.emit('ping', { user: "Lotti" }); </script>
  • 15. ROME 27-28 march 2015 - Valerio Riva Socket.io: Server example var app = require('express')(); var http = require('http').Server(app); var io = require('socket.io')(http); io.on('connection', function(socket) { //a socket just connected! socket.on('ping', function(data) { //do something with received data console.log(data.user); socket.emit('pong', 'hello!'); }); });
  • 16. ROME 27-28 march 2015 - Valerio Riva Socket.io instead of WebSocket Full-duplex communication Real time! Firewall :) Event-driven Rooms! Permanent connection required Can’t use UDP protocol
  • 17. ROME 27-28 march 2015 - Valerio Riva Pong4
  • 18. ROME 27-28 march 2015 - Valerio Riva Pong4 (2) • A simple real-time multiplayer "Pong" game • Built with  phaser.io (game)  socket.io (networking)  express.io (content delivery) • Runs on node.js • http://pong4.eu-gb.mybluemix.net • https://github.com/Lotti/codemotion2015
  • 19. ROME 27-28 march 2015 - Valerio Riva Pong4 (3) • Hybrid paradigm  Server Forwards events and data between clients  Fat client (host): Game manager Player movements Checks collisions Keeps scores Starts and ends a game  Thin client Player movements Can be promoted to host
  • 20. ROME 27-28 march 2015 - Valerio Riva Pong4 Server: host join event socket.on('host', function(data, ack) { var room = makeGameId(); socket.join(room, function (err) { if (!err) { clientPlayers[socket.id] = 0; clients[socket.id] = room; hosts[socket.id] = true; ack(room); log('host '+socket.id+' connected'); } else { log(err,'e'); sendError(1, "host: can't join room", socket); } }); }); 1 2
  • 21. ROME 27-28 march 2015 - Valerio Riva Pong4 Server: client join event socket.on('join', function(data, ack) { var room = data; if (roomExists(room)) { socket.join(room, function (err) { if (!err) { clients[socket.id] = room; var players = socketsInRoom(room); clientPlayers[socket.id] = players.length - 1; ack({ playersCount: players.length }); io.to(room).emit('joined', { playersCount: players.length }); } else { log(err, 'e'); sendError(3, "client: can't join room", socket); } }); } else { sendError(2, "that room doesn't exists", socket); } }); 1 2
  • 22. ROME 27-28 march 2015 - Valerio Riva Pong4 Client: sending data updateServer: function () { //... var data = { socketId: socket.id }; if (master) { data['ball'] = true; data['ballX'] = ball.position.x; data['ballY'] = ball.position.y; } else data['ball'] = false; data['player'] = parseInt(currentPlayer); switch(data['player']) { case 0: case 2: data['paddle'] = paddles[currentPlayer].position.x; break; case 1: case 3: data['paddle'] = paddles[currentPlayer].position.y; break; } socket.emit('gameUpdate', data); },
  • 23. ROME 27-28 march 2015 - Valerio Riva Pong4 Server: broadcasting data socket.on('gameUpdate', function(data) { var room = clients[data.socketId]; delete data.socketId; io.to(room).emit('clientUpdate', data); });
  • 24. ROME 27-28 march 2015 - Valerio Riva Pong4 Client: receiving data updateClient: function (data) { if (!master && data.ball == true) { ball.position.x = data.ballX; ball.position.y = data.ballY; } if (currentPlayer != data.player) { switch(parseInt(data.player)) { case 0: case 2: paddles[data.player].position.x = data.paddle; break; case 1: case 3: paddles[data.player].position.y = data.paddle; break; } } },
  • 25. ROME 27-28 march 2015 - Valerio Riva References • http://socket.io/ • http://phaser.io/ • http://pong4.eu-gb.mybluemix.net/ • https://github.com/Lotti/codemotion2015/ • https://console.ng.bluemix.net/ • https://developers.google.com/games/services/ • https://www.exitgames.com/en/Realtime • http://www.smartfoxserver.com/ • https://developer.apple.com/game-center/ • http://appwarp.shephertz.com/
  • 26. ROME 27-28 march 2015 - Valerio Riva Thank you! Any Questions? Leave your feedback on Joind.in! https://joind.in/event/view/3347 valerio.riva@gmail.com @ValerioRiva http://it.linkedin.com/in/valerioriva/