Prediction vs Sync
The clients and server is Never exactly synced, there is always Ping Time between the client and the server!
This creates lag, even a Ping Time of 40ms is significant when it comes to fast-paced games.
Prediction is a way for the client to guess what is happening on the server before getting the sync.
It also allows the server to save network traffic by not syncing variables as often over the network.
If a proxy-player is walking forward, and a package of network data is lost, for example, the client can predict that the player is still moving forward and still move the proxy-player in that direction.
A spell that hits the ground on the clients computer can predict that the server-side impact will be on the same position and instantiate that impact before getting the sync from the server. If the sync from the server say that the impact was on another position the client can just move the impact to that position. The alternative would be to let the spell travel through the ground on the client and then instantiate an impact at the position that is synced from the server. As said earlier even a Ping Time of 40ms is significant when it comes to fast-paced games.
Correction or Snap is when the client needs to correct the prediction and "snap" the wrongly predicted GameObject back into the correct place or state or whatever was wrongly predicted.
There is a balance between too lenient and too strict prediction.
If you have too lenient the clients will not truly reflect what is happening on the server which will for example display the same player on different places for each client, which means that when you shoot at that player and hit on your client you might miss according to the server.
While if you have it too strict you will see a lot of players, spells, etc. snapping and jumping around which will make the game look badly coded and will put players off from playing your game.
In Ghostly Horizon I made the server strive to move the server-side player towards the clients position, I send both the client position and the clients move-direction to the server and the server would then move the player in a direction between those two.
Interpolation & Extrapolation
A technique used for client-side prediction which allows the server to send fewer syncs to the clients which allows for more players on the server.
The prediction of values between two values based on past values.
The player is at position X and the server syncs a new position at Y.
Interpolation is the technique to move the player to position Y in a smooth way taking into account the movement speed and direction that the player already has at position X. The aim is to get a new position sync before reaching the last one which will allow the interpolation to continue.
The prediction of future values based on current and past values.
The player is interpolating to position Y but does not receive a new sync from the server before getting there.
Instead of stopping the player at position Y the client can predict where the next sync will put the player using the data known about the movement currently and keep the player moving.