SlideShare a Scribd company logo
1 of 19
Game Networking
MMO Games
Massive multiplayer online games - a genre of game
played over internet with a large number of players.
Limitations
◇ Network bandwidth limitations
◇ Networks packet take time to travel (ping time)
◇ Hard to synchronize client & server states
Client-Server
Client-Server:
◇ Expensive to maintain
◇ Server acts as a host
◇ Prevent hacking
◇ Heavy testing needed
Peers to peers:
◇ No maintenance costs
◇ Playable through LAN
◇ Easy to setup
◇ Hard to prevent hacks
Server simulates the game in time steps called ticks.
Default, the timestep is 15ms, so 66.666 per second.
Each tick, the server processes incoming user
commands, runs a physical simulation, checks game
rules, and updates all object states.
Counter-Strike, Left 4 Dead and Team Fortress.
Dedicated Server
Client is used as a host and acts as a server.
This client will receives messages from other clients.
Proceed them as a normal client would, executes
physics, checks for logics, and then send back new
states to other clients.
UNet uses this model.
Client as Server
Because the game has to keep going.
Latency Compensation
Design & Optimize
To solve network issues, techniques such as data compression and lag compensation are implemented.
Client then performs prediction and interpolation to further improve the experience.
In games such as Half Life, Quake and Unreal, there is a single server which is responsible for
running game logic. To it are connected one or more "dumb" clients. These clients were nothing
more than a way for user input to be sampled and forwarded to the server for execution.
Using the above data structures, first, the client creates and sends a command to server. The
server then executes user command and sends updated positions of everything back to client.
Which, the client renders the scene with all of these objects.
The main problem is that the client truly is "dumb",all it does is sampling movement inputs and
wait. If the client has 500 milliseconds of latency, then it will take 500 milliseconds for any
client actions to be acknowledged by the server and for the results to be perceptible on the
client.
Because internet connection is not to be trusted.
Client Side Prediction
Each user command (and time it was generated) is stored on the client. The prediction
algorithm uses these stored commands. In Half-Life, minimizing discrepancies between
client and server is accomplished by sharing identical movement code for players in both
the server code and the client-side code
The firing logic can be layered on top of the movement logic because the state of firing
buttons is included in the command data structure that is shared between the client and
the server.
typedef struct usercmd_s
{
// Interpolation time on client
short lerp_msec;
// Duration in ms of command
byte msec;
// Command view angles.
vec3_t viewangles;
// Forward velocity.
float forwardmove;
// Sideways velocity.
float sidemove;
// Upward velocity.
float upmove;
// Attack buttons
unsigned short buttons;
} usercmd_t;
Because every player is a big fat cheater.
Shooting prediction.
Although you hear weapon fire immediately, the results the shot is subject to latency. If you
aim at a player and you have 100 milliseconds latency and the player is running at 500
units per second, then you'll need to aim 50 units in front of the target to hit the target.
The greater the latency, the greater the lead targeting needed. Getting a "feel" for your
latency is difficult.
- When you shoot, client sends event to server with timestamp and exact aim of shot.
- Server gets input with timestamps, it reconstruct the world at any instant in the past.
- The server can know exactly what was on weapon’s sights instant you shot.
- It was the past position of your enemy’s head, but the server knows it was the position of
his head in your present.
- The server processes the shot at that point in time, and updates the clients.
Because everything has to be sum up.
Summary
- Server gets inputs from all the clients, with timestamps
- Server processes inputs and updates world status
- Server sends regular world snapshots to all clients
- Client sends input and simulates their effects locally
Client get world updates and
- Syncs predicted state to authoritative state
- Interpolates known past states for other entities
From a player’s POV, this has two important consequences:
- Player sees himself in the present
- Player sees other entities in the past
Summary

More Related Content

What's hot

Frame rate powerpoint
Frame rate  powerpointFrame rate  powerpoint
Frame rate powerpoint
mapuk7
 
Game Architecture and Programming
Game Architecture and ProgrammingGame Architecture and Programming
Game Architecture and Programming
Sumit Jain
 
Space Ape's Live Ops Stack: Engineering Mobile Games for Live Ops from Day 1
Space Ape's Live Ops Stack: Engineering Mobile Games for Live Ops from Day 1Space Ape's Live Ops Stack: Engineering Mobile Games for Live Ops from Day 1
Space Ape's Live Ops Stack: Engineering Mobile Games for Live Ops from Day 1
Simon Hade
 
