I want to make Idle game for Android. How to make it keep idling when the game is not opened? I think I need a timer that works in the background, but how can I do that?
You’ll need to store the time the game is closed/exited. When it is opened again, retrieve that time and work out what happened during time difference.
#6 could help.
I think what you mean is not possible in Gdevelop.
Since @jack linked a solution, it is obviously possible.
Yeah but that solution might not what he wants. He maybe wanted to create an offline timer which is not possible.
Correct, if the game is not running, a timer cannot run in the background. Most game engines do not give a way to keep running in the background if the app has been closed. (Heck, I think Android and iOS explicitly warn if this happens)
However, this is also true for most (not all) idle games on mobile. They do not constantly run in the background. They track last run time vs current time. A good example of this is Clicker Heroes. Upon load it tracks the last timestamp stored from the last close, and then does all of the calculations as if it had been running that entire time (it’s actually why there’s a CPU spike upon first load, even though it is a “Simple” game). Some games that are multiplayer focus compare to an online timer/record (Tap Heroes 2)