How the server can communicate with a specific client

Hi everyone,

I’m quite new in Unreal Engine and I think I have some issue to understand some basic concepts, like how works network in the engine.

I have a listen server and two clients (network multiplayer) and I simply want to enable VR on one client. So my idea was to have a RepNotifyinteger to keep and share the PlayerID on which the VR is enabled.
This way, when the server will set the PlayerID, both clients will be notified. Then I will just have to compare PlayerID on remote clients to know if I have to enable VR or not.

To achieve this, on the server, I get all players using “Get All Actors Of Class”. Then I check for each of them that they are remote players using “Has Authority”. When I encounter the first remote client, I get his player state and its PlayerID and set it in my RepNotify variable and break the loop.

The issue is that “Has Authority” always return me true which is obviously not what I need.
I also tried to use the “Player Array” in the Game State but I have the exact same issue.

Am I trying to achieve this the wrong way ?

Best regards.

EDIT: I think I’ve totally miss understood how actors are spawn on networked multiplayer. Is my listen server spawning himself all clients ? Or are the clients spawning themselves their own actor ?

With Listen servers PlayerID 0 is always the server, tho im not entirely sure if that helps you with whatever you are planning… If I understand right you want to switch VR on for only one player? both? only the clients?

Basically id make a Event on the client the server calls that goes “Go VR if > Condition applies” and send it to all connected clients.

Yeah I want to enable VR for only one client. I’ve already managed to enable VR on both clients using a multicast event. But I’m stuck doing it for only one client

Okay I’ve managed to do it. I have finally done it in my custom game state.

First, I pick a client ID and share it with all clients.

Each client will recieve a notification. There, I check that this ID is the same as the current client. If so, I enable the VR

I think this is a quite clean solution. Tell me if you disagree.

Regards.