Tracking time outside of game

  • Does anyone know if it's possible to do something like reading the actual current time off the computer/device, in order to track the amount of time that has passed between plays (while the game was off)? For Android devices and maybe desktop browsers (Facebook?) specifically.

    I want to do something similar to games like Farmville, where real time has an effect in the game, and things can be simulated to have happened while you were away.

    If I can read the real time, then I should be able to save that along with everything else, and when the game is loaded back up later I can compare the current time/date to the last time/date to figure out the time passed.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • There is a plugin for this purpose.

  • You need to use PHP to track time outside of game per registered user.

  • Ah, perfect, thank you.

  • Just remember that with a client-sided approach, your users will have full control over the time passed outside of the game.

    Make sure to handle negative lengths of time as well, if a user decided to set their time back a year for God knows what reason.

    Farmville uses a server to keep track by logging the date-time a user has logged out and comparing that with the date-time they log in next. Then they run calculations to simulate what has happened during that time.

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