How do I keep the game running even when the game is closed?

For example in (Idle Games) like “Realm Grinder”.
You build 1 farm which generates 1 gold every second.
You close the app and come back later with 1000 more gold.

So the question being, I want to keep the game running, how do I do it?
/As always thank you so much.

You can’t let the game run, but you can check on the internet the actual time when you close the game, and again when you open it, and calculate how much should have been generated in this timespan and add this to the normal saved score.


Thank you, and do you perhaps know how to do it?

use a js event to get the date. Use this
and runtimeScene.getVariables().get("[variablename]").set(n); then access the variable [variablename] to access the current time. Before exiting get the time again and save it.

1 Like