Download

Network projectiles setup - need help

Hello,
I spent many hours with projectiles setup but still i dont know how to do that correctly.

1. Replicated projectiles
PROBLEMS:

  • projectile is not spawned at muzzle at higher speed (server -> client delay?)
  • client see overlapping projectile mesh even if projectile is destroyed on overlap (server -> client delay?)

2. Not replicated projectiles
With this way i solved problems with muzzle spawn location and overlapping as described at point 1…
setup is:
sever spawn projectile not replicated → multicast → switch has authority remote → spawn projectile
PROBLEM: If projectiles are spawned at same time and server projectile destroy actor, then multicasted projectile continue…

for better imagination, video:

https://www.youtube.com/watch?v=7LM1-QsYgcc

Its because first is spawned server projectile with damage, when it kills pawn, then multicasted FX projectile cant collide so won’t explode… I can fix this travel + explosion FX with latent node on multicasted projectile (about 0,1s) but i really dont like latent nodes especially in damage events…
Please, help me someone with setup, im totally done…

Edit: i can fix that with delayed server damage projectile(not multicasted)…

bump…

I had a ton of problems replicating projectiles smoothly & accurately in my multiplayer game and seemed to have resolved it pretty decently by:

  • A replicated projectile is spawned on server only (not multicast)
  • Projectile is set to NOT replicate movement
  • My projectile simulates physics, so on the client, I have turned OFF physics simulation so it only simulates on the servers. This makes the client version of the projectile only a “visual” copy with no physics movements of its own
  • Have a replicated variable on the projectile that stores the projectiles vector location every tick on the “Authority” then calls a Multicast event to the client; the clients take that replicated variable and their client projectiles “actor location” and sets the new actor location using “VInterp To”

From the limited testing I performed locally and over the internet, everything seemed to be in sync pretty accurately. This solution may not help with your style of projectile, but when I tried multicasting the projectile spawn, I was never able to reliably have them in sync. I only multicasted explosions when the projectile hit something on the server.

Thanks, im gonna try this tomorow. Only thing i want to ask, im bit afraid of using tick event in projectiles because of performance… is it ok to have 200 projectiles with tick event at same time?

I cant believe how hard is this networking in easy stuff as projectiles… epic really should do more advanced tutorials for networking.

I only had to worry about 5-10 projectiles at a time; I never attempted getting anywhere near 200. You could try “replicating movement” on the projectiles and not using the variable/“VInterp To” method and see if it fits your needs. For me, the projectiles were too choppy unless I interpolated the clients projectile.

this mine bp not work at all

Well, unfortunately setup that i described does not work at all… (when i changed fire rate to slower, then it started glitching again)
So any advices are welcome :slight_smile: