Download

Fire projectile visually on client but manage on server

Hi,

I have a projectile weapon that implements a ServerFire function that spawns a replicates a projectile to each client. I am trying to figure out how on the initiating client to fire a local projectile so even with lag it feels responsive, but then the real projectile to be fired on the server and be replicated to every one else.

Currently if I were to try and spawn the projectile on the client, then told the server I would see two projectiles on the client. Any advice?

Thanks!

Download UnrealTournament and you can see how they do it.

The general flow is:

  • Spawn Local Projectile (optionally mark it with some Id), tell the Server.
  • Once Server replicates projectile, disable the visuals locally, and find the local projectile with that Id (or match velocities + class likes UT does).
  • Interpolate the Fake to the real projectile.
  • Once interpolated (or close enough), remove the fake, turn visuals back on for the real projectile.