Do we have enough bullets? How well do we hit them? How much health does the enemy have left?
Once the server has figured all of this out, it will send the data back to the client.
If the server rejects the code executed on the client side, then try to correct it.
The client will only render the animation effect of the target dying if the server indicates that the target is dead.
"Ah! Yes, that's how it should be!"
Carmack's eyes lit up.
This sense of immediacy is precisely what online gaming lacks most.
Let the client keep players engaged and playing for now; the server can figure out the rest gradually.
Thinking of this, he immediately got up and ran to get to work.
But Lin Lixin immediately called out to him.
"Don't rush, this is just the first layer of insurance."
Lin Lixin simply reached out and erased a blank space on the whiteboard, rubbed his hands together to wipe off the ink, and then continued, "While this solves the problem of instant response, it will introduce a completely new bug into 'Quake'."
He wrote two lines on it.
[favor the shooter] (to satisfy the shooter)
[responsiveness]
These two concepts correspond to two completely different optimization approaches in the FPS (Frame Rate) optimization field.
The client-side prediction we just designed is actually a very typical example of responsive design.
The principle of responsive design is that when a player performs an action, they should receive immediate feedback.
"Look, what's the biggest advantage of this design? It's definitely that it aligns with the player's intuition, offering crisp and efficient controls, making it feel just like playing a local game, with absolutely no noticeable online lag."
Lin Lixin nodded at the place where the word "responsiveness" was written.
"But it's not perfect; its biggest problem is... it can't hit people."
Carmack blinked, waiting for Lin Lixin to continue.
Because putting these two together is like the left brain fighting the right brain. As mentioned earlier, client-side predictions cannot interfere with server-side decisions; this is to ensure consistency and fairness.
Now they're bringing up the fact that they couldn't hit anyone.
"Rebound due to prediction errors, situations where you can hear a gunshot but no shot is fired due to an incorrect number of bullets, hitting a person but missing..."
Lin Lixin meticulously listed the current online system's crimes one by one, as if they were his own treasures.
Therefore, we need to introduce a second optimization strategy.
His hand moved upwards and tapped the line for "[favor the shooter]".
"We need to be slightly... biased, favoring the shooter, when the server processes information."
"But wouldn't that lead to...?"
Sam started to speak, but before he could finish, Lin Lixin interrupted him.
"Don't worry, I'm not saying the shooting process should be completely localized; whether it hits or not is still the server's responsibility."
Now neither Sam nor Carmack had any ideas, and they quietly awaited Lin Lixin's final answer, "Lag compensation."
Lin Lixin explained,
"Prediction can solve the problem of feel, while delay compensation solves the problem of fairness."
He drew three squares on the board, connecting two of them to the top square with an arrow.
Obviously, this is a very simplified client/server model.
"You see, assuming our latency is 100 milliseconds, what we see in the game is actually the content from 100 milliseconds ago. And if we fire at that moment, we'll hit the opponent from 100 milliseconds ago."
That's bad news.
Theoretically speaking, if a player aims at a target with absolute precision and fires, it is impossible to hit a moving target under such circumstances.
Unless this expert is so skilled that they can accurately calculate their own real-time latency and, based on various factors such as the opponent's current movement state, psychological state, and tactical strategies, comprehensively predict the opponent's next move and target the corresponding position in advance.
But that's clearly impossible.
Professional players can at most calculate the lead time and shoot accordingly.
True, complete prediction is simply beyond the capabilities of the human brain. Even computers cannot perform the full calculation.
"Here's the problem: this creates a bizarre sense of disorientation for players—they fire, aim, and hit the target, even with blood gushing from the head, yet the target is completely unharmed, without a single scratch."
"And the solution to this problem is very simple."
Lin Lixin reached out again and wrote down a word.
[rewind]
It's not like the Isaac, but the ideas are indeed similar.
"Rewind (rollback), more precisely, server rollback."
This is Valve's secret weapon.
Compared to previous predictions, the importance of this system is truly next-generation, completely solving the problem of not being able to hit targets in high-latency environments.
"A snapshot within a few hundred milliseconds..."
Carmack muttered, then suddenly a thought struck him, as if he had guessed what Lin Lixin meant. "Lin, you mean... when the player's shooting information is sent to the server, it's no longer processed based on the real-time status, but instead... a snapshot is checked?"
"That's right."
Lin Lixin nodded in satisfaction, a smile spreading across his face.
"We let the server determine... what the world looks like at the moment the player fires."
When a network packet is sent to the server, the server will retrieve the corresponding cache based on the status and check for a hit or other information.
After completing the calculation, the results and necessary correction information are returned to the player.
The entire process may add a few milliseconds of latency compared to the original, but the resulting improvement is absolutely worth it.
"I see..."
Carmack nodded thoughtfully, his mind suddenly opened up.
Sam, sitting to the side, carefully examined the things on the whiteboard.
His skills are far inferior to the two, but he is a true veteran player and has his own unique perspective on issues.
After finally managing to understand the mechanism, Sam interrupted the two who were still rambling on about the algorithm's details. "But if that's the case... won't the experience be worse for the person being shot?"
Sam mentally rehearsed the scenario and immediately grasped one of the most serious problems.
"If I'm playing a positional game behind a wall, won't it be possible to get killed even though I'm hiding behind the wall? It's like I'm passing through the wall."
This setup sounds fantastic; shooters will always have an excellent gaming experience, playing just like a local game.
But upon closer inspection, there are quite a few problems as well.
Lin Lixin seemed to be glossing over the problem by avoiding the important issues, without addressing the root cause at all.
Upon hearing this, Lin Lixin raised an eyebrow and looked at him with slight surprise.
Sam has touched on the very essence of FPS network design.
"You're right, Sam, but unfortunately... it's an unsolvable problem, at least for now."
Lin Lixin gently shook his head.
Carmack immediately realized what was happening and helped explain to Sam:
" Sam, the experiences of the shooter and the shot cannot be simultaneously satisfied; mathematically, this is simply not true." The statements "If I hit, it should count" and "If I dodged, it shouldn't count" are contradictory.
These two ideas are mathematically impossible to hold true simultaneously when objective network latency exists.
Even modern FPS games haven't been able to completely solve this age-old problem.
No one can solve it perfectly.
At most, we can optimize and mitigate the situation, minimizing its occurrence or at least making it less noticeable.
"We can optimize this to some extent by limiting rollback time and using different processing modes for different weapons and environments. Although we can't completely solve it, we can ensure that the vast majority of players have a sufficiently good gaming experience."
When it comes to FPS network optimization, it's entirely a matter of personalization.
Almost every modern FPS game has its own unique optimization logic.
The Valve faction's preference for shooters directly determines the entire ecosystem of CS.
Valve's philosophy is to prioritize providing players with the best possible shooting experience, even at the expense of some of the player's experience being shot at.
This approach is highly suitable for FPS games with low time-to-kill (TTK), meaning games where the outcome is decided within a few shots.
Within the Valve school of thought, there's an outlier— Valorant. Riot conducted in-depth research on Valve's optimization strategies and added his own insights to them.
It allows low-latency players to receive certain preferential treatment, strictly limits the length of the rollback window, and increases the server correction frequency.
High ping significantly reduces the gaming experience for players, but it results in greater competitive fairness.
In long time-to-play (TTK) games, neither Valve's nor Riot's solutions are suitable.
In this respect, they do a pretty good job... Although it sounds a bit abstract, Sima Chongsheng's Apex is indeed quite remarkable.
The idea behind respawn is simple: players should first feel like a nimble monkey.
Various maneuvers and movement controls are the top priority, ensuring a smooth and fluid motion experience in Apex Legends.
Besides these two major categories, there is also a type of competitive game that combines the two styles with long time-travel maps.
Blizzard's Overwatch.
When it comes to network synchronization design, Overwatch is definitely one of the most complex and advanced.
The addition of various fancy skills and mechanics makes it impossible to use the same network strategy for all environments in Overwatch.
This is really not a very useful reference point; it's a unique design specifically for the game Overwatch. Beyond that, there are server-centric solutions like Escape from Tarkov.
There is no universal solution to this problem; specific strategies need to be developed based on the type of game.
Um...
If we insist on finding a perfect solution, then yes, it does exist.
"If we really want to completely solve this problem, the only solution is for players to upgrade their broadband..."