SlideShare une entreprise Scribd logo
1  sur  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

Contenu connexe

Tendances

Temporal difference learning
Temporal difference learningTemporal difference learning
Temporal difference learningJie-Han Chen
 
System models in distributed system
System models in distributed systemSystem models in distributed system
System models in distributed systemishapadhy
 
Software Project Management - Staffing
Software Project Management - StaffingSoftware Project Management - Staffing
Software Project Management - StaffingTanishqRongta1
 
Tutorial on convolutional neural networks
Tutorial on convolutional neural networksTutorial on convolutional neural networks
Tutorial on convolutional neural networksHojin Yang
 
Convolutional Neural Networks (CNN)
Convolutional Neural Networks (CNN)Convolutional Neural Networks (CNN)
Convolutional Neural Networks (CNN)Gaurav Mittal
 
Project management 02112009
Project management 02112009Project management 02112009
Project management 02112009Manish Chaurasia
 
Highly Available Kafka Consumers and Kafka Streams on Kubernetes with Adrian ...
Highly Available Kafka Consumers and Kafka Streams on Kubernetes with Adrian ...Highly Available Kafka Consumers and Kafka Streams on Kubernetes with Adrian ...
Highly Available Kafka Consumers and Kafka Streams on Kubernetes with Adrian ...HostedbyConfluent
 
A presentation on forward engineering
A presentation on forward engineeringA presentation on forward engineering
A presentation on forward engineeringGTU
 
An introduction to deep reinforcement learning
An introduction to deep reinforcement learningAn introduction to deep reinforcement learning
An introduction to deep reinforcement learningBig Data Colombia
 
Gof design pattern
Gof design patternGof design pattern
Gof design patternnaveen kumar
 
Non-functional requirements
Non-functional requirements Non-functional requirements
Non-functional requirements Rohela Raouf
 
Isolation of vm
Isolation of vmIsolation of vm
Isolation of vmHome
 
Deep deterministic policy gradient
Deep deterministic policy gradientDeep deterministic policy gradient
Deep deterministic policy gradientSlobodan Blazeski
 
Yoav Goldberg: Word Embeddings What, How and Whither
Yoav Goldberg: Word Embeddings What, How and WhitherYoav Goldberg: Word Embeddings What, How and Whither
Yoav Goldberg: Word Embeddings What, How and WhitherMLReview
 
Reinforcement learning slides
Reinforcement learning slidesReinforcement learning slides
Reinforcement learning slidesOmranHakami
 
