Microsoft Azure PlayFab logo
    • Multiplayer
    • LiveOps
    • Data & Analytics
    • Add-ons
    • For Any Role

      • Engineer
      • Designer
      • Executive
      • Marketer
    • For Any Stage

      • Build
      • Improve
      • Grow
    • For Any Size

      • Solo
      • Indie
      • AAA
  • Runs on PlayFab
  • Pricing
    • Blog
    • Forums
    • Contact us
  • Sign up
  • Sign in
  • Ask a question
  • Spaces
    • PlayStream
    • Feature Requests
    • Add-on Marketplace
    • Bugs
    • API and SDK Questions
    • General Discussion
    • LiveOps
    • Topics
    • Questions
    • Articles
    • Ideas
    • Users
    • Badges
  • Home /
  • General Discussion /
avatar image
Question by Brendan · Oct 07, 2015 at 03:38 AM ·

timer

dragongamestudio
started a topic on Sun, 03 May 2015 at 11:53 PM

hello,

is there any feauture of cloud script to run timer, because i need it to do something like this scenario

  • Player A and Player B created matcmake and played in the room

  • one time player A just close the application/ uninstall it for some reason

  • and in Player B device the game still shown in his list, and player B doesnt know if player A uninstall it and not play it again, and because player B was very kind man, he still wait and hope player A will do his turn.

and what i would make with the cloud script is, to make a schedule to run a function in script to check if the room was not played for over 3 days, then the room will destroy, with objective to give Player B information if Player A hasnt do his turn for 3 days.

maybe playfab have some thing that ive didnt know yet to solve this, or some suggestion to solve this.

thank you :)

Comment

People who like this

0 Show 0
10 |1200 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users

1 Reply

· Add your reply
  • Sort: 
avatar image
Best Answer

Answer by Brendan · Oct 07, 2015 at 03:38 AM

5 Comments
Brendan Vanous said on Sun, 03 May 2015 at 11:59 PM

In general, server-side logic must be triggered by an action taken by a player, a server, or an administrative tool. For your specific scenario, the best way to solve this currently is with a check triggered by the individual player. So in this example, when Player B signs in to check his games, there should be a check to see when the last move was made by the other player. If, after several days of inactivity, Player A is "disqualified", that should be triggered the next time Player B checks on his open games.

Brendan


dragongamestudio said on Mon, 04 May 2015 at 1:44 AM

thank you for your suggestion,

any way what is the javascript version that playfab use for the cloud script?


quirkster said on Mon, 04 May 2015 at 7:49 AM

I just did something similar, so remember to convert timestamps to a common format when you do the comparison. In cloud script, I added a variable to each newly created game...

var startTime = Date.now();

Then, when a player downloaded their list of games, I would compare startTime to a timestamp from the client, but had to match the format first...

//need to add check to remove stale invites
DateTime started = new DateTime(1970, 1, 1).AddTicks(game.Value.startTime * 10000);
if (started.AddDays(7) < TimeCheck.instance.OfficialUTCDateTime) {
//remove stale invite
}


Brendan Vanous said on Mon, 04 May 2015 at 11:52 AM

We use the latest V8 JavaScript engine, so we are fully ECMA-262 compliant.

For operations like this (where you need to check information for multiple games the player is in, in this case), I would recommend putting the key info on all the games into a single master Shared Group Data object, or a set of User Data values which can be queried in one API call. Many separate calls to query for each game would be highly inefficient, and if you have a delay on any return (often due to last-mile issues with the client), this could cause a delay in the game.

Brendan


dragongamestudio said on Mon, 04 May 2015 at 4:21 PM

ok thank you Brandan :)

Comment

People who like this

0 Show 0 · Share
10 |1200 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users

Your answer

Hint: You can notify a user about this post by typing @username

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Navigation

Spaces
  • General Discussion
  • API and SDK Questions
  • Feature Requests
  • PlayStream
  • Bugs
  • Add-on Marketplace
  • LiveOps
  • Follow this Question

    Answers Answers and Comments

    No one has followed this question yet.

    PlayFab

    • Multiplayer
    • LiveOps
    • Data & Analytics
    • Runs on PlayFab
    • Pricing

    Solutions

    • For Any Role

      • Engineer
      • Designer
      • Executive
      • Marketer
    • For Any Stage

      • Build
      • Improve
      • Grow
    • For Any Size

      • Solo
      • Indie
      • AAA

    Engineers

    • Documentation
    • Quickstarts
    • API Reference
    • SDKs
    • Usage Limits

    Resources

    • Forums
    • Contact us
    • Blog
    • Service Health
    • Terms of Service
    • Attribution

    Follow us

    • Facebook
    • Twitter
    • LinkedIn
    • YouTube
    • Sitemap
    • Contact Microsoft
    • Privacy & cookies
    • Terms of use
    • Trademarks
    • Safety & eco
    • About our ads
    • © Microsoft 2020
    • Anonymous
    • Sign in
    • Create
    • Ask a question
    • Create an article
    • Post an idea
    • Spaces
    • PlayStream
    • Feature Requests
    • Add-on Marketplace
    • Bugs
    • API and SDK Questions
    • General Discussion
    • LiveOps
    • Explore
    • Topics
    • Questions
    • Articles
    • Ideas
    • Users
    • Badges