question

will-3 avatar image
will-3 asked

PlayFabMultiplayerAgentAPI.GetInitialPlayers is empty - What do I have to do for it to have the correct information?,PlayFabMultiplayerAgentAPI.GetInitialPlayers() is empty

I want to be able to authenticate the players that are joining the server. After making a server build and running it inside Docker calling PlayFabMultiplayerAgentAPI.GetInitialPlayers() returns null. It says "InitialPlayers - This value is set to the list of members in the match. The list of players can be read in the game by using the GSDK."

Am I missing something?

,
10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

1 Answer

·
Sarah Zhang avatar image
Sarah Zhang answered

Please check this section Giving PlayFab information about your game server, as this section mentioned, you need to call the following method first in your server when new players connect to add them to the player list. There are gsdkSamples on PlayFab official GitHub page can be the references too.

static void OnPlayerConnected()
{
    // When a new player connects, you can let PlayFab know by adding it to the vector of players and calling updateConnectedPlayers
    players.Add(new ConnectedPlayer("player_tag"));
    GameserverSDK.UpdateConnectedPlayers(players);
}

7 comments
10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

will-3 avatar image will-3 commented ·

Isn't that just telling Playfab servers which players are connected though?

I'm want my game server to boot up and know the list of players that's going to connect. Once all the players have connected the game server will start the game. The game server at the moment doens't know the players that are going to join and so doesn't know when to begin the round.

Does that make sense?

0 Likes 0 ·
Sarah Zhang avatar image Sarah Zhang will-3 commented ·

Could you please tell us how do you allocate the server, do you use PlayFab MatchMaking?

0 Likes 0 ·
will-3 avatar image will-3 Sarah Zhang commented ·

Yeah, we use the PlayFab Matchmaking service. Playfab boots up the server and passes out the details to the clients.

0 Likes 0 ·
Show more comments

Write an Answer

Hint: Notify or tag a user in this post by typing @username.

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.