question

mynameissimon avatar image
mynameissimon asked

Global Variables

Is there any options for global variables in playfab? I need to store one variable for each player for the matchmaking to check if the player can be "fought". The player should be able to be "fought" when he's both offline and online, like in clash of clan. Or is there a better way than to store a variable for this, like placing the player in a queue or something. I read a little about playstream but can that be used with offline players too?

Matchmaking
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

·
Andy avatar image
Andy answered

While we do support global data (what we call Title Data), it's not what I would recommend in your scenario. You'll never want title data to be updated as a result of a user's actions. You don't want it to grow without bound. And you need to work around it potentially being 15 minutes out of date to account for caching and sharding.

You could, instead, store your "CanBeFought" flag as a tag on the player (https://api.playfab.com/documentation/server/method/AddPlayerTag). That tag is available as part of the player's profile. Then, if you keep a statistic like "wins", you can build a leaderboard that can be retrieved as part of a GetLeaderboard call. In that call, you specify the portions of the profile that you want returned, including the tags. You can then, decide who from the leaderboard is eligble to fight and who isn't.

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.