An example of how to implement client-side prediction for projectiles in Unreal Engine, optionally using the Gameplay Ability System.
https://dev.epicgames.com/community/learning/tutorials/LZ66/projectile-prediction-in-unreal-engine
Quite a bit different from my approach. I call it Client-Fakey, Server Auth.
System uses object pooled projectiles and does not replicate them. Only replicate simple data.
Client fires its own on input, rpc’s server its projectile velocity vector and a few others for anti-cheat.
Server calcs its projectile velocity and does some comparisons against clients data.
Fires shot, then multicasts to Sims only the spawn point and velocity.
Sims spawn the projectile at the servers muzzle location and apply the servers velocity.
Each proxy is doing its own simulation of the firing process.
I also have a dedicated projectile class for each proxy.
Client projectile applies local hit fx.
Servers handles damage
Sims can apply hit fx (squibs), but they also have an audio component to handle the “whizz” you hear from close flybys.
Server MC’s the hit data (impact/normal) to Sims so they can apply server authed decals etc.
Very low data footprint.
Also need to note the Character movement component (CMC) doesn’t sync movement. It doesn’t forward project sims to catch up to the server or clients position. Nothing in the system tries to sync. It’s impossible due to pings, ping variance (jitter) and packet loss.
Client-side prediction doesn’t really “Predict” anything. Its only allowing clients (autonomous proxies) to apply movement on input and simulate it locally. The server takes the same moves and compares against clients results for each move and RPC’s either an ack or a correction.
You can easily confirm this in PIE (client mode) with 2 players. Turn on emulation for clients with a 200/200 ping, 1% loss. Player movement will lag behind on each other screens. Jumps are the easiest to see.
Since movement isn’t forwarded you don’t want anything else to be forwarded. If you forward project your projectiles they will not hit exactly what they where meant to hit in regards to players.
Autonomous are always ahead of the server. Servers are ahead of Sims.