Hello, I’m trying to create something that requires knowing the time. I would prefer to use the real-world current date & time. I would use System.DateTime.Now, however, if I’m correct that would allow the user to simply change their data and time to provide my code with incorrect results how do I get around this?
You can only get around this one way: operate the game entirely on your own server that you control and stream the result to the client.
Every other way is trivially bypassable by even a slightly-determined user.
If you want this feature, just access System.DateTime and be done with it.
If you’re concerned about the user ‘hacking your save files,’ or ‘cheating in your game,’ just don’t be. There’s nothing you can do about it. Nothing is secure, it is not your computer, it is the user’s computer. If it must be secure, store it on your own server and have the user connect to download it.
Anything else is a waste of your time and the only person you’re going to inconvenience is yourself when you’re debugging the game and you have savegame errors. Work on your game instead.
Remember, it only takes one 12-year-old in Finland to write a script to read/write your game files and everybody else can now use that script. Read about Cheat Engine to see more ways you cannot possibly control this.
Thanks for your help.