Download

Projectile Movement Replication vs Multicast

I spawned a projectile and set it’s movement to replicated.
It seems that there is no movement prediction involved, every tick the client simply update the new projectile location.

Am I doing something wrong or should I just spawn 2 different projectile (1 for the client and 1 for the server) ?

If you are spawning the projectile on the client, you need to make that client ask the server to spawn that projectile for him, and replicate it to all other connected clients.

It depends what you’re after.

If you want a true authoritative scenario, then the server should spawn the projectile which then replicates to all of the clients.

However, if you want to create a more lag free environment you can take a “riskier” route by having the client spawn the projectile and then telling the server that it hit. To “secure” it, you’ll want to do a whole bunch of calculations to ensure that the projectile could have done what the client said it did. This of course only works if you have a projectile that is really predictable, a grenade like projectile which randomizes its bounce direction wouldn’t be possible to reliably secure for example.

In UE4, projectile movement usually is predicted on the client / server though … at least they were in UE3.

mmmm, I’m thinking about spawning in multicast a NOT replicated projectile, and then use only the OnHit Event on the server side.

Projectile movement replication doesn’t really seems working really well, It seems it just update it’s position every tick

yeah I have the same problem, using ProjectileMovement component to move my pawns around like a simple vehicle motion. They really stutter a lot even in low ping situations. It seems like it’s not replicating velocity - only position.

Multicast is more expensive, especially if it’s reliable. Use standard replication, it’s fine. Server should spawn the projectile. Local clients can do some kind of prediction if they like (UT does this) - but it’s not easy to setup or manage.

Projectiles do replicate velocity as part of “ReplicatedMovement” (all actors do this). Prediction is not the same as replicating velocity.

If you use it on a pawn you will get stuttering. There’s a reason Character Movement is as complex as it is…