Multiplayer projectiles at high velocity problem


In multiplayer, projectiles that have “high” velocity, looks like are spawned later on client… Could someone help me how to solve this? I think its easy but i dont have idea how to do this…

i have a velocity of 5k and dont have this problem . i guess there is something wrong with youre setup. maybe post some screenshots and we can help

Hi, thanks for response, here is my BP:

What I did when I was working with projectiles in a game, is make a multicast event and create the bullets there(without replication). So basicly the bullet movement was handled by the clients based on the velocity and rotation I sent from the server. That way there were no laggy projectiles.

So i tried to transfer spawn projectile to multicast which works, projectiles looks like are almost spawned on muzzle location, but then damage event in projectile does not work (i know it runs only on remote and my damage event is server only but server RPCs in projectile didnt helped me)… Is this setup correct or something is missing?

Well from this picture, it seems like no bullet is spawned in the server. Also, the damage, who is the owner etc is unnecessary for the clients, because only the server needs to check who is the owner, who got hit (for friendly fire etc). All you need to send the transform, and the client should handle the movement. I guess what’s here is another projectile that spawns on the server. Also, I’d recommend not to add the Projectile on the multicast event for the server, because clients will also receive the data like the damage, owner, and they don’t need to know this kind of information (it will decrease packet size). I hope I helped a little bit.

I simplified it a bit, so if i understand correctly, this way i should to do it? Well it looks like it works but 2 projectiles are stacked on each other…

(multicast rpc is set to multicast… before i taken image i forgot to switch it)

Seems like it should work, however make sure that the bullet does NOT replicate. And you can set the damage to 0, It’s slightly better I think.


Perfect! this works exactly as i wanted. :slight_smile: Thank you a lot again.
Projectiles although looks like are not spawned at muzzle but it never mind, its still much better than it was

You are welcome :slight_smile: As for the bullets, clients should see what the server sees, with a small delay. If the bullets do not spawn correctly on both client/server, then there must be a calculation problem. If you want to post some screenshots from where the bullet is getting created, how it gets the location it needs to be created etc, maybe we can help you some more :slight_smile:

I think calculation is good because if you check my first post when i used 350 velocity, then projectile is spawned from muzzle, I think this looks like a problem of frame-rate, looks like first frame is projectile not rendered yet, distance between projectiles == distance from muzzle to first projectile rendered :slight_smile: (when i run 2 clients, my FPS jumping from 40-60 FPS, mostly 35-40)

There is a really easy way to solve this problem. Spawn the projectiles with 0 velocity. Keep them at this velocity for only 1 frame by using a very short delay like 0.01 Seconds. Then set the projectile velocity to the desired high value.
As the projectile will now appear for 1 frame right at the muzzle, your brain will automatically “fill” the gap to its next position. Obviously this trick can’t compensate for very large lag spikes, but for my game it works all the time.

Thanks :slight_smile: i will definitely try this
edit: or maybe i can try to spawn “fake” projectile for 0,05s :slight_smile: with no movement, only mesh

Sorry wasn’t at my computer but glad you have solved it. Yeah or if you don’t want to mess with projectile velocity another way is to hide it with a muzzle flash effect coming from the gun muzzle so it looks like the projectiles is coming out of the flash .