Visualization of Deep Learning Models (D1L6 2017 UPC Deep Learning for Comput...
Visualization of Deep Learning Models (D1L6 2017 UPC Deep Learning for Comput...Visualization of Deep Learning Models (D1L6 2017 UPC Deep Learning for Comput...
Visualization of Deep Learning Models (D1L6 2017 UPC Deep Learning for Comput...Universitat Politècnica de Catalunya
 

Tendances (20)

Neural networks and deep learning
Neural networks and deep learningNeural networks and deep learning
Neural networks and deep learning
 
Temporal difference learning
Temporal difference learningTemporal difference learning
Temporal difference learning
 
System models in distributed system
System models in distributed systemSystem models in distributed system
System models in distributed system
 
Software Project Management - Staffing
Software Project Management - StaffingSoftware Project Management - Staffing
Software Project Management - Staffing
 
Tutorial on convolutional neural networks
Tutorial on convolutional neural networksTutorial on convolutional neural networks
Tutorial on convolutional neural networks
 
Convolutional Neural Networks (CNN)
Convolutional Neural Networks (CNN)Convolutional Neural Networks (CNN)
Convolutional Neural Networks (CNN)
 
Project management 02112009
Project management 02112009Project management 02112009
Project management 02112009
 
LSTM
LSTMLSTM
LSTM
 
Highly Available Kafka Consumers and Kafka Streams on Kubernetes with Adrian ...
Highly Available Kafka Consumers and Kafka Streams on Kubernetes with Adrian ...Highly Available Kafka Consumers and Kafka Streams on Kubernetes with Adrian ...
Highly Available Kafka Consumers and Kafka Streams on Kubernetes with Adrian ...
 
A presentation on forward engineering
A presentation on forward engineeringA presentation on forward engineering
A presentation on forward engineering
 
An introduction to deep reinforcement learning
An introduction to deep reinforcement learningAn introduction to deep reinforcement learning
An introduction to deep reinforcement learning
 
Gof design pattern
Gof design patternGof design pattern
Gof design pattern
 
Non-functional requirements
Non-functional requirements Non-functional requirements
Non-functional requirements
 
Isolation of vm
Isolation of vmIsolation of vm
Isolation of vm
 
AlexNet
AlexNetAlexNet
AlexNet
 
Deep deterministic policy gradient
Deep deterministic policy gradientDeep deterministic policy gradient
Deep deterministic policy gradient
 
Yoav Goldberg: Word Embeddings What, How and Whither
Yoav Goldberg: Word Embeddings What, How and WhitherYoav Goldberg: Word Embeddings What, How and Whither
Yoav Goldberg: Word Embeddings What, How and Whither
 
Reinforcement learning slides
Reinforcement learning slidesReinforcement learning slides
Reinforcement learning slides
 
Agile software development
Agile software developmentAgile software development
Agile software development
 
Visualization of Deep Learning Models (D1L6 2017 UPC Deep Learning for Comput...
Visualization of Deep Learning Models (D1L6 2017 UPC Deep Learning for Comput...Visualization of Deep Learning Models (D1L6 2017 UPC Deep Learning for Comput...
Visualization of Deep Learning Models (D1L6 2017 UPC Deep Learning for Comput...
 

Similaire à Game Networking for Online games

Akka for realtime multiplayer mobile games
Akka for realtime multiplayer mobile gamesAkka for realtime multiplayer mobile games
Akka for realtime multiplayer mobile gamesYan Cui
 
Akka for realtime multiplayer mobile games
Akka for realtime multiplayer mobile gamesAkka for realtime multiplayer mobile games
Akka for realtime multiplayer mobile gamesYan Cui
 
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_jsMario Gonzalez
 
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 gamesYan Cui
 
Real-Time Stats for Candy Box
Real-Time Stats for Candy Box  Real-Time Stats for Candy Box
Real-Time Stats for Candy Box PubNub
 
Remote Network Monitoring System
Remote Network Monitoring SystemRemote Network Monitoring System
Remote Network Monitoring SystemSidharth Goel
 
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 euXie ChengChao
 
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 StrikeGameLandVN
 
Captain strike backend post-mortem
Captain strike backend post-mortemCaptain strike backend post-mortem
Captain strike backend post-mortemJOY Entertainment
 
ZNet Framework
ZNet FrameworkZNet Framework
ZNet FrameworkRay Yun
 
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 serverIndicThreads
 
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 Yomna Mahmoud Ibrahim Hassan
 
EE4214+Real+Time+Embedded+System
EE4214+Real+Time+Embedded+SystemEE4214+Real+Time+Embedded+System
EE4214+Real+Time+Embedded+Systemwebuiltit
 
Shameful secrets of proprietary network protocols
Shameful secrets of proprietary network protocolsShameful secrets of proprietary network protocols
Shameful secrets of proprietary network protocolsSlawomir Jasek
 
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.pdfsupport58
 
Introduction to Marionette Collective
Introduction to Marionette CollectiveIntroduction to Marionette Collective
Introduction to Marionette CollectivePuppet
 

Similaire à 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
 

Dernier

GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationMichael W. Hawkins
 
Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsHandwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsMaria Levchenko
 
08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking MenDelhi Call girls
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Drew Madelung
 
Slack Application Development 101 Slides
Slack Application Development 101 SlidesSlack Application Development 101 Slides
Slack Application Development 101 Slidespraypatel2
 
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...Enterprise Knowledge
 
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc
 
[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.pdfhans926745
 
🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘RTylerCroy
 
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.pptxHampshireHUG
 
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.pptxKatpro Technologies
 
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure serviceWhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure servicePooja Nehwal
 
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 Servicegiselly40
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerThousandEyes
 
IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsEnterprise Knowledge
 
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking MenDelhi Call girls
 
How to convert PDF to text with Nanonets
How to convert PDF to text with NanonetsHow to convert PDF to text with Nanonets
How to convert PDF to text with Nanonetsnaman860154
 
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 slidevu2urc
 
Top 5 Benefits OF Using Muvi Live Paywall For Live Streams
Top 5 Benefits OF Using Muvi Live Paywall For Live StreamsTop 5 Benefits OF Using Muvi Live Paywall For Live Streams
Top 5 Benefits OF Using Muvi Live Paywall For Live StreamsRoshan Dwivedi
 
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 organizationRadu Cotescu
 

Dernier (20)

GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day Presentation
 
Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsHandwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed texts
 
08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
 
Slack Application Development 101 Slides
Slack Application Development 101 SlidesSlack Application Development 101 Slides
Slack Application Development 101 Slides
 
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...
 
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
 
[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
 
🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘
 
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
 
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
 
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure serviceWhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
 
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
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI Solutions
 
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
 
How to convert PDF to text with Nanonets
How to convert PDF to text with NanonetsHow to convert PDF to text with Nanonets
How to convert PDF to text with Nanonets
 
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
 
Top 5 Benefits OF Using Muvi Live Paywall For Live Streams
Top 5 Benefits OF Using Muvi Live Paywall For Live StreamsTop 5 Benefits OF Using Muvi Live Paywall For Live Streams
Top 5 Benefits OF Using Muvi Live Paywall For Live Streams
 
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
 

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