Multiplayer Replication Issue - Set Actor Rotation

SOLUTION: I have a solution to this in case anyone needs it. The solution was to create a Rotator variable inside the character blueprint. Set that Rotator variable to RepNotify so that an event is automatically called when the server updates the Rotator variable. Within the RepNotify event for the Rotator variable, use the Set Actor Rotation node and set the new rotation to equal the Rotator variable. Assign the rotation value to the Rotator variable from your Run on Server event.


image
image

I’m having an issue with replication. I’m testing with a Listen Server and 2 connected clients. Replication works fine when characters are running around the screen. All movement and rotation for all characters is being replicated on the client and server as expected. The problem is when a client player attacks. What is supposed to happen is the character rotates to where the mouse is clicked and then an attack animation plays. However, that’s not happening as expected…

  • When the server player attacks, the server and all clients can see the attack animation and rotation for the server character.
  • When a client character attacks, the server and all remote clients can see the attack animation and rotation for the client character. The local client player who performed the attack can see the animation but their character doesn’t rotate to where the mouse is clicked.

I’m stumped. Any help is appreciated.

EDIT: I did a test where I made a function that called a Run on Server event which in turn called a Multiclass event to rotate the players by 90 degrees. Same issues. However when I swapped the code from rotating the players to spawning a new object in game, it worked on all clients and server as expected. So it appears to be something related specifically to the Set Actor Rotation node and how it replicates on the local client. This appears to have been a problem in 2015 (Local client actor rotation and replication issues - #10 by Yun-Kun). The only solution was to replicate local rotation using TICK, which is not a performant solution with a production multiplayer game. Looking for other solutions.

SERVER SYSTEM: (All rotations correct)

CLIENT 1: (Server/Client 2 Correct, Client 1 rotation incorrect)

CLIENT 2: (Server/Client 1 Correct, Client 2 rotation incorrect)

1 Like