Tracking time outside of game

Get help using Construct 2

Post » Sat Jul 20, 2013 5:40 am

Does anyone know if it's possible to do something like reading the actual current time off the computer/device, in order to track the amount of time that has passed between plays (while the game was off)? For Android devices and maybe desktop browsers (Facebook?) specifically.
I want to do something similar to games like Farmville, where real time has an effect in the game, and things can be simulated to have happened while you were away.
If I can read the real time, then I should be able to save that along with everything else, and when the game is loaded back up later I can compare the current time/date to the last time/date to figure out the time passed.grimwolf2013-07-20 06:32:11
B
6
S
2
Posts: 67
Reputation: 1,136

Post » Sat Jul 20, 2013 8:12 am

There is a plugin for this purpose.
I told my dentist I had trouble with my teeth and asked her to fix it without looking in my mouth..
B
54
S
16
G
8
Posts: 6,160
Reputation: 19,775

Post » Sat Jul 20, 2013 8:29 am

You need to use PHP to track time outside of game per registered user.
B
96
S
34
G
29
Posts: 3,139
Reputation: 28,236

Post » Sat Jul 20, 2013 5:07 pm

Ah, perfect, thank you.grimwolf2013-07-20 17:07:39
B
6
S
2
Posts: 67
Reputation: 1,136

Post » Sat Jul 20, 2013 9:55 pm

Just remember that with a client-sided approach, your users will have full control over the time passed outside of the game.
Make sure to handle negative lengths of time as well, if a user decided to set their time back a year for God knows what reason.

Farmville uses a server to keep track by logging the date-time a user has logged out and comparing that with the date-time they log in next. Then they run calculations to simulate what has happened during that time.
ImageImageImageImage
B
59
S
19
G
51
Posts: 633
Reputation: 30,731


Return to How do I....?

Who is online

Users browsing this forum: Hiddendanger, Lordshiva1948, radhaw, Yahoo [Bot] and 1 guest