Replicated Stationary Weapons

Hello,

I’m currently working on a relicated Stationary Weapon system. Something the like of MG Nest, Anti Air Cannons and so on which fires from their actual muzzle location and no other trickery involved.

It all works great in Singleplayer nad more or less replicatess in Multiplayer. However I’m running into an issue I know where it stems from. But my brain does not come around to the solution. I’m hoping posting it will enlight me directly or someone could help me :smiley:

My Setup is the following in Blueprint:

  1. Pawn Actor (replicated, Replicated Movement Deactivated to achieve Compatibility with SmoothSyncPlugin)

  2. Smooth SDync is enabled.

  3. I have 2 Scene Components under the RootComponent: RotationRoot_Yaw and RotationRoot_Pitch
    (This is done so I can easily add in static meshes or skeletal meshes and can control the base rotations of the independendly and do not need to rly on AnimBP).

  4. On Input LookUp and Look Right I set a replicated Variabls Weapon_Yaw and Weapon_Pitch.

  5. On Event Tick I interpolate betwewn the current relative yaw or pitch and the new relative yaw or pitch and set the relative rotations for both components.

The Issue:

As the Variables are Server Sided, We get the values with a slight delay as a client and it stutters depending on the connection quality. As the weapons shoot from their correct muzzle locations. This has to be the case.

I tried to calculate with local variables but this causes missmatch with the server and I can’t find a smooth way…

Could you explain more? So you have your rotations with a delay, and it is affecting the bullet trajectory?

From what I understand:
I don’t think using Smooth Sync is a good idea for the variables that are set directly via input. You always have a slight delay before clients get synced with server and using Smooth Sync could make it worse.

it doesnt technically have to be the case, you can fake it. ie set the weapons position locally and on server and then when firing compare locations within reason.

ie you can trust the client muzzle location if its close to the expected server position.

Clients always shoot from where their muzzle it. Their shot is local only and has zero influence on actual game play.

Server shoots from where its muzzle is and passes that vector to sims. Servers shot handles dmg etc.

Sim side is always faked. Muzzle flash at real muzzle, projectile spawns at the server specified location.