- Home /
Count time when the game is not running (mobile device)?
Hello,
I'm working on strategy game concept for mobile devices where you have to wait certain amount of time in order to complete an action - let's say build a building for 12 hours. How to count that time when the game is not running?
More specifically is there another way other that get system date and time and store it in a string? My concern is what if the user moves the device's clock forward? He'll then have that building done immediately. How to prevent that possible cheat?
Thank you.
Answer by RudyTheDev · Feb 24, 2014 at 02:21 PM
You can't really prevent that "cheat" unless you contact an online server. Many games don't even bother with this, because it requires online connectivity. But those that monetize usually have their own monetization/profile server anyway, so that's what they contact.
Answer by edve98 · Feb 24, 2014 at 03:52 PM
I have no idea how to script this, but try to get the time from internet(I think that should be possible). Just a suggestion. However I cant see any other way to do this: In one case you have to have internet, in other player can cheat.
Edit: what about making if last time when application closed time went backwards more than 2 ours or so player would be warned not to cheat and last building would get +2 more ours? I hope you understood what I just said :)
Yes, I get it. That idea with internet time makes sense. :) Second suggestion seems good, but then the question is there a way (some log) to indicate that the time was changed. I'm not aware that there is.