Search Unity

Awarding Time Based Gains for Time While Away from App

Discussion in 'Android' started by EnigmaFactory, May 8, 2014.

  1. EnigmaFactory

    EnigmaFactory

    Joined:
    Dec 10, 2011
    Posts:
    98
    Hey all,

    Hoping to get a little advice. I've searched around a bit, but to be quite honest I'm not exactly sure how to word my query so if you know of resources, a link will suffice. However if you are code jedi of sorts, a more in depth thesis would be greatly appreciated.

    My inquire it, albeit likely poorly worded; Vocabulary lessons are welcome as well:

    What are the best methods when develping for devices to increment variables while the player is out of the application and / or the device is off?

    For example, in games which resources are acquired over time such as Disco Zoo or Jurassic Park Builder when you leave the game and return later the progress has been made (the variables have been incremented in relation to your time away).

    Now of course I realize that the variables are not incrementing in real time unless the developer was doing something crazy like keeping a background service running or something. I know in most cases they are reading the time you have been away from the game and multiplying the incrementation amount by the time away. The way I would imagine doing that would be to save out the current time on the unit then subtract the current time when restarted and multiple the difference by the amount gained in whatever unit. This however means you have to trust the devices time and a simple change of the system time would result in erroneously rewarding gains. My next thought would be to write to a SQL server via PHP when the game exits creating a timestamped record which is compared after the game is restarted. This would rely on the server time and less not be as open to manipulation, but it requires the game to make data connections. Some of these games do of course have logins and cloud saving of data, but I do not believe most are using this implemention.

    So what's the best way to accomplish this to keep the player from easily cheating the system while still giving them the gains the deserve while away of the game?

    Thank you for your feedback in advance!
     
  2. Agent_007

    Agent_007

    Joined:
    Dec 18, 2011
    Posts:
    899
    The only good way to do that is via server. Otherwise people will cheat.