Announcement

Collapse
No announcement yet.

Anyone tackled push notifications or daily events?

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    Anyone tackled push notifications or daily events?

    Getting close to the point in the project where I will be adding the google play parts of codes. And was wondering if anyone has had success with daily events (ie how to read world time) and also push notifications (or having an event trigger from a push notification) for example having energy restored daily etc?

    #2
    Apparently not...

    Comment


      #3
      AARONACKER - we've implemented daily's and weekly's for our mobile game (iOS and Android) by using PlayFab as our backend and implementing our own cloud script functions. With PlayFab's cloud script, we can create javascript functions on the PlayFab website that interact directly with their API. What we essentially did was create an array of daily challenges and weekly challenges like:

      Code:
      function getRandomDailyChallenges(challengeCount) {
      
          var challenges = [
            {"Title":"Accumulate Power.", "Game":"Huli", "TargetNumber":1000, "Type":"AccumulateHitterAttribute", "Arguments":{"HitterAttribute":"Power"}},
            {"Title":"Accumulate Accuracy.", "Game":"Huli", "TargetNumber":1000, "Type":"AccumulateHitterAttribute", "Arguments":{"HitterAttribute":"Accuracy"}},
            {"Title":"Collect Keni in Rough Take!", "Game":"N/A", "TargetNumber":1, "Type":"CollectKeni", "Arguments":{}},
            {"Title":"Earn experience.", "Game":"Any", "TargetNumber":100, "Type":"EarnExperience", "Arguments":{}}
          ];
      
            shuffle(challenges);
      
            var output = [];      
            for (var i = 0; i < challengeCount; i++) {
                  output[i] = challenges[i];
            }
      
            return output;
      }
      then we created a handler in cloud script that runs on a timed schedule (all set within the PlayFab website), like this:

      Code:
      handlers.updateDailyChallenges = function(args, context) {
      
          var result = server.SetTitleData({
                "Key" : "DailyChallenges", 
                "Value" : JSON.stringify(
                  {
                      "Id": uuidv4(),
                      "XPReward": 50,
                      "KeniReward": 1,
                        "Challenges": getRandomDailyChallenges(3)
                  }
                )
          });
      
          if(result)
          {
              log.info(result);
          }
          else
          {
              log.error(result);
          }
      
      };
      This saves a our challenges as a JSON object within PlayFab's built-in "Title Data" system.

      Once the player logs in, we make a call to this online GUID stored in PlayFab to see if it matches the locally saved daily/weekly GUID. If it does, then the challenges are current on the local device. If not, we request all the new challenge data and then save it again locally. We handle the JSON data coming from PlayFab all within blueprints along with the PlayFab plugin, which contains all the blueprint nodes you need to connect to and call the PlayFab API. There is no out of the box solution for daily/weekly challenges, but this is how we were able to use the technology available to us to make the process of creating this type of feature, much easier than reinventing the entire wheel.

      Comment

      Working...
      X