question

Jeff King avatar image
Jeff King asked

Global (General Purpose) Data

Is there no way to store global data for anyone to read/write?

We are trying to migrate from Gamesparks to Playfab. We have 2 functions we need.

1) A way to give player items. We've done this in the past by storing their device ID to a global table and the items they should get into that table. The game reads that table to see if their device id exists and gives them the items.

2) A referral system. Basically, we store a global code with the referrer device id and do an update when the referral gets used to check when the referrer should get their gold. I did see another referral system posted here, but it seems way over complicated. If I just had a simple global data, I could do this much easier.

Let me know if this is possible somehow.

data
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

>> Is there no way to store global data for anyone to read/write?

Currently, PlayFab doesn’t provide such “global data” features natively. We would suggest using the external cache, such as Redis, to implement the “global data” feature. Besides, PlayFab supports using Azure Functions to run cloud code now that gives you the ability to leverage any number of Azure features such as CosmosDB.

>> A way to give player items...

I’m not so familiar with GameSparks. Could you please give the exact application scenarios? Do you mean that if the player has linked the specific device Id to his account, he could be granted items?

If so, PlayFab provides multiple APIs that can be used to link the device Id or other platform’s account Id to the player’s accounts. They are listed on this page – Account Management. Then you can use PlayFab CloudScript to access the Server API sets, for example, server.GetPlayerCombinedInfo, to get the account info of the corresponding player. You can use the obtained account information for data verification, then grant the items via server.GrantItemsToUser. In the PlayFab CloudScript or Azure Functions, you can access entire server API sets. Players can use client API ExecuteCloudScript or ExecuteFunction to interact with the corresponding functions.

>> A referral system...

The sample mentioned in this thread -- Creating a player referral system is still the recommended solution. Or you can refer to the answer of the first questions to achieve your own referral system using the external cache.

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.