question

ya-ralla avatar image
ya-ralla asked

Getting global stats for events

Hello,

I am trying to make an event in my game using global stats, in this case I want to give some bonus for total items looted by all players. To track that I made a custom event every time someone loot an item. And I am trying to store the total events between two dates on the title data to acces it ingame.

I could do it manually just by checking the event history but could be possible to make a scheduled task to update title data value every 30 minutes or one hour during a couple of days by executing a cloud script function? that function should get the total event created in that time period.

Thank you.

CloudScriptTitle Datascheduled tasks
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

·
brendan avatar image
brendan answered

Sorry, but a global value that is updated by all players is not supported currently. PlayFab primarily supports two data types:

1. Title- and Publisher-level data: This is data that is sharded and cached, so that millions of players can access it simultaneously. As a consequence, it takes time for all caches to be updated, meaning that you can't have high consistency (player actions cannot update this data type).

2. User and Shared Group Data: Really a single data type, this is data which is highly consistent, but as a result can only be shared by a small number of players, since requests to read or update the data are operating on a single data table row.

We will be providing an updated data service later this quarter, which will provide for data that can be updated across larger player groups (particularly for guilds/teams/clans).

As to a single scheduled task, that's really not going to work. Yes, you could use a global value in the script as your aggregation value, and have the script run across all users in the All Players segment, adding their values to that global value, but there wouldn't be any way to know when you're done (the last player). And writing to Title Data for every instance of running that script on your players isn't going to work, as that would exceed the limits in our service, resulting in throttling. What I would recommend for now is using a Redit Int for tracking this.

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.