@malcriado
So in Unreal it’s always a question of who is the owner of the actor? Who spawned it?
To make short, you can have actors spawned by other actors, or actors spawned by the level (e.g. the level blueprint)
In multiplayer, the level exists in 2 versions: one version for the listen-server (Authority), and one version for the clients (Remote). As an example, if you spawn a cube mesh in the level blueprint, it will spawn 2 versions of that cube: one visible and accessible only by the server, and one visible and accessible only by the remotes. You could easily choose to spawn the cube just on the server, or just for clients with a Has Authority Switch. The same with functions. You can do a Remote Procedure Call (RPC) from server to client and from client to server. Finally, you can also replicate variables from server to client. So as an example, if you want a pawn opens a door, you have to ask the question who owns this pawn? Following that, you ask yourself the question who should be aware / affected by this action? Only the player itself, like having and HUD with health points, or everybody, like detonating a bomb among everybody? By asking these 2 questions will know what to do.
Now with the pawns. Usually in a level the pawns are spawned by the server, as in the template, where the GameMode (which exist only on the server) spawns the AvatarMaster pawns. When these pawns spawn, they are spawn as multiple copies. The player which is the host of the game will be spawn as an Authority, Locally-controlled copy, which is the one receiving inputs from the controller (or things such as HMD position and motioncontrollers position and inputs). At the same time, another “silent” copy is spawned, which is the Remote, Not-locally-controlled copy of the pawn. This copy is the one which will be seen and will interacts with other players (clients). The tricky thing is that this copy of your pawn, following is birth (spawning) in the level, has his own independent life! So if you want your actions or the color of your hat be seen by other players, you have to make sure that your Authority, Locally-Controlled pawn (the one you control) dictates his will to the Remote, Not-locally-controlled copy. You do this with variable replication, and with RPCs.
To complicate things, there are 2 other copies of actors possible. These are the Remote, Locally-Controlled pawns (the one controlled by each clients), and the Authority, Not-Locally-Controlled pawns (the copy of the Remote, Locally-Controlled pawn), visible and interacting with the Authority, Locally-controlled pawn.
So all these copies of pawn have to be tracked and taken care of. It’s always possible to communicate between copies of actors, whether through simple replication or one or multiple RPC.
So in short:
Authority, locally controlled pawn exists in 1 copy, which is directly controlled by the host. Its copy is Remote, Not-Locally-Controlled pawn, which is visible and interacts with Remote, Locally-Controlled Clients.
Each client directly controls a Remote, Locally-Controlled pawn. Its copy is Authority, Not-Locally-Controlled pawn, which interacts with the Authority, Locally-Controlled pawn. Plus, to be seen by other clients, he will have to be sure to spawn a second copy of himself, this time as a Remote, Not-Locally-Controlled Pawn.
So authority needs only a copy of himself to be seen by all others; clients have to have copy for the player host, and another copy for all other player clients.
What I’ve done in version 3.1 and up is that I separated the functions for each different copies of pawn (Authority, Locally-Controlled / Remote, Locally-Controlled / Authority, Not-Locally-Controlled / Remote, Not-Locally-Controlled). Why? For 3 reasons:
- Each copy doesn’t have to fire all the same functions, but they must be fired in specific order. The solution was to put delays (but it was annoying and not clean) or control what every copy is doing.
- I needed also every copy to act differently for Oculus Avatars
- It gives a finer control over each copy
So now for your door!
First question to ask: Who owns the door? As your door is probably in the level at level start and Netload on Client is selected, your door is owned by no one so it exists as 2 copies: one seen and interacting with the host (Authority), the other one seen and interacting with each client (Remote).
The second question is a) who is interacting with the door, and b) which player is affected / see this?
So your BP tells me that you want to be able to open the door with the trigger when your are in close range (by triggering a trigger volume). The answer is a) whether the Authority, Locally-Controlled pawn or Remote, Locally-Controlled pawns and b) everybody
Check first that your motioncontroller meshes are able to trigger the triggerbox of your DoorBP. That done, ensure that your DoorBP is set to replicate and replicate movement.
Now we know that the Authority copy of DoorBP will dictates its behaviour to Remote-DoorBP, so we just have to talk to Authority-DoorBP. So the simplest way is that Authority, Locally-Controlled pawn directly fires OpenDoor in Authority-BP, and that all clients, that is, Remote, Locally-Controlled pawns first send an RPC to the Authority, Not-Locally-Controlled pawn, and the latter will fire OpenDoor in Authority-DoorBP. This is the simplest way to do it. This way everybody should see the door opening.
Note that if DoorBP would have been spawned (so owned) by another player, that would have played differently but not so much difficult, if you ask the questions. That’s it. Hope that’s not too much confusing, and for the purist I know I used not always the right terminology but its for sake of understanding.
&stc=1