Hey guys, I am making my first game, and its an idle/incremental/clicker game inspired by Adventure Capitalist. I have a lot of the features in now, just not that pretty yet (not an artist lol). I was wondering how to make it run in the background, like shut the game off and still collect cash. I tried using DateTime.Now and storing it to a variable X, and saving it, then loading the X in seconds and subtracting it from the current DateTime.Now.Second, then multiplying it by my cashPerSecond() method. This didnt work. I got the current datetime.now to work, but i could never store the date i shut down the game to a variable and have it load at start.
Have you tried using PlayerPrefs? This would allow you to store the int, load it and then calculate the time elapsed between playthroughs.
I was using Serialization for better security, but for some reason it wasnt storing the DateTime.Now when the game was destroyed.
Storing the time isn’t enough. All they have to do is change the time on their computer. You either need to do your calculations on a server, or at least get the time from one.
nvm got it.
Yeah I plan on doing that in the future. I am working on getting the minimum viable product done, with the core features, adding in some art, expanding more features, a LOT of balance changes and probably work on servers if I want to take this game to market. This is my first game but I think I have a good idea, and a semi-popular genre.
Says everyone ever.
Definitely not for your first game.
Honestly, take a little step back and be realistic. Creating a video game is not as simple as waving a wand and unless mummy and daddy are paying for these servers they can be very expensive. Feel free to gather the time from someone elses server but I highly recommend you do most things offline.
Just focus on making an enjoyable game with some VERY simple anti-cheating method. (Time checking, click limiting etc)
Cheaters find a way.
EDIT:
I would like to recommend a simple platform like Kongregate. They have quite a big audience for idle games.