playMaker

Author Topic: Check internet time?  (Read 1006 times)

Aaddiction

  • Junior Playmaker
  • **
  • Posts: 85
    • View Profile
Check internet time?
« on: July 24, 2014, 08:06:29 AM »
We have an action to check the device time. However, if we want to make a game where the player collects coins on each for example 1 hour, can we check if that time is passed based on a server time, not device time. This way the user would not be able to cheat by forwarding the time and date on the device.

If we check the time from a global server that would be irrelevant and he'll still have to wait for one hour in order to collect the coins. Is such action even possible?

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 12342
  • Official Playmaker Support
    • View Profile
Re: Check internet time?
« Reply #1 on: August 08, 2014, 12:13:35 PM »
Hi,

 Simply use the current date time using the action "getSystemDateTime", that's enough to be ok with checking elapsed time on a device safely.

so for example, have your game check for the unix time ( 1970/1/1) so that all games use the same base and then you can expect a pretty good synchronization of events if you have a leaderbord or share some common features across users.

If you are concerned about cheating, then you need to go for https access, cause I can sniff your call to your server easily and corrupt the return and cheat this way. So then you would need some more obfuscation and even some data hashing to provide additional layers of security.

the best way could be that you simply pass data to your server and the server simply check the time of the call itself, so your game doesn't need to care about the time locally. Have you experimented with this?
 
Bye,

 Jean

 Bye,

 Jean

Aaddiction

  • Junior Playmaker
  • **
  • Posts: 85
    • View Profile
Re: Check internet time?
« Reply #2 on: August 09, 2014, 04:04:19 AM »

the best way could be that you simply pass data to your server and the server simply check the time of the call itself, so your game doesn't need to care about the time locally. Have you experimented with this?


That's was my question actually. How to check server time with Playmaker, or even how to check a global server time like http://www.worldtimeserver.com/current_time_in_UTC.aspx?

Same action as "getSystemDateTime", but to check online server, not the device - "getServerDateTime". To store the time in a variable and to have a success and fail event.

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 12342
  • Official Playmaker Support
    • View Profile
Re: Check internet time?
« Reply #3 on: August 11, 2014, 06:40:47 AM »
Hi,

 If you do this calculation on the device, then you are open to cheat, that's what I meant, it's your server code that must check it's own computer ( the server OS itself) for the current time, and not your device.

 But if you want still to get the server time, simply create a simple php script that return the time

Code: [Select]
<?php
echo time();

?>



Bye,

 Jean