What is Rollback Netcode? ¿Why is it so important?
Before diving into the central topic of this note, it is important to know that they are the latency and the ping. Latency is, roughly explained, the time it takes for a data packet to arrive from a server to a terminal and vice versa. In other words, how long it takes for the information to arrive. The speed of this process is measured in milliseconds and is called ping. The ping is affected by several factors, some of them are: the speed of the internet connection, the distance between the Wi-Fi router and our terminal, the geographical distance to the server, the processing speed of our unit, the use of bandwidth. band for other processes, etc.
The ping is not stable and tends to have a variable rate throughout the connection. An acceptable ping is generally below 20 (ie less than 20 milliseconds latency = 0.02 sec) why? Because the human eye can hardly distinguish images at speeds higher than 30 frames per second (ie one frame every 0.033333 sec), so a loss of a few frames is imperceptible to the human eye.
So far it is understood, let’s continue.
Nowadays many games are configured to project images at a speed of 60 fps (frames per second = frames per second), all this in order to increase the definition and give it a sensation of fluid movement. The problem lies when the ping is high and the long latencies cause our terminal to be several milliseconds behind the action that occurs on the server. This can lead to increasing loss of frames per second and make it noticeable to the eye. Although having a few milliseconds of delay is not serious if we play a game of chess online, for other things in real time such as a video call it can be somewhat annoying. But if we are playing an online shooter where reaction speed is crucial to the gameplay, dropping frames can make it absolutely impossible to play. This loss of frames per second perceptible to the senses and that makes gameplay difficult is the classic and feared lag.
Fighting games have the particularity that in online gaming, although they depend on a server that establishes the connection between the parties, once the match with the opponent is achieved, the control of the game is handled by the synchronization between both terminals, which constantly compare information with each other without involving the server (the so-called protocol lock step). This is when ping kicks in and brings all the trouble, manifesting mainly as a delay between when we make a command and when our opponent receives it. When the ping has high variability or is very high and does not coincide with that of our opponent, a discrepancy is generated that puts the entire synchronization of the process at risk. To deal with this lack of synchronization, fighting games come with a built-in contraption called netcode.
The most used netcode in most fighting games so far has been the delay based netcode (network code based on delay) which adjusts the action of the characters as soon as the information arrives from the other terminal. To explain it simple: if we (player 1) carry out a command in frame 1 (for example, press a kick button) and we have a delay for the information to reach the opponent of 3 frames, we will see the action on our screen being carried out in the first frame but our rival will be presented with said command only in the fourth frame, during those 3 frames of delay our character will be interpreted as inactive by the terminal of player 2. The same happens in the opposite case, if the opponent he’s 4 frames late he’ll see his action on frame 1 and we’ll see player 2’s action on our screen only on the fifth frame. The delay based netcode has a frame tolerance stipulated to maintain a fluid rhythm of gameplay, losing 3 or 4 frames per second when a fighting game has 60 fps is not the death of anyone. This can work well when both opponents have a low and stable ping.
So what’s wrong with this netcode?
The problem with this netcode is that half the world has internet connections that suck. This means that players with high ping due to a bad connection (for example, all of Latin America) have very long and unstable latencies that lead to lag for the game due to the loss of 10 or 20 frames per second. This causes many players to be forced to:
A) play on local or regional servers that, due to their geographical location, favor having a low ping and not being able to compete with players from other parts of the world
B) settle for playing mediocre games where because of lag you can’t even hit a combo and usually end up losing
C) match rivals who share your ping rather than skill by making unbalanced fights
D) abandon online gaming because the gaming experience is unsatisfactory
E) all the above options together
To solve this a few years ago fighting games gradually started to use an improved version, the rollback netcode. This netcode is not new, it has existed for more than a decade, but it was not until recently that it began to be used as a measure to favor gameplay.
The rollback netcode itself works as a predictor of player actions… que???
To explain and understand it, if our terminal (console or PC) stops receiving information from the other player because of the ping, it will fill the command line with the last action performed by the opponent. This predictor completes the information frame by frame and is usually quite successful.
For example: if during combat player 1 pressed the turn signal to the right and his character was moving forward, but suddenly the ping of one of the players increased and player 2’s terminal stops receiving information from player 1 for a few milliseconds, then terminal 2 interprets that character 1 continues to perform the last recorded action (that is, moving forward) and will execute the action until the information flow with terminal 1 is reestablished.
What if the prediction is wrong?
Let’s continue with the previous example: in case the terminal of player 2 had performed the action predicted by the netcode of keeping player 1 moving forward, but suddenly receives a command from terminal 1 with information different from that already performed by the prediction, delayed by a few milliseconds a few frames back (for example because player 1 crouched down instead of moving forward) in that case the netcode of terminal 2 tells the game to rollback (return the game backwards) placing character 1 in the place it should have status and performing the correct command. Remember that if the prediction was correct, the game continues without problems, and in case you have to go back a few frames, keep in mind that the game runs at 60 frames per second and no action performed by the characters lasts less than 20 frames. . Which gives terminal 2 plenty of room to adapt the action to the correct command without the eyes of player 2 perceiving it. These constant checks and corrections allow you to play practically without lag. There are times when the ping of one of the players is too high and the command is delayed many frames, in these cases the correction rollback can be perceived as a small “teleport” of the rival to another place on the screen but that usually does not occur. impacts gameplay.
To delve a little deeper into the subject, we must know that doing a rollback of a few frames backwards is no small thing…. it means that ALL the frames of the game must be auto-recorded one by one so that the content of said frames can potentially be loaded in case a correction is required for a discrepancy with the received command. Therefore, the game must be programmed from the beginning to record the game 60 times per second, just in case the prediction goes wrong. And meanwhile you must continue to run the normal combat processes, animations, graphics, sounds, etc. This is a LOT of programming work and consuming a lot of hardware resources. Some developers made notable efforts to reprogram already released games to later add the new netcode, such was the case with Street Fighter V and the Mortal KombatXwhich had to add these netcodes against the clock through updates so as not to lose their community in online gaming.
Now, if rollback netcode is so good, why are there games that still use the other version?
Because the problem itself is not the netcode, but the internet connections. For this reason, in Japan, where there are several developers with their gaming servers and who have connections with astronomical speeds, the delay based netcode does not represent any problem for them. It is a very expensive headache for Japanese companies to have to reprogram an already released game to change its structure and put a foreign netcode on it when theirs is doing very well in Japan. In contrast, in the US the measure was taken more naturally and US developers quickly jumped on the rollback netcode ship.
This netcode war is generating losses for Japanese companies who see how the fighting games community is turning to American games, while Japanese games are starting to lose ground. Having an active online community is a must as it is the aftermarket development engine for any game, as well as being a spur to the development of new content that benefits everyone. Fortunately, this has not gone unnoticed and Japanese companies began to switch to the new version of netcode. In fact, SNK announced that its new The King of Fighters XV will have the rollback netcodesomething that the fighting game community greatly appreciates.
If you got to read the note up to here, I thank you very much for your interest, I hope that it has been understood and that you have been able to learn as much as I learned researching on the subject. I leave you this link to a video where it is explained well with some very illustrative examples.
I send you a hug without lag and see you next time.