Reliable time difference in iOS

I am working on a casual game with some improvement over time, like TinyTower.

But the biggest flaw in TinyTower (and all the respect, its cute game) is that cheating is too simple. The game relies on device time, so when it says β€œit’s done in eight hours,” you just set the clock eight hours ahead, get the thing, and then return it back.

Now, I have to make sure that this is not the way people can win in my game. I had one idea that I can cross-adjust the system time to server time, but I cannot rely on an open connection, since offline playback is an option.

I could also set up a sensor indicating whether the OS time was pessimistic until recently, you will earn an invisible suspiciousness counter. Three of them, and the game will reset, and mark you as a scammer.

The final version was just not to care, let the cheaters become cheats. But if I have a competitive element using hoghscores, etc., I really need this to work.

So ... The question is: Does anyone know a safe, reliable way to determine how much time has passed since the last user opened the application?

+4
source share
3 answers

The application delegate is notified of significant changes in time. You can intercept these calls to applicationSignificantTimeChange: and watch for significant jumps forward or backward.

Of course, this only captures the changes that occur during application operation. You can also save the time of the last run in NSUserDefaults and check it the next time you run for significant jumps back.

+2
source

A few ideas:

1) Ask the app to always keep track of the current time and the time it was last closed. When you see that it goes back, increase the counter in all currently saved games and reject high scores from games where this counter has a fairly high value.

2) When sending high scores, send the current time of the device. If it is ahead of the server time, reject the high score.

3) When starting the game, check the time against the time at which the current version of the game was released. If the user supposedly starts the game before the game is released, please.

+3
source

About all these decisions, what if the user moves to another country, and the time zone changes and goes into the past or the future?

0
source

All Articles