question

Anh Le avatar image
Anh Le asked

Scheduled operation events

Hi,

I'm new to Playfab. I searched the documents but cannot find anyone for scheduled operation events. Ex:

From this Tuesday 5AM to this Saturday 7PM, the player who purchase 500 gems will get item A, 1000 gems will get item B and 1500 gems will get item C.

Or:

From 0 AM Today until 0 AM next Monday, if the player reach top 1 in the 1v1 leaderboard, he will get item A,B,C, the second up to the 10th position will get item D,E,F and the 11th up to 100th position will get X,Y,Z items.

Reference: http://idleheroes.wikia.com/wiki/Events

game managerscheduled 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

We'll be providing a more simplified event management system in a future update. For right now, you would drive this via a Cloud Script which is triggered by a Scheduled Task that you trigger on an automated schedule.

So for example, since you want to start and stop events on varying hourly marks, you could set the task to run once an hour. When that occurs, the script would check (via Title Data, or just hard-coded as static data in the script, to save time) what events are starting/stopping on that hour mark, if any, and what changed are to be made to the Title Data configurations for the game.

For the purchases example you provide, it would require a change to the game catalog (specifically, the stores) to drive that automatically. Right now, what you would do is set the items that are given as "bonuses" on purchase and have a Cloud Script you trigger via a PlayStream Action (with the Rule being when there's a player_inventory_item_added event, generally speaking). The Action calls a Script, which checks what items (if any) are to be added, and it grants the item(s).

For the leaderboard example, are you talking about giving the prizes to every person who reaches #1 (for example), or just what prizes are distributed on a Leaderboard reset (so, only one person gets the first place prize)? If it's the latter, you can just drive the prize based upon the player_ranked_on_leaderboard_version event, as described above. If you mean the former (sending the prize to every person who gets to #1, etc.), that's a bit trickier, since a statistic update (title_statistic_version_changed) triggers re-evaluation of the leaderboard, but that can take a second or two to complete. So if you were to trigger an action based upon that event, you might not have the correct ordering of the players, based upon that statistic being set. If that's the intent, I'd have to recommend that you use a Custom Game Server, so that you can keep an in-memory state of the top players in the leaderboard which you periodically sync with the service, and have players report the stats to the server. The server would do all the validity/cheat checks on the data sent by the client, report it to the service, and compare the score to the current leaderboard state and check positions.

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.

Anh Le avatar image Anh Le commented ·

Hi @Brendan ,

For the leaderboard example, I'm talking about the 1st prize to only one person who reaches #1, the second prize to #2 to #10, and the third prize to #11 to #100. The leaderboard won't be reset

0 Likes 0 ·
brendan avatar image brendan Anh Le commented ·

We can automatically distribute prizes to your players via our Prize Table logic if you use resetting leaderboards. If not, you would need to do the player prize rewards yourself, using a custom script that you run on your own server. Rewarding a very small number of players (say, three) in a Scheduled Task would be fine, but Cloud Script is designed for relatively lightweight, short-lived logic, so rewarding 100 players wouldn't be an option in Cloud Script.

0 Likes 0 ·
Anh Le avatar image Anh Le brendan commented ·

Yes, we plan to reward hundred thousands of players every day.

0 Likes 0 ·
Show more comments

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.