With UE4, when connecting to a playfab matchmaking server, how would I obtain data about the players that are expected to join? So that I could place them on the right teams, and retrieve their account data?
With UE4, when connecting to a playfab matchmaking server, how would I obtain data about the players that are expected to join? So that I could place them on the right teams, and retrieve their account data?
Are you using PlayFab Matchmaking along with PlayFab Mutiplayer Servers? In that case, if you integrated Matchmaking with PlayFab Multiplayer Servers, a server instance will spin up with the following information passed into it when a match is found:
The IntialPlayers field represents a list of players in a match and is automatically passed to the server instance, you can use GameserverSDK.GetInitialPlayers() to get such info and therefore use that to obtain data about the players.
Or, if you didn’t integrate Matchmaking with PlayFab Multiplayer Servers and manually calls RequestMultiplayerServer to request servers instead, you may specify the InitialPlayer field in the body so that it can be passed to the game server for later use.
Or, if you doesn’t use PlayFab Multiplayer Servers but uses external server hosting instead, you may need to manually pass the matched players’ info to the server for later use.
Update: I've found a solution and I will update in general discussion shortly
For the SessionID it mentioned it will be equal to the MatchID for the match. I am on UE4 as well and I'm wondering how to specifically make a call to get the MatchID/SessionID when the server starts up. I can certainly have the first players that join RPC that information to the server but I'd prefer a more server-oriented logic.
I'm using both Playfab Matchmaking and the PlayFab Multiplayer Servers.
In the legacy server environment this information was passed to the command line which was actually very useful, is there anyway to add the SessionID to the command line for the new servers?
When "Integrating with PlayFab Multiplayer Servers" is enabled, SessionId will be passed to the server:
You can use GSDK to retrieve it:
BTW, you can create a new thread next time in case sometimes we may miss answered questions.
The way we did it was to keep all persistent player data in our game instance (since it acts like a singleton)..so things like username, level, clothing equipped, etc are stored here in a struct...then we can pass this struct up to the server within the PlayerState (via RPC). You can also use the PlayerState to hold non-persistent variables for the player such as assigned team, and score, or whatever you want. These all need to be done via RPC.
Also, keep in mind the Game Mode is only accessible to the dedicated server (or listen server), and the Game State is used for the main flow of the game or things like assigning teams to each player state. The Game State has an array of Player States you can access.
3 People are following this question.