Search Unity

Time cheating prevention in offline mode (iOS + Android)

Discussion in 'Assets and Asset Store' started by Vavius, Jul 13, 2014.

  1. guzzo

    guzzo

    Joined:
    Feb 20, 2014
    Posts:
    79
    Last edited: Apr 5, 2017
  2. damelin2

    damelin2

    Joined:
    Jan 8, 2013
    Posts:
    19
    Would it be possible that you release an update with code open (instead of having it inside the libraries?)

    We have found a few issues, and you don't seem to have time to do fixes as your plugin hasn't been updated in a while. We could fix them ourselves. This works most of the time, but it fails at other time, even if users don't change their OS clock..
     
    ashwinFEC likes this.
  3. damelin2

    damelin2

    Joined:
    Jan 8, 2013
    Posts:
    19
    I've found a bug in the UnbiasedTime.cs. And its affecting even the non-cheater users. NtpImpl() is getting current time from pool.ntp.org. But, the request response (from the socket) is not validated. Sometime the response is just "empty" and no offset can be computed from this.

    So, before assigning ntpTimeOffset, we must first validate that milliseconds > 0L, otherwise the network time will be 1900,1,1 which will cause a Huge time offset.
     
  4. PridefulDad

    PridefulDad

    Joined:
    Oct 9, 2017
    Posts:
    3
    Can someone please confirm that this will work on Speed up emulators and on Game Guardian speed hacks? The main problem about server checks is if it is actually worth forcing people to have a connection and the money you spend on keeping the servers running vs the money you potentially lose from not selling boosters.

    Does anyone have any stats on that? Anyone ever transitioned from offline game to partial online?
     
  5. tessellation

    tessellation

    Joined:
    Aug 11, 2015
    Posts:
    390
    I think there might be an issue with using NTP server time in UnbiasedTime_UnityPro.txt Here's the scenario:
    1. Game is connect to the internet, computes the offset from NTP time as, say 1 day ahead.
    2. App goes to the background and the user switches to airplane mode during this time (no internet).
    3. User resumes the app, NTP time acquisition fails, timeOffset is now used.

    I could be wrong, but I think there's an issue when switching between ntpTimeOffset and timeOffset that could cause the Now() method to return a time that jumps significantly.

    For this reason, I'm kind of thinking that the NTP method isn't really that useful for things like cooldown timers or energy mechanics. Looking for thoughts and comments from other devs. Thanks!