Download

Bullet replication fast and in double for Client

Hi all,

I made a shooting system who work in multiplayer, but i got a problem, when i shoot with the server it’s working fine, but when i shoot with one client, the bullet replicate in twice (i got 2 bullet spawn in same time).

I did this, it’s the only solution i got for spawning the bullet for all client and the server, when a client is shooting, and for spawning at the good location or everyone.

https://forums.unrealengine.com/filedata/fetch?type=thumb&filedataid=118035

Hope someone already resolved that problem.

If your bullet is a replicated actor, only the server should be spawning it. I’m guessing “Tirer” spawns a replicated projectile.

Here are the things that are happening with your current setup:

  • everyone spawns a replicated actor
  • only the server can replicate actor to remote clients
  • the actor spawned on server is replicated to remote clients, it appears on all machine, clients can see it
  • the client spawns a replicated actor, but since he’s not a server, the actor only exists on his machine
  • the client now has 2 version of the projectile: one that is a replicated instance of the server’s projectile, the other one which is a local instance not tied to networking

In your case you can simply add a “HasAuthority” check before spawning the projectile. It will make it so you have only one projectile on your screen. But it will also make it so clients don’t instantly see the projectile when it spawns (but after a lag delay). Which can be problematic depending on the type of your game.

“Which can be problematic depending on the type of your game.”

Yeah that the problem so, i thought optimize some of my BP for C++ in fact ^^

Last problem i got it’s because in full auto my bullet are spawning too fast, i did this:

https://forums.unrealengine.com/filedata/fetch?type=thumb&filedataid=118082

On my server it’s ok, but on my client it’s like they’re no duration.

In fact, It seems good, but i still have two bullets replicating for the client…
Because the problem when it’s working well on the server, we don’t have the sound of the weapon anymore
If someone got an idea ?

i resolved my problem, i did the same than my changing clothes system in multiplayer.
I can help if someone got question