Clash Royale Mobile Game Teardown or Deconstruction by Adrian Crook & Associa...
Clash Royale Mobile Game Teardown or Deconstruction by Adrian Crook & Associa...Clash Royale Mobile Game Teardown or Deconstruction by Adrian Crook & Associa...
Clash Royale Mobile Game Teardown or Deconstruction by Adrian Crook & Associa...
Adrian Crook and Associates
 

What's hot (20)

Frame rate powerpoint
Frame rate  powerpointFrame rate  powerpoint
Frame rate powerpoint
 
Building Non-Linear Narratives in Horizon Zero Dawn
Building Non-Linear Narratives in Horizon Zero DawnBuilding Non-Linear Narratives in Horizon Zero Dawn
Building Non-Linear Narratives in Horizon Zero Dawn
 
Final Year Game Project Presentation
Final Year Game Project Presentation Final Year Game Project Presentation
Final Year Game Project Presentation
 
Game Architecture and Programming
Game Architecture and ProgrammingGame Architecture and Programming
Game Architecture and Programming
 
[IGC 2017] 블루홀 최준혁 - '플레이어언노운스 배틀그라운드' DEV 스토리
[IGC 2017] 블루홀 최준혁 - '플레이어언노운스 배틀그라운드' DEV 스토리[IGC 2017] 블루홀 최준혁 - '플레이어언노운스 배틀그라운드' DEV 스토리
[IGC 2017] 블루홀 최준혁 - '플레이어언노운스 배틀그라운드' DEV 스토리
 
NDC 2018 레벨 디자인 튜토리얼 Level Design Tutorial
NDC 2018 레벨 디자인 튜토리얼 Level Design TutorialNDC 2018 레벨 디자인 튜토리얼 Level Design Tutorial
NDC 2018 레벨 디자인 튜토리얼 Level Design Tutorial
 
게임제작개론 : #0 과목소개
게임제작개론 : #0 과목소개게임제작개론 : #0 과목소개
게임제작개론 : #0 과목소개
 
Team Members Introduction Names With Job Titles
Team Members Introduction Names With Job TitlesTeam Members Introduction Names With Job Titles
Team Members Introduction Names With Job Titles
 
Streamlined landscape creation with new Terrain Tools- Unite Copenhagen 2019
Streamlined landscape creation with new Terrain Tools- Unite Copenhagen 2019Streamlined landscape creation with new Terrain Tools- Unite Copenhagen 2019
Streamlined landscape creation with new Terrain Tools- Unite Copenhagen 2019
 
Intro to liveops
Intro to liveopsIntro to liveops
Intro to liveops
 
Next generation graphics programming on xbox 360
Next generation graphics programming on xbox 360Next generation graphics programming on xbox 360
Next generation graphics programming on xbox 360
 
Player Traversal Mechanics in the Vast World of Horizon Zero Dawn
Player Traversal Mechanics in the Vast World of Horizon Zero DawnPlayer Traversal Mechanics in the Vast World of Horizon Zero Dawn
Player Traversal Mechanics in the Vast World of Horizon Zero Dawn
 
기획자의 포트폴리오는 어떻게 써야 할까
기획자의 포트폴리오는 어떻게 써야 할까기획자의 포트폴리오는 어떻게 써야 할까
기획자의 포트폴리오는 어떻게 써야 할까
 
Personalisation as the key to optimising your game's revenue & LTV.
Personalisation as the key to optimising your game's revenue & LTV.Personalisation as the key to optimising your game's revenue & LTV.
Personalisation as the key to optimising your game's revenue & LTV.
 
Space Ape's Live Ops Stack: Engineering Mobile Games for Live Ops from Day 1
Space Ape's Live Ops Stack: Engineering Mobile Games for Live Ops from Day 1Space Ape's Live Ops Stack: Engineering Mobile Games for Live Ops from Day 1
Space Ape's Live Ops Stack: Engineering Mobile Games for Live Ops from Day 1
 
Game Design Portfolio: 3 Case Studies
Game Design Portfolio: 3 Case StudiesGame Design Portfolio: 3 Case Studies
Game Design Portfolio: 3 Case Studies
 
C# Security Testing and Debugging
C# Security Testing and DebuggingC# Security Testing and Debugging
C# Security Testing and Debugging
 
Adobe Photoshop history -Image Editing Software
Adobe Photoshop history -Image Editing SoftwareAdobe Photoshop history -Image Editing Software
Adobe Photoshop history -Image Editing Software
 
Optimizing the Graphics Pipeline with Compute, GDC 2016
Optimizing the Graphics Pipeline with Compute, GDC 2016Optimizing the Graphics Pipeline with Compute, GDC 2016
Optimizing the Graphics Pipeline with Compute, GDC 2016
 
Clash Royale Mobile Game Teardown or Deconstruction by Adrian Crook & Associa...
Clash Royale Mobile Game Teardown or Deconstruction by Adrian Crook & Associa...Clash Royale Mobile Game Teardown or Deconstruction by Adrian Crook & Associa...
Clash Royale Mobile Game Teardown or Deconstruction by Adrian Crook & Associa...
 

Similar to Game Networking for Online games

Remote Network Monitoring System
Remote Network Monitoring SystemRemote Network Monitoring System
Remote Network Monitoring System
Sidharth Goel
 
ZNet Framework
ZNet FrameworkZNet Framework
ZNet Framework
Ray Yun
 
EE4214+Real+Time+Embedded+System
EE4214+Real+Time+Embedded+SystemEE4214+Real+Time+Embedded+System
EE4214+Real+Time+Embedded+System
webuiltit
 
Please help with the below 3 questions, the python script is at the.pdf
Please help with the below 3  questions, the python script is at the.pdfPlease help with the below 3  questions, the python script is at the.pdf
Please help with the below 3 questions, the python script is at the.pdf
support58
 

Similar to Game Networking for Online games (20)

Akka for realtime multiplayer mobile games
Akka for realtime multiplayer mobile gamesAkka for realtime multiplayer mobile games
Akka for realtime multiplayer mobile games
 
Akka for realtime multiplayer mobile games
Akka for realtime multiplayer mobile gamesAkka for realtime multiplayer mobile games
Akka for realtime multiplayer mobile games
 
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
 
Scalability & Big Data challenges in real time multiplayer games
Scalability & Big Data challenges in real time multiplayer gamesScalability & Big Data challenges in real time multiplayer games
Scalability & Big Data challenges in real time multiplayer games
 
Real-Time Stats for Candy Box
Real-Time Stats for Candy Box  Real-Time Stats for Candy Box
Real-Time Stats for Candy Box
 
Remote Network Monitoring System
Remote Network Monitoring SystemRemote Network Monitoring System
Remote Network Monitoring System
 
Game server development in node.js in jsconf eu
Game server development in node.js in jsconf euGame server development in node.js in jsconf eu
Game server development in node.js in jsconf eu
 
Kinh nghiệm phát triển Captain Strike
Kinh nghiệm phát triển Captain StrikeKinh nghiệm phát triển Captain Strike
Kinh nghiệm phát triển Captain Strike
 
Captain strike backend post-mortem
Captain strike backend post-mortemCaptain strike backend post-mortem
Captain strike backend post-mortem
 
Rpc
RpcRpc
Rpc
 
ZNet Framework
ZNet FrameworkZNet Framework
ZNet Framework
 
Proving correctness of a multiplayer game server
Proving correctness of a multiplayer game serverProving correctness of a multiplayer game server
Proving correctness of a multiplayer game server
 
CLUSTERED PEER-TO-PEER COMMUNICATION SYSTEM FOR MULTIPLAYER ONLINE GAMES
CLUSTERED PEER-TO-PEER COMMUNICATION SYSTEM FOR MULTIPLAYER ONLINE GAMES CLUSTERED PEER-TO-PEER COMMUNICATION SYSTEM FOR MULTIPLAYER ONLINE GAMES
CLUSTERED PEER-TO-PEER COMMUNICATION SYSTEM FOR MULTIPLAYER ONLINE GAMES
 
EE4214+Real+Time+Embedded+System
EE4214+Real+Time+Embedded+SystemEE4214+Real+Time+Embedded+System
EE4214+Real+Time+Embedded+System
 
Lecture9
Lecture9Lecture9
Lecture9
 
Shameful secrets of proprietary network protocols
Shameful secrets of proprietary network protocolsShameful secrets of proprietary network protocols
Shameful secrets of proprietary network protocols
 
Rpc
RpcRpc
Rpc
 
R bernardino hand_in_assignment_week_1
R bernardino hand_in_assignment_week_1R bernardino hand_in_assignment_week_1
R bernardino hand_in_assignment_week_1
 
Please help with the below 3 questions, the python script is at the.pdf
Please help with the below 3  questions, the python script is at the.pdfPlease help with the below 3  questions, the python script is at the.pdf
Please help with the below 3 questions, the python script is at the.pdf
 
Introduction to Marionette Collective
Introduction to Marionette CollectiveIntroduction to Marionette Collective
Introduction to Marionette Collective
 

