Hello everyone, i try to create a multiplayer top-down shooter and for that, i would like to replicate the Line Trace of the firing weapon.
When i try on Listen Server, everything is OK (both when server is firing and clients).
When i try on the net mode “play as client” , everything is still replicated but i have a second Line Trace with another trajectory due to the idle mouvment of my character (so potentially one hits and the other not).
Even tried with 1 or 3 clients. Even with the “M_Fire” event on the BP_Weapons set as multicast. There are always 2 lines.
Generally, shot calculations should be done by the server for the actual shot. When you do it on client it’s more for things like VFX and prediction that will be corrected by the server when it does it’s calculations.
If by “idle movement” you mean the animation, that will never work as each machine will be on a different part of the animation loop, so the approach should be to line trace from a steady point not affected by animation.
You can keep the weapon’s muzzle location for VFX, which would be done on clients (Multicast), and trace from the steady point on the Server to calculate the shot, which I assume would be forward from the center maybe with a spread offset on the End point.
in “Play as Listen Server”, the Line trace is only replicated for the server
in “Play as Client”, the Line trace is replicated for each client
So in my case i want to create a multiplayer game without a player hosting, so that’s good.