(Light travels at about 30cm/1ft per nanosecond)
(Light travels at about 30cm/1ft per nanosecond)
https://doc.photonengine.com/fusion/current/tutorials/host-m...
The lag compensation is, more intuitively, just allowing the client to move on its own without needing server verification yet. The server maintains the authoritative game state, but (assuming no cheating is going on) the clients are able to move as they think they will. In the background, the client is actually sending its inputs to the server, and they technically haven't happened until the server verifies them (however many milliseconds later), but we allow the client to move on its own regardless.
The yanking back only happens if the client's new state (position etc.) don't match the server's state.
So the server and the client are both independently calculating the state. But whatever the server calculates is authoritative, and the client's version is just a local simulation that is very accurate, but not 100%. Especially when it comes to other players, where your client is typically just executing under simplistic assumptions of things like constant forward movement.
However, luckily for the client, it receives a data sync from the authoritative server several times a second, so all that potential drift gets quickly corrected while the differences are still extremely small. For your own actions, where your client had access to all your input, the differences are probably even too small to notice. For other players though, it will be more noticeable, especially if there's an abrupt change in input.
You should think of this as “when the cpu is processing an instruction, what does it need to track to dispatch and retire it?” Designing to a click tick is one version and kind of where things were in the 1970s. It’s an educational model.
There are lots of ways to have multiple clock sources kept in sync or to alter the clock's phase to compensate for distance, so you can keep the entire CPU synchronized even if crossing it takes multiple clock cycles.
Then again, every time my computer pauses for multiple seconds, me knowing how many billions of clocks cycles I’m waiting for doesn’t help my already challenged patience… haha.
In this time, my year old consumer graphics card has performed more floating point calculations than my entire town could in their entire lives.
Occasionally I work this stuff out and it's frankly hard or impossible to truly appreciate just how fast these things are.
(36 TFlops, 250ms reaction time = 9e12 calculations. One calculation every four seconds from birth to age 100 for 10,000 people is about 8e12 in total)
Never forget what they took from you.
If Teams talks to a remote server, doesn't matter how fast your CPU is, it takes time for the question to get to the server, time to get back, that's some time regardless. Now yes, maybe they write code which goes
Hi! / Yes? / I'm a Teams client / That's nice / And you? / I'm the Teams server, what username? / SamBankmanFried / OK, and password? / Hunter2 / OK, you're logged in SamBankmanFried / OK do I have new #catpics ? / Nope / How about #emergency ? / Nope / How about #general ? / Yes, six messages ...
And that's a lot of round trips whereas they could have done:
Hi, I'm a Teams client, hopefully you're a Teams server / Yes, I'm the Teams server, what username & password ? / SamBankmanFried password Hunter2, also summarise my new stuff / Hello SamBankmanFried, you have six #general messages ...
Which is far fewer round trips.
And you missed your window to get into BIOS, you need to reboot and try again. /s