Hey, I’m developing a life simulation game and I wanted a feature where the player would still earn money when the game is closed. Then when the player goes back to the game, a widget displays informing the player on how much money he has earned while being offline. Does this kind of feature work within UE4? If anyone knows how to accomplish this, please let me know. Thanks.
Save the date and time as part of the save file, and once the file is loaded, use the saved time and current time to calculate the elapsed time since last played and calculate money (and whatnot) based on that.
You may use date for that, but the problem is that date is easily hackable.
If your game is a pc game you may consider use APIs like this: API Access for Developers - TimeZoneDB
You will use this to fetch the time when the player closes the game and look at ■■■ again when the player opens it, just like cridia said.
If your game is an Android game, you may either use this or tweak the Android manifest to create a service for it. There might even have some library to do that for you.