Gamooga - Intorduction: NGDC 2012

384 views
313 views

Published on

Gamooga - Intorduction: NGDC 2012

Published in: Technology
0 Comments
0 Likes
Statistics
Notes
  • Be the first to comment

  • Be the first to like this

No Downloads
Views
Total views
384
On SlideShare
0
From Embeds
0
Number of Embeds
1
Actions
Shares
0
Downloads
4
Comments
0
Likes
0
Embeds 0
No embeds

No notes for slide

Gamooga - Intorduction: NGDC 2012

  1. 1. G AMO OGA
  2. 2. What is it? A realtime b ackend (for multipl ayer games).
  3. 3. Realtime?!?1000s of messages per second happening at < 1ms
  4. 4. Singleplayer vs Multiplayer!  Design !  Design!  Development !  Development!  Testing !  Testing !  MP server !  Uptime & Scalability !  Server side logic !  Deployment !  Maintenance !  Expert eng. & IT !  More $$$
  5. 5. Singleplayer vs Multiplayer!  Design !  Design!  Development !  Development!  Testing !  Testing ! MP server !  Uptime & Scalability !  Server side logic !  Deployment !  Maintenance !  Expert eng. & IT !  More $$$
  6. 6. Singleplayer vs Multiplayer!  Design !  Design!  Development !  Development!  Testing !  Testing ! MP server ! Uptime & Scalability !  Server side logic !  Deployment !  Maintenance !  Expert eng. & IT !  More $$$
  7. 7. Singleplayer vs Multiplayer!  Design !  Design!  Development !  Development!  Testing !  Testing ! MP server ! Uptime & Scalability !  Server side logic ! Deployment !  Maintenance !  Expert eng. & IT !  More $$$
  8. 8. Singleplayer vs Multiplayer!  Design !  Design!  Development !  Development!  Testing !  Testing ! MP server ! Uptime & Scalability !  Server side logic ! Deployment ! Maintenance !  Expert eng. & IT !  More $$$
  9. 9. Singleplayer vs Multiplayer!  Design !  Design!  Development !  Development!  Testing !  Testing ! MP server ! Uptime & Scalability !  Server side logic ! Deployment ! Maintenance ! Expert eng. & IT !  More $$$
  10. 10. Singleplayer vs Multiplayer!  Design !  Design!  Development !  Development!  Testing !  Testing ! MP server ! Uptime & Scalability !  Server side logic ! Deployment ! Maintenance ! Expert eng. & IT ! More $$$
  11. 11. GAMOOGA Solution Enter Gamooga!
  12. 12. Architecture Database servers HTTP API ServersGamooga Cloud Auth servers Device abstraction layer
  13. 13. Features!  Highly realtime, very low latency transport (1ms latency)!  Fully hosted, no infrastructure required! Server side scriptability of backend!  No setup, tweaking, management, maintenance!  Instant deployment!  On-demand and auto scaling (~10000 CCU a room/session and unlimited sessions)
  14. 14. Features!  Multiple frontend APIs: ! Javascript, Actionscript, Android, iOS and Unity!  Built to cross communicate across platforms and devices by design!  Future proof ! Websocket support! KeyValue store (MongoDB in 2 weeks!)!  External service integration with HTTP
  15. 15. Cost!  No upfront costs, No license!  No infrastructure investment required!  Free to start with!  Pay as you grow!  Pricing fits the bell curve based demand of gamesFree Indie Basic Pro Enterprise 0$ 10$ 45$ 200$ 1900$
  16. 16. Basic flow on Gamooga!  ROOM acts as a lobby to interact with other players before starting the game in a game session.!  SESSION after interacting with other users in room, a user joins or creates a new game session for actual game play.
  17. 17. Basic flow on Gamooga CLIENT SIDE SERVER SIDEvar gc = new GamoogaClient(); gamooga.onconnectgc.connectToRoom/ gamooga.onmessagegc.createConnectToSession/gc.connectToSession gamooga.sendgc.onconnect gamooga.ondisconnectgc.onmessage gamooga.disconnectgc.sendgc.disconnectgc.ondisconnect
  18. 18. Basic flow on Gamooga CLIENT SIDE SERVER SIDE var gc = new GamoogaClient();gc.connectToRoom(123,”-uuid-”); gc.onconnect gamooga.onconnect gamooga.send gc.onmessage gc.send gamooga.onmessage gamooga.send gc.onmessage gc.send gc.disconnect gamooga.ondisconnect gamooga.send
  19. 19. Basic flow on Gamooga!   Download Gamooga SDK!   Develop your game and backend using dev server!   Publish your frontend!   Deploy the backend on Gamooga
  20. 20. Action time!Walk-throughs
  21. 21. Live DrawDEMO
  22. 22. Live Draw!   Client side:function onMouseMove(evt) {! if (!mousedown) return;! var x = evt.pageX - canvasMinX;! var y = evt.pageY - canvasMinY;! ctx.lineTo(x, y);! ctx.stroke();! coorData += x+","+y+";";!}