Recently uploaded

Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slideHistor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slide
vu2urc
 
CNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of ServiceCNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of Service
giselly40
 

Recently uploaded (20)

Real Time Object Detection Using Open CV
Real Time Object Detection Using Open CVReal Time Object Detection Using Open CV
Real Time Object Detection Using Open CV
 
Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slideHistor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slide
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...
 
What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
 
Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organization
 
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
 
[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf
 
Slack Application Development 101 Slides
Slack Application Development 101 SlidesSlack Application Development 101 Slides
Slack Application Development 101 Slides
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024
 
Factors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptxFactors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptx
 
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
 
Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024
 
Boost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityBoost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivity
 
CNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of ServiceCNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of Service
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdf
 
Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024
 
Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...
 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024
 

Game Networking for Online games

  • 2. MMO Games Massive multiplayer online games - a genre of game played over internet with a large number of players.
  • 3. Limitations ◇ Network bandwidth limitations ◇ Networks packet take time to travel (ping time) ◇ Hard to synchronize client & server states
  • 4. Client-Server Client-Server: ◇ Expensive to maintain ◇ Server acts as a host ◇ Prevent hacking ◇ Heavy testing needed Peers to peers: ◇ No maintenance costs ◇ Playable through LAN ◇ Easy to setup ◇ Hard to prevent hacks
  • 5. Server simulates the game in time steps called ticks. Default, the timestep is 15ms, so 66.666 per second. Each tick, the server processes incoming user commands, runs a physical simulation, checks game rules, and updates all object states. Counter-Strike, Left 4 Dead and Team Fortress. Dedicated Server
  • 6. Client is used as a host and acts as a server. This client will receives messages from other clients. Proceed them as a normal client would, executes physics, checks for logics, and then send back new states to other clients. UNet uses this model. Client as Server
  • 7. Because the game has to keep going. Latency Compensation
  • 8. Design & Optimize To solve network issues, techniques such as data compression and lag compensation are implemented. Client then performs prediction and interpolation to further improve the experience.
  • 9. In games such as Half Life, Quake and Unreal, there is a single server which is responsible for running game logic. To it are connected one or more "dumb" clients. These clients were nothing more than a way for user input to be sampled and forwarded to the server for execution.
  • 10. Using the above data structures, first, the client creates and sends a command to server. The server then executes user command and sends updated positions of everything back to client. Which, the client renders the scene with all of these objects.
  • 11. The main problem is that the client truly is "dumb",all it does is sampling movement inputs and wait. If the client has 500 milliseconds of latency, then it will take 500 milliseconds for any client actions to be acknowledged by the server and for the results to be perceptible on the client.
  • 12. Because internet connection is not to be trusted. Client Side Prediction
  • 13. Each user command (and time it was generated) is stored on the client. The prediction algorithm uses these stored commands. In Half-Life, minimizing discrepancies between client and server is accomplished by sharing identical movement code for players in both the server code and the client-side code
  • 14. The firing logic can be layered on top of the movement logic because the state of firing buttons is included in the command data structure that is shared between the client and the server. typedef struct usercmd_s { // Interpolation time on client short lerp_msec; // Duration in ms of command byte msec; // Command view angles. vec3_t viewangles; // Forward velocity. float forwardmove; // Sideways velocity. float sidemove; // Upward velocity. float upmove; // Attack buttons unsigned short buttons; } usercmd_t;
  • 15. Because every player is a big fat cheater. Shooting prediction.
  • 16. Although you hear weapon fire immediately, the results the shot is subject to latency. If you aim at a player and you have 100 milliseconds latency and the player is running at 500 units per second, then you'll need to aim 50 units in front of the target to hit the target. The greater the latency, the greater the lead targeting needed. Getting a "feel" for your latency is difficult.
  • 17. - When you shoot, client sends event to server with timestamp and exact aim of shot. - Server gets input with timestamps, it reconstruct the world at any instant in the past. - The server can know exactly what was on weapon’s sights instant you shot. - It was the past position of your enemy’s head, but the server knows it was the position of his head in your present. - The server processes the shot at that point in time, and updates the clients.
  • 18. Because everything has to be sum up. Summary
  • 19. - Server gets inputs from all the clients, with timestamps - Server processes inputs and updates world status - Server sends regular world snapshots to all clients - Client sends input and simulates their effects locally Client get world updates and - Syncs predicted state to authoritative state - Interpolates known past states for other entities From a player’s POV, this has two important consequences: - Player sees himself in the present - Player sees other entities in the past Summary