question

Jeff Posey avatar image
Jeff Posey asked

Player Segments based on game timers expiring

Hello,

I am trying to make Player Segments for the purpose of Push Notifications that will need to be based on timers from my game. The timers are delays until you can receive a reward. Currently I only store these DateTime values in PlayerPrefs. I can upload them to PlayFab's Player Data (Title) but I don't think Player Segments can be filtered from Player Data, only Statistics, right?

An example usage would be like in Harry Potter: Wizards Unite. If you start brewing a potion, you will receive a Push Notification when it has finished.

How would I go about implementing this?

Thanks!

Push Notifications
1 comment
10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Jeff Posey avatar image Jeff Posey commented ·

I should note that the client is running when the timers are started. They perform actions in the game to get the reward, which starts the timer that then needs to expire before they can get the reward again. So at this point I can trigger something from the client to tell PlayFab about it. Be it a Statistic, Player Data, or I guess if necessary, calling a Cloud Script?

0 Likes 0 ·

1 Answer

·
Sarah Zhang avatar image
Sarah Zhang answered

>> I can upload them to PlayFab's Player Data (Title) but I don't think Player Segments can be filtered from Player Data, only Statistics, right?

No, Player segments can’t be filtered from Player data, it can be filtered from Statistics. It also can be filtered from Players Tag or Virtual currency balance, you can use them for your job if you want.

>> How would I go about implementing this?

If you don’t have too many types of “potion”. You can try to convert this question to a recharging question that has a known solution from PlayFab. There are some links can navigate to PlayFab sample repository on the PlayFab recipes and samples page. Under this title Monetization, there is a sample Regenerating Currency Mechanic which shows A play-limiting mechanic (similar to Candy Crush lives), that slowly refills to a maximum over time. You can definite a type of VC to hold the progress of timers expiring and not need to depend on a true client timer. Then you can filter the player segments by Virtual currency balance. You can use [+ Add group] button on [Edit Segment] page to add “or” conditions to let several types of VC filter one player segment.

If you refer to this sample, you need to call CloudScript. You can click the sample link to navigate to the repository for more info, it lists the detailed ingredients and preparation. This solution is suitable for a high need for the anti-cheating and a small number of potion types. If you completely use a PlayFab back-end recharging solution, you will be limited by PlayFab limits. You can navigate to [Game Manager]->[Title Settings]->[Limits] to check the limits of VC, segments, etc.

Besides, If you don’t have a high need for anti-cheating, locally pushing timers expiring notifications will be a workaround. If you plan to use a local timer, it doesn’t make much sense to let a back-end to push notifications, you can push notification locally directly. If so, PlayFab features won’t be used in this process, you can directly search “Unity locally push notifications” in search engines for more info.

1 comment
10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Jeff Posey avatar image Jeff Posey commented ·

Fantastic answer, thank you! I had failed to find the ability to do locally scheduled notifications until this. They are working great for this purpose. I do not need strong anti-cheating for it.

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.