How do prevent game Date and Time cheating?

From the Asset Store
Control your space ship in a weird space-time environment and destroy as many enemies as you can!
  • Hello colleagues,

    Is there a way to prevent game Date and Time cheating? If time is taken from the phone, over Construct built-in addons, then game time can be cheated by simply changing phone settings, which should be avoided especially if the game depends on time (life returning, charging energy, arrival of new gifts, etc.).

    I guess then Date and Time should be taken from some independent server, over the stable Internet connection needed to play the game.

    How can I do that, for construct 3?

  • You can request the time from the internet, I believe there are many services for that. Here is an example:

  • NTP: Network time protocol

    ntppool.org

    You can request the current time and date.

  • Thank you dop2000 and klabundee very much for help.

    I tried dop2000 example and this solution worked perfectly.

    Now I have discovered a new problem. After installing VPN and after changing my IP address (after connecting to different country and time zone), and time from server adjusted to the new zone too.

    New question is how to prevent cheating over VPN? Maybe the solution are in comparing the data saved on the device and the data from the time server, or it can be done in some other way, what do you think?

  • Thank you dop2000 and klabundee very much for help.

    I tried dop2000 example and this solution worked perfectly.

    Now I have discovered a new problem. After installing VPN and after changing my IP address (after connecting to different country and time zone), and time from server adjusted to the new zone too.

    New question is how to prevent cheating over VPN? Maybe the solution are in comparing the data saved on the device and the data from the time server, or it can be done in some other way, what do you think?

    If you only need to compare date/time, you could use a fixed time zone.

    For example:

    worldtimeapi.org/api/timezone/Europe/London.txt

    So, doens't matter if the device changes the time zone, the "amount of time" will be always correct.

  • The UTC value is Universal time, with zero offset.

  • Thank you klabundee and blackhornet, if I understood correctly, the solution is to compare everything according to UTC time, as a reference point?

    For example, if the player lives in different UTC time zone, and If the player spent the entire energy, energy charging time should be calculated in according to the UTC time, regardless of the player's time zone?

    Does this mean that all this data required for comparison should be stored on an external server, for every player?

  • Thank you klabundee and blackhornet, if I understood correctly, the solution is to compare everything according to UTC time, as a reference point?

    For example, if the player lives in different UTC time zone, and If the player spent the entire energy, energy charging time should be calculated in according to the UTC time, regardless of the player's time zone?

    Does this mean that all this data required for comparison should be stored on an external server, for every player?

    Probably the best way is comparing suspended time.

    Set an action Browser->On Suspended ->Store the Date/Time from an external server;

    Set an action Browser->On Resumed ->Get the current Date/Time from an external server from same time zone as On Suspended and compare if the time is different;

    Is it different? OK so now you need to perfomance the life return, new gifts, etc.. based on this amount of time between on suspended and on resumed.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • This seems like a good solution klabundee. Does that mean the Date/Time data would be then stored on the device memory instead on the server?

    I guess it's very hard to hack a phone to change game data? Purely to cover all possibilities.

  • This seems like a good solution klabundee. Does that mean the Date/Time data would be then stored on the device memory instead on the server?

    I guess it's very hard to hack a phone to change game data? Purely to cover all possibilities.

    You will have to store the Date/Time when the device goes suspended, on memory or storage.

    It is not impossible to hack.. the data can be changed.. even fake the URL api and send you a fake Date/Time.. but it sounds like a big effort to hack it..

  • Then it is a good solution. Let’s say someone manages to hack game data on the device, I believe that would be a very small number of players compared to the total number playing games, so I guess it is okay.

    Thanks again a lot for the help.

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