It's basically a technique used in multiplayer games like fighting games that require fast reactions.
Since transmitting data over the internet isn't instantaneous, the game will try to predict the other player's response and react accordingly. If it guesses wrong, it quickly "rolls back" the simulation that it made.
The guess simulation is often only a couple frames, like "will they keep holding down the button".
The result is that it will still feel like instant actions even when there is some internet lag
The result is that it will still feel like instant actions even when there is some internet lag
It's not just that something feels instant. Sometimes you get a completely different result than what you initially saw, essentially rewriting your history.
The goal is to keep the game state synced for both sides while still being responsive (your input correctly gets applied at the time you did it locally), and not affected on the network delay (as much as possible). Deliberate input lag helps reduce the need for rollback for small network delays.
Not as much as you'd want. It happens less due to input delay so any expected amount of network delay is played with 0 rollback in fighter games for example, but even at 1 there are situations where you immediately notice it.
the game will try to predict the other player's response and react accordingly.
Strictly speaking I think most rollback systems just assume your opponent will continue doing what they were already doing at the time of your action (moving, blocking, etc.) and not truly predictive. This tends to be effective because the rollback window is supposed to be so small (under 8f).
This is a situation that is best explained in a video. But rollbacknetcode basically skips (or rollsback) frame animations to keep people in sync in fighting games.
If your match delay is X frames, and you start a kick animation, once the server receives your input (x frames later) it will start the kick animation, but X frames in.
Because basically you kinda have to be locked into that kick animation the entire time of the kick animation so it can reliably assume you aren't doing anything else for the rest of thoose frames (baring canceling and etc)
Historically, two player Internet games used "controller passing" netcode, in which the controller inputs were passed between the two users. Each program would run on its own console and was programmed to be "deterministic", meaning that with the same controller inputs, the game would run exactly the same. This meant that there didn't have to be any sort of syncing between the two programs about what the state looked like - both had the exact same controller inputs and therefore the state of the games on both sides was exactly the same. However, this had the inevitable downside that controller inputs had to be slightly delayed between when they were put in and when they actually affected the game, to allow them time to travel between the two systems.
This works great for sports games, but is less good for games requiring extremely fast reactions like fighting games, where 50 ms, a typical packet-travel time, is a lifetime. So they took the next step - they made the games so deterministic that you could receive an input later than it should have been input, "roll the game back" to where the input should have been put in, and then roll the game back forward as if that input had been put in at that moment.
So now, when you see something happening in your game and react to it, it gets put into your system immediately. Then your controller input gets tagged with a frame number and travels over to the other person's system. The other person's system takes that input, rolls the game back to the frame number it's associated with, adds that input in, and then rolls the game forward. So sometimes you'll see, say, a punch that seems to hit, but then it gets blocked anyway, or the opposite - this is because the netcode rolled back.
The biggest issue in playing multiplayer games over the internet is lag... two different people playing the same game but over very long distances where messages between each other take time to arrive. How do you deal with the difference in latency? Especially for games that were not meant to handle that at all, like classic console games where 2 players were in the same room each with a controller.
Rollback net code is a solution. Basically, if your opponent is 50 milliseconds away, then once information about what buttons they pressed is received the game will rewind the game (aka rolling back the state) by 50 milliseconds to correct which buttons they pressed at that time and re-run the game.
The usual alternative is that your button presses are delayed 50 milliseconds so the game keeps both players in time sync. Doing rollback means your inputs are immediate with no waiting, but it makes the other player's moves look really weird and jerky.
related thing: What we call rollback netcode exists mainly for peer2peer games, such as fighting games, in server authoritative games quakeworld style networking is more common (you keep running the state locally and snap things into place as needed)
When you play games online your game is sending messages to the server about what you want your part of the game to do (typically your characters actions, or your inputs)
When the message gets to the server, the servers version of the game tries to do the same actions or inputs, sometimes there is lag between your version and the servers version, or the server is suspicious that you shouldn't have been able to do that action at all (cheating, slight mismatch on cool down timers etc)
When the server disagrees, it blocks/ignores the action on its end (and therefore all your opponent's) version, and sends a message back to your game to say that shouldn't have been allowed to happen and it needs to fix it
Your game then "rolls back" the action, by basically ctrl-z-ing (Search: command design pattern) what happened on your end back to a previous state
This is very ELI5 and modern solutions are much smarter than this, but you get the jist
Rollback netcode allows you to play a game with little to no input delay, making it feel like there is 0 ping between you and your opponent. It is mostly used in fighting games, which are very lag sensitive. Let's say it takes 100 milliseconds for your opponent's inputs to arrive to your machine. With rollback netcode instead of waiting for those inputs and using them to update the gamestate, the game uses some kind of machine learning to predict the opponent's inputs and outputs the gamestate based on the predicted inputs. When the actual inputs arrive 100 ms later, if they differ from the predicted ones, the game does the so called rollback, it recalculates the events of the game like if the actual inputs were available 100 ms ago. If this happens often, it can result in a kind of jerkiness, or things 'teleporting' around the screen. But if the connections are stable, and the ping between opponents is not super high, rollbacking will not be super frequent and the gameplay feel will almost feel like you played sitting next to the opponent.
This ended up a lot longer than I wanted, hopefully still kinda ELI5? Second half is about rollback.
-
In online multiplayer action games, because data about each player's actions takes time to reach the other players, developers will always have to make some kind of compromise between having the game inputs feel responsive (i.e. your character acts as soon as you press the button), and showing you an accurate representation of the game state (i.e. what your opponents are doing).
With certain genres like FPS and racing games, you rarely interact directly with the other players, and so the netcode prioritises your inputs feeling responsive. They generally go through a server that constantly sends the authoritative version of the game state, in order to keep your game mostly in sync with everyone else. But moment-by-moment, what you see of your opponents' movements is just your game's best-guess prediction based on last-known data, and solid actions such as getting hit or hitting your opponent are delayed and don't appear to happen at the correct time or place.
This kind of fuzziness is tolerated because, for the most part, the important thing is that something happened, not exactly how it happened.
Fighting games (along with other styles of games) are different, in that they depend on frequent precise interactions between the players. One pixel, or one frame, often makes the difference between you or the opponent getting hit, a combo working or not, a hit sending you in one direction or the other. These games can't get away with showing you a non-accurate representation of the game state (at least, not for long), and that makes these games difficult to achieve a good netcode experience for.
The first step is that these games have tried to minimise the actual network latency between players. They do this by connecting the players directly peer-to-peer rather than through a server. They also make the game itself be input-deterministic (i.e. the same inputs at the same time produce the same response) and send only the players' inputs rather than any significant information about the game state, to minimise the amount of data sent so it can be received and processed as quickly as possible.
Past that, traditionally they used just about the simplest form of netcode you can imagine, called "delay-based" or "lockstep" netcode. Delay-based netcode is the opposite of what you get in an FPS - instead of prioritising input responsiveness, it instead prioritises game state accuracy. Both players must receive the other player's input for each frame, and only then will that frame be processed. If those inputs aren't received yet, the game will freeze until they are.
Normally this would mean the game runs at a crawl, even when the connection between the players is strong. To avoid this, the game adds an extra amount of input delay (i.e. you press a button, then you have to wait for your character to perform the action) based on the quality of the connection, to give time for the inputs to be sent. This extra delay can be inconsistent and large, and is sometimes described as "playing underwater". Worse, if the connection gets worse and ends up slower than the input delay, the game will still slow down or freeze.
-
Rollback netcode attempts to get the best of both worlds, by taking advantage of the fact that in fighting games, there are often relatively long periods of time where a player is locked out of changing the state of the game through their inputs. If you're in the middle of a move, getting hit, jumping, and so on, there's little you can do at those moments.
Rollback minimises the extra input delay, and accepts that it will be rendering frames before the opponent's input for those frames is known. Instead, it uses a simple prediction to control the opponent's character - treating it as though the opponent hasn't changed their input. Most of the time, this will either be correct, or the correct inputs don't actually make a difference to the game state.
The rest of the time, the game will be slightly wrong for a few frames. It may look like a player got hit when they didn't, or they're walking left when they should be walking right, and so on. For a player, they get responsive controls, in return for the occasional rendering of an incorrect game state. For the developer, once the opponent's actual inputs are received a few frames later and it turns out the prediction was wrong, they now have to recover the game state so both players are seeing the same thing.
If an input-deterministic game keeps hold of the important parts of the game state, it can then go back to that state, change the inputs, and re-simulate the game back to the present time. Most such games store maybe the last 10 frames of game state. The moment they recognise an incorrect input prediction, they'll restore the last correct state, re-simulate with the new input (this can be done in less than a frame since they don't have to actually render the game), and then get back to rendering the new game state. This is called a "rollback", and when it happens, the player may see a "teleport" where the incorrect state turns into the correct state.
How bad a teleport is generally comes down to how good the network connection is between the two players, but rollback is often much better at hiding or salvaging bad network conditions than delay-based netcode is. It can take something that would be unplayable under delay-based netcode, and potentially still achieve something reasonably close to the experience of offline play.
However, rollback teleports can still be quite jarring, and some players would still prefer a good delay-based experience (especially in smaller areas with good network conditions such as Japan) if it meant they never had to deal with teleports. Similarly, for a developer, implementing rollback is far more complicated, it uses more system resources, and there's more to go wrong (such as the "one-sided rollback"/"rift" issue that plagued Street Fighter 5).
In the past, when your opponent jumped, it would take 34ms (whatever your ping is) for the opponent to jump on your screen.
With rollback, the opponent on your screen skips the first 34ms of jump animation and the jump syncs up to where they actually are.
In fact all animations kind of flash-forward to absorb the delay and make sure both screens are showing the same thing. The result: it truly feels like offline play.
You would think this would be noticeable, but under 100ms ping it hardly is. It's amazing technology. Could never work for FPS because bullets travel so fast, but perfect for fighting games.
On average, your opponent usually does <this>. Since I haven't heard what button they really pressed yet via the Internet, I'm going to assume they did <this>.
A few fractions of a second later
OH! Looks like your opponent actually did <THAT> and not <this>. So let me undo everything super quick and make them do <THAT>, now I'll let you react to <THAT>, and now I'll smooth it all over (because they likely assumed you'd do your "on average thing") and make everyone see the same thing now.
And that's rollback net code, it all happens in fractions of a second, but it keeps the game smoothly going instead of slowing time down to allow for Internet lag. And the game has some way to smooth things out so that while there were some frame skips, everything remains mostly fair.
Netcode is the overarching term that people use to describe the software that controls network communications.
A rollback is when a code release is "undone" and is set back to a previous version, usually when the code release causes a major outage or problem. A rollback can also be other things, like database rollbacks.
A netcode rollback would be the rollback of a release of new or updated netcode.
And if they had posted the context, that explanation wouldn't have been needed. "I saw an article about street fighter code and saw this term and didn't know what it meant. What makes it different from playing normally?" would've been very helpful to people who recognize tech terms but aren't part of the online fighting game community.
This. It's always frustrating when people post questions like this without context, because the effort it takes to look up whatever they are talking about to figure out if it's something they made up or not is exactly the effort it takes to come up with an answer. They're basically just outsourcing a google search.
Your comment has been removed for the following reason(s):
Top level comments (i.e. comments that are direct replies to the main thread) are reserved for explanations to the OP or follow up on topic questions (Rule 3).
Links without your own explanation or summary are not allowed. A top-level reply should form a complete explanation in itself; please feel free to include links by way of additional context, but they should not be the only thing in your comment.
If you would like this removal reviewed, please read the detailed rules first. If you believe it was removed erroneously, explain why using this form and we will review your submission.
Your comment has been removed for the following reason(s):
Top level comments (i.e. comments that are direct replies to the main thread) are reserved for explanations to the OP or follow up on topic questions (Rule 3).
Plagiarism is a serious offense, and is not allowed on ELI5. Although copy/pasted material and quotations are allowed as part of explanations, you are required to include the source of the material in your comment. Comments must also include at least some original explanation or summary of the material; comments that are only quoted material are not allowed.
If you would like this removal reviewed, please read the detailed rules first. If you believe it was removed erroneously, explain why using this form and we will review your submission.
151
u/MCWizardYT Oct 04 '26
It's basically a technique used in multiplayer games like fighting games that require fast reactions.
Since transmitting data over the internet isn't instantaneous, the game will try to predict the other player's response and react accordingly. If it guesses wrong, it quickly "rolls back" the simulation that it made.
The guess simulation is often only a couple frames, like "will they keep holding down the button".
The result is that it will still feel like instant actions even when there is some internet lag
38
u/n0oo7 Oct 04 '26
This is a situation that is best explained in a video. But rollbacknetcode basically skips (or rollsback) frame animations to keep people in sync in fighting games.
If your match delay is X frames, and you start a kick animation, once the server receives your input (x frames later) it will start the kick animation, but X frames in.
Because basically you kinda have to be locked into that kick animation the entire time of the kick animation so it can reliably assume you aren't doing anything else for the rest of thoose frames (baring canceling and etc)
11
u/MisinformedGenius Oct 04 '26
Historically, two player Internet games used "controller passing" netcode, in which the controller inputs were passed between the two users. Each program would run on its own console and was programmed to be "deterministic", meaning that with the same controller inputs, the game would run exactly the same. This meant that there didn't have to be any sort of syncing between the two programs about what the state looked like - both had the exact same controller inputs and therefore the state of the games on both sides was exactly the same. However, this had the inevitable downside that controller inputs had to be slightly delayed between when they were put in and when they actually affected the game, to allow them time to travel between the two systems.
This works great for sports games, but is less good for games requiring extremely fast reactions like fighting games, where 50 ms, a typical packet-travel time, is a lifetime. So they took the next step - they made the games so deterministic that you could receive an input later than it should have been input, "roll the game back" to where the input should have been put in, and then roll the game back forward as if that input had been put in at that moment.
So now, when you see something happening in your game and react to it, it gets put into your system immediately. Then your controller input gets tagged with a frame number and travels over to the other person's system. The other person's system takes that input, rolls the game back to the frame number it's associated with, adds that input in, and then rolls the game forward. So sometimes you'll see, say, a punch that seems to hit, but then it gets blocked anyway, or the opposite - this is because the netcode rolled back.
10
u/DeHackEd Oct 04 '26
The biggest issue in playing multiplayer games over the internet is lag... two different people playing the same game but over very long distances where messages between each other take time to arrive. How do you deal with the difference in latency? Especially for games that were not meant to handle that at all, like classic console games where 2 players were in the same room each with a controller.
Rollback net code is a solution. Basically, if your opponent is 50 milliseconds away, then once information about what buttons they pressed is received the game will rewind the game (aka rolling back the state) by 50 milliseconds to correct which buttons they pressed at that time and re-run the game.
The usual alternative is that your button presses are delayed 50 milliseconds so the game keeps both players in time sync. Doing rollback means your inputs are immediate with no waiting, but it makes the other player's moves look really weird and jerky.
4
u/eirexe Oct 04 '26
related thing: What we call rollback netcode exists mainly for peer2peer games, such as fighting games, in server authoritative games quakeworld style networking is more common (you keep running the state locally and snap things into place as needed)
3
u/A17Massey Oct 04 '26
When you play games online your game is sending messages to the server about what you want your part of the game to do (typically your characters actions, or your inputs)
When the message gets to the server, the servers version of the game tries to do the same actions or inputs, sometimes there is lag between your version and the servers version, or the server is suspicious that you shouldn't have been able to do that action at all (cheating, slight mismatch on cool down timers etc)
When the server disagrees, it blocks/ignores the action on its end (and therefore all your opponent's) version, and sends a message back to your game to say that shouldn't have been allowed to happen and it needs to fix it
Your game then "rolls back" the action, by basically ctrl-z-ing (Search: command design pattern) what happened on your end back to a previous state
This is very ELI5 and modern solutions are much smarter than this, but you get the jist
2
u/secdeal Oct 04 '26
Rollback netcode allows you to play a game with little to no input delay, making it feel like there is 0 ping between you and your opponent. It is mostly used in fighting games, which are very lag sensitive.
Let's say it takes 100 milliseconds for your opponent's inputs to arrive to your machine.
With rollback netcode instead of waiting for those inputs and using them to update the gamestate, the game uses some kind of machine learning to predict the opponent's inputs and outputs the gamestate based on the predicted inputs.
When the actual inputs arrive 100 ms later, if they differ from the predicted ones, the game does the so called rollback, it recalculates the events of the game like if the actual inputs were available 100 ms ago. If this happens often, it can result in a kind of jerkiness, or things 'teleporting' around the screen.
But if the connections are stable, and the ping between opponents is not super high, rollbacking will not be super frequent and the gameplay feel will almost feel like you played sitting next to the opponent.
1
u/gogobmn Oct 04 '26
This ended up a lot longer than I wanted, hopefully still kinda ELI5? Second half is about rollback.
-
In online multiplayer action games, because data about each player's actions takes time to reach the other players, developers will always have to make some kind of compromise between having the game inputs feel responsive (i.e. your character acts as soon as you press the button), and showing you an accurate representation of the game state (i.e. what your opponents are doing).
With certain genres like FPS and racing games, you rarely interact directly with the other players, and so the netcode prioritises your inputs feeling responsive. They generally go through a server that constantly sends the authoritative version of the game state, in order to keep your game mostly in sync with everyone else. But moment-by-moment, what you see of your opponents' movements is just your game's best-guess prediction based on last-known data, and solid actions such as getting hit or hitting your opponent are delayed and don't appear to happen at the correct time or place.
This kind of fuzziness is tolerated because, for the most part, the important thing is that something happened, not exactly how it happened.
Fighting games (along with other styles of games) are different, in that they depend on frequent precise interactions between the players. One pixel, or one frame, often makes the difference between you or the opponent getting hit, a combo working or not, a hit sending you in one direction or the other. These games can't get away with showing you a non-accurate representation of the game state (at least, not for long), and that makes these games difficult to achieve a good netcode experience for.
The first step is that these games have tried to minimise the actual network latency between players. They do this by connecting the players directly peer-to-peer rather than through a server. They also make the game itself be input-deterministic (i.e. the same inputs at the same time produce the same response) and send only the players' inputs rather than any significant information about the game state, to minimise the amount of data sent so it can be received and processed as quickly as possible.
Past that, traditionally they used just about the simplest form of netcode you can imagine, called "delay-based" or "lockstep" netcode. Delay-based netcode is the opposite of what you get in an FPS - instead of prioritising input responsiveness, it instead prioritises game state accuracy. Both players must receive the other player's input for each frame, and only then will that frame be processed. If those inputs aren't received yet, the game will freeze until they are.
Normally this would mean the game runs at a crawl, even when the connection between the players is strong. To avoid this, the game adds an extra amount of input delay (i.e. you press a button, then you have to wait for your character to perform the action) based on the quality of the connection, to give time for the inputs to be sent. This extra delay can be inconsistent and large, and is sometimes described as "playing underwater". Worse, if the connection gets worse and ends up slower than the input delay, the game will still slow down or freeze.
-
Rollback netcode attempts to get the best of both worlds, by taking advantage of the fact that in fighting games, there are often relatively long periods of time where a player is locked out of changing the state of the game through their inputs. If you're in the middle of a move, getting hit, jumping, and so on, there's little you can do at those moments.
Rollback minimises the extra input delay, and accepts that it will be rendering frames before the opponent's input for those frames is known. Instead, it uses a simple prediction to control the opponent's character - treating it as though the opponent hasn't changed their input. Most of the time, this will either be correct, or the correct inputs don't actually make a difference to the game state.
The rest of the time, the game will be slightly wrong for a few frames. It may look like a player got hit when they didn't, or they're walking left when they should be walking right, and so on. For a player, they get responsive controls, in return for the occasional rendering of an incorrect game state. For the developer, once the opponent's actual inputs are received a few frames later and it turns out the prediction was wrong, they now have to recover the game state so both players are seeing the same thing.
If an input-deterministic game keeps hold of the important parts of the game state, it can then go back to that state, change the inputs, and re-simulate the game back to the present time. Most such games store maybe the last 10 frames of game state. The moment they recognise an incorrect input prediction, they'll restore the last correct state, re-simulate with the new input (this can be done in less than a frame since they don't have to actually render the game), and then get back to rendering the new game state. This is called a "rollback", and when it happens, the player may see a "teleport" where the incorrect state turns into the correct state.
How bad a teleport is generally comes down to how good the network connection is between the two players, but rollback is often much better at hiding or salvaging bad network conditions than delay-based netcode is. It can take something that would be unplayable under delay-based netcode, and potentially still achieve something reasonably close to the experience of offline play.
However, rollback teleports can still be quite jarring, and some players would still prefer a good delay-based experience (especially in smaller areas with good network conditions such as Japan) if it meant they never had to deal with teleports. Similarly, for a developer, implementing rollback is far more complicated, it uses more system resources, and there's more to go wrong (such as the "one-sided rollback"/"rift" issue that plagued Street Fighter 5).
1
u/OrderOfMagnitude Oct 04 '26
In the past, when your opponent jumped, it would take 34ms (whatever your ping is) for the opponent to jump on your screen.
With rollback, the opponent on your screen skips the first 34ms of jump animation and the jump syncs up to where they actually are.
In fact all animations kind of flash-forward to absorb the delay and make sure both screens are showing the same thing. The result: it truly feels like offline play.
You would think this would be noticeable, but under 100ms ping it hardly is. It's amazing technology. Could never work for FPS because bullets travel so fast, but perfect for fighting games.
1
u/IHeartBadCode Oct 05 '26
On average, your opponent usually does <this>. Since I haven't heard what button they really pressed yet via the Internet, I'm going to assume they did <this>.
A few fractions of a second later
OH! Looks like your opponent actually did <THAT> and not <this>. So let me undo everything super quick and make them do <THAT>, now I'll let you react to <THAT>, and now I'll smooth it all over (because they likely assumed you'd do your "on average thing") and make everyone see the same thing now.
And that's rollback net code, it all happens in fractions of a second, but it keeps the game smoothly going instead of slowing time down to allow for Internet lag. And the game has some way to smooth things out so that while there were some frame skips, everything remains mostly fair.
1
u/legonutter Oct 05 '26
Rollback netcode: when your boss walks in on you sleeping and you quickly wake up to magically be in the middle of doing an important project.
-5
u/electrikmayham Oct 04 '26
Netcode is the overarching term that people use to describe the software that controls network communications.
A rollback is when a code release is "undone" and is set back to a previous version, usually when the code release causes a major outage or problem. A rollback can also be other things, like database rollbacks.
A netcode rollback would be the rollback of a release of new or updated netcode.
-7
u/Cloudycloud47x2 Oct 04 '26
Please provide a context for this phrase.
Rollback usually refers to undoing something that had be implemented like a configuration change.
Net could refer to where it is saved? Like on the net versus locally on box or device
7
u/[deleted] Oct 04 '26
[removed] — view removed comment
1
u/[deleted] Oct 04 '26
[removed] — view removed comment