I have a first person setup with two problems, but I believe the same solution applies to both
- When the player rotates the yaw of their camera by moving the mouse on the X axis, rotate the character’s yaw to match it. If I run single player, this works fine. If I run it with a client/server setup, the client can see the server rotate, but the server cannot see the client rotate.
What do I need to do to get the Client to tell the Server to also rotate the player (and have it replicate to all other clients as well? Not yet implementing relevancy).
I have tried a few things, from promoting the value to a replicated variable to forcing the process to execute a custom event with Multicast enabled, but I’m mostly just guessing. I’ve followed the Epic tutorial series including Blueprint Networking, but I was unable to figure this out.
- When the player interacts with an actor (a wall, in this case), attach the actor to the player. When the player interacts again, detatch the actor. Again, this works fine in single player or if the Server does it, but if a Client does it, no one else ever sees what is happening. The setup I have for this is a bit complex…
Wall implements an interface defining two functions: “On Use” and “On Use - Holding”. When “On Use” is executed, it is passed in a “Character” variable, it casts it to the character I have created and executes “Set Holding Object” on the character. When “On Use - Holding” is executed, it is incredibly similar, does the same thing but executes “Place Held Object” on the character.
When the player presses “E”, if the character is not “Holding” an object, it runs a Single Line Trace to find an actor within 200 units, and executes its “On Use” event. If the character is holding an object, it executes that actor’s “On Use - Holding” event.
So the player presses E which triggers the “On Use” event of the wall which triggers the “Set Holding Object” event on the character. The player presses “E” again which triggers the “On Use - Holding” event of the wall which triggers the “Place Held Object” event on the character. Both “Set Holding Object” and “Place Held Object” are here:
That’s about it. Overall I’m really unsure as to what part I need to focus on in order to make sure this is replicated properly. All the other clients need to know is that the wall is moving and they need to see it moving.