question

Bijian Wu avatar image
Bijian Wu asked

Getting player title data from server

I am using Playfab multiplayer server and playfab matchmaking system.

when game server starts, my server needs to get title data about which weapons each player isusing for the game

How to get player's title data in server side? can you share some code snippet for Cloud scripts? Also C# version of it please

multiplayer
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

·
Citrus Yan avatar image
Citrus Yan answered

The following information will be passed to the game server allocated by the Matchmaking system:

  • SessionId - The SessionId for the server will be equal to the MatchId for the match.
  • 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.
  • PreferredRegions - This field is set to the RegionPreferences field from the match. The game server service will choose an appropriate region for the server from this list.

They can be retrieved using the GSDK, more details can be found here: https://docs.microsoft.com/en-us/gaming/playfab/features/multiplayer/servers/integrating-game-servers-with-gsdk#csharp-4

InitialPlayers contains a list of members’ title_player_account_id in the match, which looks like the following:

"initialPlayers":[

"title_player_account!FC150DAFC86B9C13",

"title_player_account!C59F8D70E9FDC89C"

]

You can use such info to retrieve the player’s title data. Assuming that you need to use the GetUserData API to retrieve them, which uses the PlayFabId (master_player_account_id), for that you’d need to use GetProfiles to retrieve each player’s PlayFabId, they’re in Profiles[x].Lineage.MasterPlayerAccountId: Account Management - Get Profiles (PlayFab Profiles) | Microsoft Docs

The flow above may seems a little bit complex, to simplify this, you can just have the players specify the weapons they’re about to use in the “Attributes” property when creating tickets, and on the server side, use GetMatch with the aforementioned SessionId to retrieve such info.

2 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.

Bijian Wu avatar image Bijian Wu commented ·

When i tried to call GetMatch on server I get the following error, it says server is not logged in.

I am using Unity, do you know which namespace is GetMatch under when called on server? I believe server and client uses Different GetMtach under different namespace?

0 Likes 0 ·
Citrus Yan avatar image Citrus Yan Bijian Wu commented ·

It seems that you created a separate thread regarding this issue, one of our engineers will work with you in that channel.

0 Likes 0 ·

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.