WebSockets or how to develop game in 4 hours - Tech Hangout #39 - 2014.05.30
description
Transcript of WebSockets or how to develop game in 4 hours - Tech Hangout #39 - 2014.05.30
![Page 1: WebSockets or how to develop game in 4 hours - Tech Hangout #39 - 2014.05.30](https://reader035.fdocuments.us/reader035/viewer/2022062513/554f707ab4c9058a148b526f/html5/thumbnails/1.jpg)
WebSockets or how to develop
game in 4 hours
Sorokin I. I.
![Page 2: WebSockets or how to develop game in 4 hours - Tech Hangout #39 - 2014.05.30](https://reader035.fdocuments.us/reader035/viewer/2022062513/554f707ab4c9058a148b526f/html5/thumbnails/2.jpg)
WebSockets or how to develop
game in 4 hours
Sorokin I. I.
![Page 3: WebSockets or how to develop game in 4 hours - Tech Hangout #39 - 2014.05.30](https://reader035.fdocuments.us/reader035/viewer/2022062513/554f707ab4c9058a148b526f/html5/thumbnails/3.jpg)
Tags cloud
#WebSockets
#Socket.IO
#2048
#multiplayer
#HTML5
#javascript
#nodeJS
![Page 4: WebSockets or how to develop game in 4 hours - Tech Hangout #39 - 2014.05.30](https://reader035.fdocuments.us/reader035/viewer/2022062513/554f707ab4c9058a148b526f/html5/thumbnails/4.jpg)
WebSockets…defines a full-duplex single socket connection over which messages can be sent between client and server
![Page 5: WebSockets or how to develop game in 4 hours - Tech Hangout #39 - 2014.05.30](https://reader035.fdocuments.us/reader035/viewer/2022062513/554f707ab4c9058a148b526f/html5/thumbnails/5.jpg)
Socket.IO
Even better than clean WebSockets
Event oriented model
Cross Platform clients
http://socket.io/
![Page 6: WebSockets or how to develop game in 4 hours - Tech Hangout #39 - 2014.05.30](https://reader035.fdocuments.us/reader035/viewer/2022062513/554f707ab4c9058a148b526f/html5/thumbnails/6.jpg)
«Hello world» on Socket.IO
![Page 7: WebSockets or how to develop game in 4 hours - Tech Hangout #39 - 2014.05.30](https://reader035.fdocuments.us/reader035/viewer/2022062513/554f707ab4c9058a148b526f/html5/thumbnails/7.jpg)
-Do u like play in 2048?-Sure!
-Sorry that we can not play with each other…:(
-Wait 4 hours-WHAT???
4 hours ago…
![Page 8: WebSockets or how to develop game in 4 hours - Tech Hangout #39 - 2014.05.30](https://reader035.fdocuments.us/reader035/viewer/2022062513/554f707ab4c9058a148b526f/html5/thumbnails/8.jpg)
2048 multiplayer
I call it Binary Battle
It’s not 4 hours (near 12 really). 4 - used for PR:)
U can fork it and make your own game with no big changes in 4 hours really!
Now u know who is the best in 2048!!!
![Page 9: WebSockets or how to develop game in 4 hours - Tech Hangout #39 - 2014.05.30](https://reader035.fdocuments.us/reader035/viewer/2022062513/554f707ab4c9058a148b526f/html5/thumbnails/9.jpg)
How it works
Little bit home made:)
![Page 10: WebSockets or how to develop game in 4 hours - Tech Hangout #39 - 2014.05.30](https://reader035.fdocuments.us/reader035/viewer/2022062513/554f707ab4c9058a148b526f/html5/thumbnails/10.jpg)
More words
Game manager - core of applications, it store all the games data, it’s just an infinity loop
Players manager - store players data (socket id, name, etc…)
2048 core was taken from origin game (just cut some useless things) and u can replace it easy for your own game engine
![Page 11: WebSockets or how to develop game in 4 hours - Tech Hangout #39 - 2014.05.30](https://reader035.fdocuments.us/reader035/viewer/2022062513/554f707ab4c9058a148b526f/html5/thumbnails/11.jpg)
Picture is good, but where is the code???
Front-end
Back-end
![Page 12: WebSockets or how to develop game in 4 hours - Tech Hangout #39 - 2014.05.30](https://reader035.fdocuments.us/reader035/viewer/2022062513/554f707ab4c9058a148b526f/html5/thumbnails/12.jpg)
Features, limitations…
Using RAM as a storage, server down - game over :(
Auto-remove games data when game is over
Refresh page - your status will reset, enemy - not :)
2048 using as a module and u can replace it to any other game engine
![Page 13: WebSockets or how to develop game in 4 hours - Tech Hangout #39 - 2014.05.30](https://reader035.fdocuments.us/reader035/viewer/2022062513/554f707ab4c9058a148b526f/html5/thumbnails/13.jpg)
BinBattle
https://github.com/asynxis/binbattle
FORKSWANTED