Download

Call specific clients from server - verify my network setup

Hey guys,

i thought about messing around with UE4 networking features a bit and im struggeling when it comes down to send events from server to 2 clients, which are part of a session.

  • Server
    – When a client starts the game he logs in to the server
    – A client can send an rpc to server that he wants to join a player-pool (Array of PlayerID´s) (Works!)
    – The gamemode has a matchmaker class which ticks the pool and checks if there are 2 players inside and create a session(own class) if true. (Works!)

– When the session is created i want to tell the two players that they are in a match now and telling them the sessionID. (Doesnt work - i dont know how to call client code with the PlayerID)

  • General
    – the players dont play on the same map nor is any replication needed.
    – the game is turn based. Each player makes a choice → sending an rpc with the choice to the server.
    – if both players made their choice, a result will be calculated on the server and send back to the clients.

I found a function called: GetPlayerControllerFromNetID(UWorld*, FUniqueNetID); which seems to be the func im looking for. However im not sure which UWorld* this function expects to
get this working.

Another idea is to store the UPlayer* onLogin in the list instead of the ID. This way i guess i can call the client which owns the specific APlayerController of this Player?!

Also i´d like to know if my workflow smells or is a way to go and could fit with UE4 architecture.

Thanks for any hints or help