How do online multiplayer games work so well despite so many differences in the systems behind each user (processing power, internet speed, display refresh rates)?

722 views

How do online multiplayer games work so well despite so many differences in the systems behind each user (processing power, internet speed, display refresh rates)?

In: Technology

7 Answers

Anonymous 0 Comments

[Not ELI5 but for aspiring game developers this article is long but fantastic on the topic of netcode and dealing with lag.](https://arstechnica.com/gaming/2019/10/explaining-how-fighting-games-use-delay-based-and-rollback-netcode/)

ELi5 for the article: There are 2* main ways to handle lag in online games. Delay or sometimes called Input Lag and Rollback.

Delay is exactly what it sounds like inputs will be delayed into a buffer for a tiny unnoticeable amount of time. If both players in the case of a two person game, or all players in case of more get their inputs in in time everything goes smoothly and it is rendered cleanly. The problem with Delay is you don’t render if you don’t get everyone ones input, which means if one person sees a delay longer than the buffer allows for the game will pause and wait. Again the article goes into greater detail.

Rollback is pretty neat and sounds like it would never work but it does, again read the article if you have time and inclination. Essentially if a input is dropped in rollback the game just keeps rendering by guessing what the player is probably doing, and if it finds out it guessed wrong it just rolls back the game state. How does it guess? well that is more complicated but some simple rules are, if they player is holding A for these 5 frames, and then frame 6 we get no input, we will just plug in A for that input on that frame, then keep going. If it turns out that the player Switched to B on frame 6 for some reason we “simply” go back in time and rerender what should have happened had we recieved that input. An incredibly large amount of time nothing will change and the rendering gets to keep chugging forward. This is due to a few things about games, one of which is a lot of your inputs don’t matter. In a fighting game if you just mash buttons, 80% of those button presses or more are just eaten up animation time anyway. The thing about rollback is it sounds like you would constantly just freeze and reset the game state but it doesn’t. Remember when talking about lag you are talking about milliseconds of difference, and we can’t really perceive things as fast as the computer can compute and render them. So they are able to do all of this rollback and re-rendering without us ever noticing.

* Anytime someone tells you are there are 2 main ways, that just means these are the 2 ways we will cover right now but there are more out there.

You are viewing 1 out of 7 answers, click here to view all answers.