Anyone know how I can replicate projectiles?

Ive look everywhere but I just cant seem to get this down Ive tried looking it up and at one point I almost got it but the bullets were duplicated.

You have two options.
First you need to set the projectile class to replicate.

  • Option 1: Have the server spawn projectiles. When the server spawns actors that replicate, it will replicate to all connected clients. Problem with this approach for projectiles is firing client latency. You’ll notice a delay in responsiveness.

  • Option 2 (C++): Spawn a local projectile, then RPC the server to spawn the authoritative projectile. Use DOREPLIFETIME_CONDITION Condition Property (COND_SkipOwner) to skip owner. This will eliminate the duplicate projectile on the firing client.

Option 2 will require the use of projectile prediction to sync the servers delayed spawned (50% ping) projectile with the current position of the firing clients.

1 Like