FSCKING LAG

6ed02dec32058508c6feb43b2fbc94f7?s=47 Secret Lab
September 01, 2015

FSCKING LAG

A lightning talk on multiplayer networking that we gave at /dev/world/2015.

6ed02dec32058508c6feb43b2fbc94f7?s=128

Secret Lab

September 01, 2015
Tweet

Transcript

  1. None
  2. FSCKING LAG

  3. Video Games!

  4. Multi-player video games!

  5. Server

  6. Server Client Client Client

  7. Server Client Client Client

  8. Server Client

  9. Server Client “I just killed player 1”

  10. Server Client “I just killed player 1” “ok”

  11. Server Client “I just killed player 1” “ok” BAD

  12. Server Client “I pressed these buttons” “This is where things

    are”
  13. Server Client “I pressed these buttons” “This is where things

    are” BETTER
  14. PROBLEM

  15. 1 2 Lag = 1 second Lag = 0.1 seconds

  16. 1 2 Shoots! Runs! FROM PLAYER 1’S PERSPECTIVE:

  17. Server Player 1 Player 2

  18. Server Player 1 Player 2 “I’m shooting!” (1 second ago)

  19. Server Player 1 Player 2 “I’m shooting!” (1 second ago)

    “I’m running around the corner!” (0.1 second ago)
  20. Server Player 1 has shot, and Player 2 is around

    the corner. Player 1’s shot missed.
  21. Server Player 1 Player 2 “Player 2 is now around

    the corner. Player 1 shot, but missed.”
  22. Counter-Strike

  23. Server Player 1 shot, and at the time, they were

    aiming at Player 2. Their should would have hit.
  24. Server Player 1 Player 2 “Player 1 shot Player 2.”

  25. Server Player 1 Player 2 “Player 1 shot Player 2.”

    “Oh, and Player 2 still ran around the corner. lol.”
  26. Server Player 1 Player 2 “Player 1 shot Player 2.”

    “Oh, and Player 2 still ran around the corner. lol.” wtf
  27. Age of Empires

  28. 1500 Archers on a 28.8: Network Programming in Age of

    Empires and Beyond Mark Terrano, Paul Bettner
  29. PROBLEM: 1500 archers Each one has a position Each one

    is moving
  30. Each position is about 4 bytes each

  31. 4 bytes ✕ 1500 = 6000 bytes

  32. 6000 bytes ✕ 30 frames/sec = 175 kB/s

  33. SOLUTION:

  34. DON’T SYNC STATE

  35. SYNC PLAYER INTENT

  36. Client Client Client

  37. Client Client Client “I told my archers to move.”

  38. Client Client Client “I told my archers to move.” “I

    told a villager to gather wood.”
  39. Client Client Client Wait for everyone to finish this frame….

  40. Client Client Client Archers are moving, and the villager is

    gathering wood.
  41. NOT PERFECT

  42. RUNS AT THE SLOWEST PLAYER

  43. DESYNCS

  44. @thesecretlab rocketboxgame.tumblr.com