The game I'm currently working on runs in real time, similarly to Animal Crossing. With such a clock, though, problems arise. I need to program a realistic in-game clock that runs independently of the computer's clock. It will reference the computer's clock at the game's bootup to use as a starting point, but from then it needs to run accurately and independently. In Animal Crossing it wasn't a problem because the game and system clocks couldn't be altered during gameplay, but such things are possible and simple to do on a computer. If that is impossible, then I'll need a way to crash the game when the clock is changed during gameplay.
I'm using MMF2, so I know about the Crasher object. I would need to program the crash accurately.
Check the clock and compare it to a global value.
-If the clock is less than the value of the value, Crash (Prevents going back in time)
-If clock is 2 minutes or more ahead of the global value, Crash (prevents large leaps foreward in time)
-Always set the global value to the Time (none of this will work unless you do this last)
-start if frame, set global value to the time (otherwise it will crash)
You should put a recommendation in there to have people sync their clocks online if they can, because if their computers are anything like all of mine, the clock gets WAY off real fast.
EDIT: Oh, and I wouldn't make it crash... you should make a "NO-NO... You naughty pooface." frame, or at least warn them, because seemingly random crashing may make them mad or distrusting of your software.
couldnt you just make a clock?
3 counters (secs, mins, hrs) and set them to run off each other in the speed you want for example...
every 1 sec + 1 to secs, if secs = 60 add 1 to mins, if mins = 60 set hrs to 1 (remembering to set the counters to zero when they reach their peak.
and just set the counters to match the real time (i dont know how this is done though)
if you only refrence the real clock at launch then it wont matter if people mess with the real clock during runtime.
Then time wouldn't progress while you weren't playing... and I've found the system of adding 1 to a counter every set amount of time to be unreliable, especially if you have processor intensive tasks running in your game or the background.
Assault Andy Administrator
I make other people create vaporware
30th May, 2008 at 01:53:21 -
A clock that runs independently of the computer's clock is quite simple to achieve. I assume you want different time values, eg. 1 Real Minute = 1 Game Hour or something like that? So 24 Real minutes = 1 Game Day. (Many games use this system.)
If that is the case you simply need to put in the Date/Time object, with a Clock. Then:
New Minute: Add 1 to hour-counter
In this example 1 real minute = 1 game hour. You could also use the New Second condition and have each real second as 1 Game Minute. Then you simply build a system off that, eg Counter = 60, set counter to 0, add 1 to hour-counter.
You get the idea.
I don't see why you would need an independent clock if the game was in actual real-time, as it would always be the same as the computer's clock.
The only way I can see this working is to either have an independent app that is always running, always counting. The game then takes the value from that as the world clock. But it would be too easy to cheat (just close the app?).
Online sync would pretty much be your only option but that's already been poo-pooed.
I agree, who cares if they cheat? And if you don't want them to mess with their clock during gameplay, you could run it fullscreen and make it ALWAYS in focus... Heh, MWAHAHA! Those are handy for "I'm taking over your computer" apps... Maybe you could make it sync online if it can, and if it can't then just make the game yell very loudly at them if they change the system clock.
My actual plan was to make it run in actual real time, so that 1 minute in game is 1 minute real life, so that there are 24 hours in a day with 60 minute hours and 60 second minutes. I plan on making the game change itself when time is skipped.
For example: Person moves time ahead one hour during gameplay, and goes into a house. There's nothing inside for some reason. When they leave, the whole world is sepia toned, no one exists, and nothing moves. You then have to find a tent with a spirit of time or something, and ask for the world to be restored. He then requests that you turn time to the way it should be, and when you do, the world restores itself.
The reason that the game needs to punish players for cheating is because it is similar to Animal Crossing in that you can't cheat real life, so you shouldn't be able to cheat fake real life.
That's right, its a life sim. But its going to be different than Animal Crossing.