GML Real Time Upgrades




I was wondering if it is possible to use GMS2 to code a real life timer into an app that runs even when the app isnt open. (Such as how an upgrade in the popular game Clash of Clans can take 2+ days in real time).

I cannot think of code I would use to even start this, which is bugging me.

Any sample code or suggestions on how to do this would be greatly appreciated!

Andrew Campbell

Check out my work on the Apple App Store


Simply save the current time when you want the timer to start, and check it again when they come back to the app.

If you didn't know already look up how to save to a ini file in the manual.
And look up date_current_datetime();

I don't think there is a way for Game Maker to really run a timer when the app is not open.
Checking and comparing time stamps is the easiest, but can be cheated by users simply changing their device's time. However I don't think most people would go through that trouble?

Some games check the time on a server to prevent cheating, but that's a lot more work to set up and requires an internet connection.