question

szilagyimatyas444 avatar image
szilagyimatyas444 asked

How do I actually use the Initial Players on a Server?

I got all the Initial Players but I see that they are only Entities, which I cannot really use for anything. The PlayFabServerAPI does not seem to have any function that use Entities. I have tried using PlayFabProfilesAPI.GetProfiles to get the PlayFabId but to use this function I need to be logged in which will not work on a server. I might be able to use it to allow specific player onto the server when they authenticate but I am not sure of that yet.

I would really like to use it to get the profiles of the players that will be on the server so I can later send out that info to the other players and to know that this info will not change when someone reconnects until the server is initialized.

Account ManagementCustom Game Servers
4 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.

Rick Chen avatar image Rick Chen ♦ commented ·

As far as I know, the initial players come from clients' session config when they connect to the server. You can set the playerid to be PlayFabId on client side.

0 Likes 0 ·
szilagyimatyas444 avatar image szilagyimatyas444 Rick Chen ♦ commented ·

Interesting, so what I have is the PlayFab Matchmaking creating a server session and when that server boots up it has a list of initial players and those seem to always be the EntityIds. Can you clarify what you mean by the client session config? I need this to work before they ever even connect to the server so I can load and cache their profiles.

0 Likes 0 ·
szilagyimatyas444 avatar image szilagyimatyas444 commented ·

Using the PlayFabAuthenticationAPI.GetEntityToken allows the server to use the ProfilesAPI, and GetProfiles then returns the PlayFabIds from the entities

0 Likes 0 ·
Infer Wang avatar image Infer Wang szilagyimatyas444 commented ·

6696-image.png Yes, you can put the player's entity in request body to get it after calling Authentication - Get Entity Token - REST API (PlayFab Authentication) | Microsoft Learn

0 Likes 0 ·
image.png (130.4 KiB)

1 Answer

·
Dimitris-Ilias Gkanatsios avatar image
Dimitris-Ilias Gkanatsios answered

I assume you mean the parameter here: https://learn.microsoft.com/en-us/rest/api/playfab/multiplayer/multiplayer-server/request-multiplayer-server?view=playfab-rest

InitialPlayers is used to perform a simple validation on the player IDs that will connect to the server when it turns to Active.

10 |1200

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

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.