!function sendData() {! gc.send(“coordata”,coorData);! coorData = “”;!}!// ‘sendData’ is called every 250ms!
  23. 23. Live Draw!   Server side:gamooga.onmessage("coordata", function(conn_id, msg)! gamooga.broadcastexcept("coordata”,! {conn_id,msg}, conn_id)!end)
!   Client side:gc.onmessage("coordata", function(d) {! coors = d[1].split(";");! for (var i=0;i<coors.length-1;i++) {! var xy = coors[i].split(",");! var x = xy[0];! var y = xy[1];! ctx.lineTo(x, y);! }! ctx.stroke();!});
  24. 24. TanksDEMO
  25. 25. Tanks – player join!   Server side:Send to currently connected player his details and other players’data and his data to already connected players.gamooga.onconnect(function(conn_id)! uid = uid + 1! uid_map[conn_id] = uid! ! gamooga.send(conn_id, "me_spawn”,! {id=uid,c=assigned,op=player_data})! gamooga.broadcastexcept("other_spawn”,! {id=uid,c=assigned}, conn_id)! ! player_data[uid] = {}! player_data[uid]["c"] = assigned! player_data[uid]["p"] = {0,0,0}!end)!
  26. 26. Tanks – player join!   Client side:We now have our data and other player’s data, show it in gamegc.onmessage("me_spawn", function(me_data) {!! mytank = new BitmapAnimation(tankSheet);! mytank.healthbar = new Shape(…);! // set mytank properties! // add to stage! ! for (var t in me_data) {! var othertank = new BitmapAnimation(…);! othertank.healthbar = new Shape(…);! // set othertank properties! // add to stage! }! stage.update();!});!
  27. 27. Tanks – player join!   Client side:Other player’s get the data of currently joined playergc.onmessage(”other_spawn", function(me_data) {!! var othertank = new BitmapAnimation(…);! othertank.healthbar = new Shape(…);! // set othertank properties! // add to stage! ! stage.update();!});!
  28. 28. Tanks – player join New Player me_spawn Room other_spawn other_spawnConnected Connected player player
  29. 29. Tanks – player movement!   Client side:Player moving, send it to roomfunction tick() {! var nowTime = createjs.Ticker.getTime();! if (tankMove) {!! var ct = Math.cos(PI*mytank.rotation/180.0);! mytank.x += 4*ct;!
 var st = Math.cos(PI*mytank.rotation/180.0);
 mytank.y += 4*st;!! gc.send("pos”,! [mytank.x,mytank.y,mytank.rotation]);! }!}!
  30. 30. Tanks – player movement!   Server side:Player move data received, send it to all othersgamooga.onmessage("pos", function(conn_id, pos_data)! puid = uid_map[conn_id]! player_data[puid]["p"] = pos_data;! ! gamooga.broadcastexcept("pos”,! {d=pos_data,f=uid_map[conn_id]}, conn_id)!end)!!!Secure?!
  31. 31. Tanks – player movement!   Client side:Other player move data received, apply itgc.onmessage("pos", function(pos_data) {!! othertanks[pos_data[f]].x = pos_data[d][0];! othertanks[pos_data[f]].y = pos_data[d][1];! othertanks[pos_data[f]].rotation =! pos_data[d][2];!});!
  32. 32. Tanks – player movement Moving Player pos Room pos posOther player Other player
  33. 33. Tanks – player movement Moving Player pos Room (validates) pos posOther player Other player
  34. 34. Tanks – player shoot!   Client side:Player shooting, send bullet data to roomfunction tick() {! …! if (tankShoot) {! if (nowTime - lastShoot > 250) {! lastShoot = nowTime;! var newb = bullet.clone();! newb.x = mytank.x+8*ct;! newb.y = mytank.y+8*st;! ! !newb.vX = 10*ct;! newb.vY = 10*st;! newb.id = ++currBullId;! gc.send("nb”, [newb.x,newb.y,! newb.vX,newb.vY,newb.id]);! }!}!
  35. 35. Tanks – player shoot!   Server side:Player bullet data received, send it to all othersgamooga.onmessage("nb", function(conn_id, bull_data)! gamooga.broadcastexcept("nb”,! {b=bull_data,f=uid_map[conn_id]},conn_id)!end)!!!Secure?!
  36. 36. Tanks – player shoot!   Client side:Other player move data received, apply itgc.onmessage("nb", function(bdata){! var newb = bullet.clone();! newb.x = bdata[b][0];! newb.y = bdata[b][1];! newb.vX = bdata[b][2];! newb.vY = bdata[b][3];! newb.id = bdata[b][4];!});!
  37. 37. Tanks – player shoot Shooting Player nb Room (validates) nb nbOther player Other player
  38. 38. Tanks – player hit!   Client side:Check player hit, send hit data to roomfunction tick() {! …! for(each bullet I shot) {! for (each othertank) {! if (bullet hits othertank) {! othertank.health--;! othertank.healthbar = …;! if (othertank.health == 0) {! othertank.spriteSheet = …;! othertank.gotoAndPlay("blast");! }! gc.send("hit”,! [othertank.id,bull.tid,bull.id]);! }!}!
  39. 39. Tanks – player hit!   Server side:Player hit data received, send it to all othersgamooga.onmessage("hit", function(conn_id, hit_data)! gamooga.broadcastexcept("hit",hit_data, conn_id)!end)!!Most insecure!•  save bullets data (when we receive “nb” message)•  we already have position data•  client sends the bullet id•  retrieve bullet and its current position•  check hit as in the client side – O(1) operation
  40. 40. Tanks – player hit!   Client side:Other player hit data received, apply itgc.onmessage("hit", function(hdata){! var tank;! if (hdata[0] == mytank.id) {! tank = mytank;! } else {! tank = othertanks[hdata[0]];! }! tank.health--;! tank.healthbar = …;! if (tank.health == 0) {! tank.spriteSheet = …;! tank.gotoAndPlay("blast");! }!!!
  41. 41. Tanks – player shoot Player who hit hit Room (validates) hit hitOther player Other player
  42. 42. Tanks - improvements!   Current implementation is very basic!   Latency compensation – dead reckoning, prediction!   Interpolation!   Insensitive to FPS !   A player can check to run at faster FPS (preventable with timestamps) !   A player is at loss if he is running at lower FPS!   Lockstep protocols
  43. 43. Thank you!Questions?

×