Networking for physics programmers (final)

542 views

Published on

  • Be the first to comment

  • Be the first to like this

Networking for physics programmers (final)

  1. 1. Networking
  2. 2. Networking for
  3. 3. Networking for Physics Programmers
  4. 4. Networking for Physics Programmers Glenn Fiedler
  5. 5. Networking for Physics Programmers Glenn Fiedler Sony Santa Monica
  6. 6. Networking for Physics Programmers Glenn Fiedler Sony Santa Monica www.gafferongames.com
  7. 7. DEMO
  8. 8. The Internet Sucks
  9. 9. Sony Bandwidth Probe 30th Jan - 18th Feb 2010
  10. 10. Sony Bandwidth Probe 30th Jan - 18th Feb 2010
  11. 11. Sony Bandwidth Probe 30th Jan - 18th Feb 2010
  12. 12. Sony Bandwidth Probe 30th Jan - 18th Feb 2010
  13. 13. Sony Bandwidth Probe 30th Jan - 18th Feb 2010 2.7 Million Samples
  14. 14. Download Bandwidth by Territory 100 75 50 25 0 SCEA SCEE SCEJ SCEK 0 - 1 mbps 1 - 2 mbps 2 - 8 mbps 8 - 50 mbps 50mbps+
  15. 15. Download Bandwidth by Territory 100 75 50 8% 25 0 SCEA SCEE SCEJ SCEK 0 - 1 mbps 1 - 2 mbps 2 - 8 mbps 8 - 50 mbps 50mbps+
  16. 16. Download Bandwidth by Territory 100 75 50 11% 25 0 SCEA SCEE SCEJ SCEK 0 - 1 mbps 1 - 2 mbps 2 - 8 mbps 8 - 50 mbps 50mbps+
  17. 17. Download Bandwidth by Territory 100 75 81% 50 25 0 SCEA SCEE SCEJ SCEK 0 - 1 mbps 1 - 2 mbps 2 - 8 mbps 8 - 50 mbps 50mbps+
  18. 18. Download Bandwidth by Territory 100 75 50 25 0 SCEA SCEE SCEJ SCEK 0 - 1 mbps 1 - 2 mbps 2 - 8 mbps 8 - 50 mbps 50mbps+
  19. 19. Download Bandwidth by Territory 100 75 50 7% 25 0 SCEA SCEE SCEJ SCEK 0 - 1 mbps 1 - 2 mbps 2 - 8 mbps 8 - 50 mbps 50mbps+
  20. 20. Download Bandwidth by Territory 100 75 9.5% 50 25 0 SCEA SCEE SCEJ SCEK 0 - 1 mbps 1 - 2 mbps 2 - 8 mbps 8 - 50 mbps 50mbps+
  21. 21. Download Bandwidth by Territory 100 75 83.5% 50 25 0 SCEA SCEE SCEJ SCEK 0 - 1 mbps 1 - 2 mbps 2 - 8 mbps 8 - 50 mbps 50mbps+
  22. 22. Download Bandwidth by Territory 100 75 50 25 0 SCEA SCEE SCEJ SCEK 0 - 1 mbps 1 - 2 mbps 2 - 8 mbps 8 - 50 mbps 50mbps+
  23. 23. Download Bandwidth by Territory 100 97% 75 50 25 0 SCEA SCEE SCEJ SCEK 0 - 1 mbps 1 - 2 mbps 2 - 8 mbps 8 - 50 mbps 50mbps+
  24. 24. Download Bandwidth by Territory 100 75 50 25 0 SCEA SCEE SCEJ SCEK 0 - 1 mbps 1 - 2 mbps 2 - 8 mbps 8 - 50 mbps 50mbps+
  25. 25. Download Bandwidth by Territory 100 85% 75 50 25 0 SCEA SCEE SCEJ SCEK 0 - 1 mbps 1 - 2 mbps 2 - 8 mbps 8 - 50 mbps 50mbps+
  26. 26. Download Bandwidth by Territory 100 75 50 25 0 SCEA SCEE SCEJ SCEK 0 - 1 mbps 1 - 2 mbps 2 - 8 mbps 8 - 50 mbps 50mbps+
  27. 27. Upload Bandwidth by Territory 100 75 50 25 0 SCEA SCEE SCEJ SCEK 0 - 256 kbps 256 - 512 kbps 512 - 2048 kbps 2048kpbs - 50mbps 50mbps+
  28. 28. Upload Bandwidth by Territory 100 75 50 6% 25 0 SCEA SCEE SCEJ SCEK 0 - 256 kbps 256 - 512 kbps 512 - 2048 kbps 2048kpbs - 50mbps 50mbps+
  29. 29. Upload Bandwidth by Territory 100 75 50 20% 25 0 SCEA SCEE SCEJ SCEK 0 - 256 kbps 256 - 512 kbps 512 - 2048 kbps 2048kpbs - 50mbps 50mbps+
  30. 30. Upload Bandwidth by Territory 100 75 74% 50 25 0 SCEA SCEE SCEJ SCEK 0 - 256 kbps 256 - 512 kbps 512 - 2048 kbps 2048kpbs - 50mbps 50mbps+
  31. 31. Upload Bandwidth by Territory 100 75 50 25 0 SCEA SCEE SCEJ SCEK 0 - 256 kbps 256 - 512 kbps 512 - 2048 kbps 2048kpbs - 50mbps 50mbps+
  32. 32. Upload Bandwidth by Territory 100 75 10% 50 25 0 SCEA SCEE SCEJ SCEK 0 - 256 kbps 256 - 512 kbps 512 - 2048 kbps 2048kpbs - 50mbps 50mbps+
  33. 33. Upload Bandwidth by Territory 100 75 28% 50 25 0 SCEA SCEE SCEJ SCEK 0 - 256 kbps 256 - 512 kbps 512 - 2048 kbps 2048kpbs - 50mbps 50mbps+
  34. 34. Upload Bandwidth by Territory 100 75 62% 50 25 0 SCEA SCEE SCEJ SCEK 0 - 256 kbps 256 - 512 kbps 512 - 2048 kbps 2048kpbs - 50mbps 50mbps+
  35. 35. Upload Bandwidth by Territory 100 75 50 25 0 SCEA SCEE SCEJ SCEK 0 - 256 kbps 256 - 512 kbps 512 - 2048 kbps 2048kpbs - 50mbps 50mbps+
  36. 36. Upload Bandwidth by Territory 100 98% 75 50 25 0 SCEA SCEE SCEJ SCEK 0 - 256 kbps 256 - 512 kbps 512 - 2048 kbps 2048kpbs - 50mbps 50mbps+
  37. 37. Upload Bandwidth by Territory 100 75 50 25 0 SCEA SCEE SCEJ SCEK 0 - 256 kbps 256 - 512 kbps 512 - 2048 kbps 2048kpbs - 50mbps 50mbps+
  38. 38. Upload Bandwidth by Territory 100 90% 75 50 25 0 SCEA SCEE SCEJ SCEK 0 - 256 kbps 256 - 512 kbps 512 - 2048 kbps 2048kpbs - 50mbps 50mbps+
  39. 39. Upload Bandwidth by Territory 100 75 50 25 0 SCEA SCEE SCEJ SCEK 0 - 256 kbps 256 - 512 kbps 512 - 2048 kbps 2048kpbs - 50mbps 50mbps+
  40. 40. Upload Bandwidth by Territory 100 75 KOREA WINS!!! 50 25 0 SCEA SCEE SCEJ SCEK 0 - 256 kbps 256 - 512 kbps 512 - 2048 kbps 2048kpbs - 50mbps 50mbps+
  41. 41. Minimum Spec Up/Down (%) 99.1% 97.8% % 96.0% 93.9% 90.0 92.5 95.0 97.5 100.0 64kbps+ 128kbps+ 192kbps+ 256kbps+
  42. 42. Minimum Spec Up/Down (%) 99.1% 64kbps 97.8% % 96.0% 93.9% 90.0 92.5 95.0 97.5 100.0 64kbps+ 128kbps+ 192kbps+ 256kbps+
  43. 43. Minimum Spec Up/Down (%) 99.1% 64kbps 97.8% % 96.0% 93.9% 90.0 92.5 95.0 97.5 100.0 64kbps+ 128kbps+ 192kbps+ 256kbps+
  44. 44. UDP Reflector Experiment Coded a simple UDP Reflector VPS in Seattle, Atlanta and Sydney Sent 256 byte packets @ 30pps from LA and recorded when they bounced back... (This is roughly 64kbps)
  45. 45. The Internet Sucks
  46. 46. Round Trip Time - WiFi (ms) 400 300 200 100 0 5 minutes Seattle Atlanta Sydney
  47. 47. Round Trip Time - WiFi (ms) 400 300 200 100 0 5 minutes Seattle Atlanta Sydney
  48. 48. Round Trip Time - WiFi (ms) 400 300 200 100 0 5 minutes Seattle Atlanta Sydney
  49. 49. Round Trip Time - WiFi (ms) 400 300 200 100 0 5 minutes Seattle Atlanta Sydney
  50. 50. Round Trip Time - Wired (ms) 400 300 200 100 0 5 minutes Seattle Atlanta Sydney
  51. 51. Round Trip Time - Wired (ms) 400 300 200 100 0 5 minutes Seattle Atlanta Sydney
  52. 52. Round Trip Time - Wired (ms) 400 300 200 100 0 5 minutes Seattle Atlanta Sydney
  53. 53. Virgin America In-Flight WiFi 1100 825 550 275 0 5 minutes Seattle Atlanta Sydney
  54. 54. Virgin America In-Flight WiFi 1100 825 550 275 0 5 minutes Seattle Atlanta Sydney
  55. 55. Virgin America In-Flight WiFi 1100 825 550 275 0 5 minutes Seattle Atlanta Sydney
  56. 56. Virgin America In-Flight WiFi 1100 825 550 275 0 5 minutes Seattle Atlanta Sydney
  57. 57. Virgin America In-Flight WiFi 1100 825 550 275 0 5 minutes Seattle Atlanta Sydney
  58. 58. Intercontinental Hotel - Sunday Night 400 300 200 100 0 5 minutes Seattle Atlanta Sydney
  59. 59. Intercontinental Hotel - Sunday Night 400 300 200 100 0 5 minutes Seattle Atlanta Sydney
  60. 60. Intercontinental Hotel - Sunday Night 400 300 200 100 0 5 minutes Seattle Atlanta Sydney
  61. 61. Intercontinental Hotel - Sunday Night 400 300 200 100 0 5 minutes Seattle Atlanta Sydney
  62. 62. Intercontinental Hotel - Monday Night 400 300 200 100 0 5 minutes Seattle Atlanta Sydney
  63. 63. Intercontinental Hotel - Monday Night 400 300 200 100 ?! 0 5 minutes Seattle Atlanta Sydney
  64. 64. Typical RTT Spikes 600 540 480 420 360 300 240 180 120 60 0 10 seconds
  65. 65. Typical RTT Spikes 600 540 480 A 420 360 300 240 180 120 60 0 10 seconds
  66. 66. Typical RTT Spikes 600 540 480 A 420 360 300 240 B 180 120 60 0 10 seconds
  67. 67. Typical RTT Spikes 600 540 480 A 420 360 300 240 C B 180 120 60 0 10 seconds
  68. 68. Typical RTT Spikes 600 540 480 A 420 360 300 240 C B 180 D 120 60 0 10 seconds
  69. 69. The Internet Sucks
  70. 70. The Internet Sucks*
  71. 71. The Internet Sucks* * Best effort packet delivery only
  72. 72. ?
  73. 73. TCP UDP IP
  74. 74. TCP UDP IP
  75. 75. Lost Packet
  76. 76. TCP UDP IP
  77. 77. TCP UDP IP
  78. 78. TCP UDP IP
  79. 79. “The Internet is not something you just dump things on. It’s not a big truck. It’s a series of tubes.” Sen. Ted Stevens
  80. 80. The Internet
  81. 81. The Internet Data goes in here...
  82. 82. Data leaves your house...
  83. 83. Tube gets bigger...
  84. 84. Data arrives at your ISP...
  85. 85. Lots and lots of tubes...
  86. 86. Data flows across country in a big tube...
  87. 87. Tube gets smaller
  88. 88. Enters destination house...
  89. 89. Data arrives at destination!
  90. 90. TCP UDP IP
  91. 91. TCP UDP IP
  92. 92. TCP UDP IP
  93. 93. TCP UDP IP
  94. 94. TCP UDP IP
  95. 95. DEMO
  96. 96. Authority Remote View quantize physics state quantize physics state pull input and state receive packets serialize packet (write) serialize packets (read) send packet push most recent input+state update(dt) update(dt)
  97. 97. struct Input { UDP Packet bool left; bool right; bool up; uint16 sequence bool down; bool space; bool z; input }; struct State { state int count; RigidBody objects[count]; };
  98. 98. struct Input { UDP Packet bool left; bool right; bool up; uint16 sequence bool down; bool space; bool z; input }; struct State { state int count; RigidBody objects[count]; };
  99. 99. struct Input { UDP Packet bool left; bool right; bool up; uint16 sequence bool down; bool space; bool z; input }; struct State { state int count; RigidBody objects[count]; };
  100. 100. struct Input { UDP Packet bool left; bool right; bool up; uint16 sequence bool down; bool space; bool z; input }; struct State { state int count; RigidBody objects[count]; };
  101. 101. struct Input { UDP Packet bool left; bool right; bool up; uint16 sequence bool down; bool space; bool z; input }; struct State { state int count; RigidBody objects[count]; };
  102. 102. struct RigidBody { int id; vec3 position; quat orientation; vec3 linearVelocity; vec3 angularVelocity; bool active; };
  103. 103. priority accumulator
  104. 104. jitter buffer
  105. 105. DEMO
  106. 106. DEMO
  107. 107. Authority Like being the server for an object
  108. 108. Authority Rules 1. Player Authority 2. Tie-Break Authority 3. Interaction Authority
  109. 109. DEMO
  110. 110. How to resolve conflicts?
  111. 111. How to resolve conflicts? Lowest player id wins
  112. 112. Late Joins
  113. 113. Problem: Joining after world is changed
  114. 114. DEMO
  115. 115. ?
  116. 116. Corrections Fix incorrect state on late join
  117. 117. Three Cases
  118. 118. First Two...
  119. 119. Corrections
  120. 120. Three types of corrections: Agree, Disagree, Don’t Care
  121. 121. Confirmed bit Per-Object, Per-Player Avoids trashing state
  122. 122. DEMO
  123. 123. Three Cases
  124. 124. DEMO
  125. 125. Reverse Corrections
  126. 126. Summary
  127. 127. Summary Hide latency with authority scheme
  128. 128. Summary Hide latency with authority scheme Handle late join using corrections
  129. 129. Summary Hide latency with authority scheme Handle late join using corrections Suitable for cooperative games
  130. 130. Questions?
  131. 131. Thank you
  132. 132. Glenn Fiedler www.gafferongames.com @gafferongames

×