i am making an idle clicker game and i wanted to make a offline progress but i dont know how make it

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By jvnq1992

(i am using gdscript)

:bust_in_silhouette: Reply From: zhyrin

By offline progress do you mean you close the game at a specific state and if you come back 1 hour later you expect the game to have the same state + what would have happened in that one hour?
If that’s the case:

  • In the save file you store at what time the game was saved
  • When you load a game you check current time and compare with when the game was saved
  • You simulate every object in the game that gives progresdsion as if they worked for the time difference
  • Once the state has been updated by the calculated difference, you complete loading the game

So how i compare the saved time and the current time? I dont know

jvnq1992 | 2023-02-12 10:33

I dont know how simulate every object and also i dont know how to compare also too i dont know how calculate the difference

jvnq1992 | 2023-02-12 12:25

Use Time to get current time.
If you use unix time, it’s as simple as subtracting the saved time from the current.

Lets say you can purchase a cursor object that clicks the clickable every two seconds.
In your save file I assume you would store how many cursor objects the player bought.
Once you have the time difference you check how many times two seconds fit into it, and multiply the result by the number of purchased cursors.

zhyrin | 2023-02-15 20:30

1 Like