Bonus offline in mobile game

How do I…

I want to make it so that after logging in to the game, the player can collect e.g. gold coins that were collected when the game was turned off on the phone

What is the expected result

After starting the game, information should appear about how long he was unavailable in the game and how much gold he managed to collect. To make it easier, let the player receive one gold coin for every minute outside the game

What is the actual result

If the player has been out of the game for at least one minute, no message is displayed

You’ll need to store the time the player left the game into local storage. Read in this time when the game starts and work out how many minutes difference.

Here’s a link to a tutorial that covers this..

Will this procedure be resistant to artificial changes in the time or date on the phone, which would make it seem that more time has passed than it actually did?

I don’t think so. But you have to ask yourself, how many people will play the game and fiddle with the device’s time settings just to get more of a bonus?

1 Like

maybe they could check the time via some online api?

What is it and how to do it?

there’s servers like i think, i assume they have an api which u can send a GET request to fetch the time in a particular timezone