How do I keep a Timer after the game is closed?

  • I thought about using phone's time but it's easily exploitable and I don't really know how to do that too. Are there any simple and practical way?

    It's, in other words, a countdown that I need to keep track to unlock certain things in the game. Then if the player shutdown the game it won't get lost.

    Thanks!

    Edit:

    I found this great plugin but is this exploitable? Like changing the phone's time?

    rexrainbow

  • Have you tried using web or local storages?

    if you're talking bout keeping the time in accordance to the current time. try making a global variable for time then allow the user to input time. then try to store it in a storage.

    Its like the top ten high scores. but try this video. But instead, use time.

    youtube.com/watch

    I HOPE THIS HELPS!

  • kossglobal

    Sure, machine time could be changed by user.

    You might try get timestamp from a server ( rex_firebase_timer plugin, or rex_parse_timer plugin )

  • Is it reliable? Because using a server that is not yours is unpredictable and could have the service ended in the future, which would ruin the entire game.

    Thanks, rexrainbow .

    I was looking at it and I'm getting the time elapsed since logout. But how should I manage different items (which will be unlocked once their own timer end) from different players?

    Situation:

    Player A

    items 1, 2 ,3

    item 1 : timer X

    item 2 : timer Y

    item 3 : timer Z

    Player B

    items 1, 2 ,3

    item 1 : timer X

    item 2 : timer Y

    item 3 : timer Z

    Is this enough?

    On start of layout

    Define the Player ID to Player A.

    Get Timer "item 1" of user ID: "Player A".

    Blank condition> Start Timer "item 1" of user ID: "Player A" When Disconnected.

    Also, this item would have to be different every time to avoid two items share the same timer. Then, whenever a player earns a new item, it's ID would be Last item ID + 1. Am I following a correct logic regarding to firebase and your plugin?

  • Yes, I though it is correct.

    BTW, firebase was bought by google, but I could not promise it will be reliable, or not.

  • rexrainbow I think it's not a good idea rely on that for something really important to the game then. Aren't there any reliable online source to get the hour? It's just a simple thing you know? Get the time online instead from the phone and then, internally, I manage to know if it's time to unlock the item or not.

  • "reliable" is a cost issue.

    Build your own server will have the best reliable I agree, but it needs a lot of effort, not only write a simple program, running at a host machine.

    Firebase might reliable online in one or two years recently, it is enough for normal case, imo.

    ( Parse will be closed at 2017, fortunately it had released a open source server for us. I had built it on heroku server already. )

  • rexrainbow Thanks for the advice

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • rexrainbow Thanks for the advice <img src="{SMILIES_PATH}/icon_e_smile.gif" alt=":)" title="Smile">

    http://www.timeapi.org/utc/now

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)