The Daily Click ::. Forums ::. Klik Coding Help ::. In-game real time clocks
 

Post Reply  Post Oekaki 
 

Posted By Message

Jon Lambert

Administrator
Vaporware Master

Registered
  19/12/2004
Points
  8235

VIP MemberWii OwnerTDC Chat Super UserI am an April FoolSSBB 3265-4741-0937ACCF 3051-1173-8012360 Owner
29th May, 2008 at 18:55:22 -

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.

 
Sandwich Time!Whoo!

JoyCheck & KeyCheck Widgets
For easy implementation of customizable joystick and keyboard controls.
http://www.create-games.com/download.asp?id=8364

Ricky

loves Left For Dead 2

Registered
  28/12/2006
Points
  4175

Has Donated, Thank You!Game of the Week WinnerVIP MemberWii OwnerHero of TimeGOTM Winner! - November 2009I am an April Fool
29th May, 2008 at 19:07:29 -

I would crash it.

3 events
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)

Also
-start if frame, set global value to the time (otherwise it will crash)


 
-

OMC

What a goofball

Registered
  21/05/2007
Points
  3516

KlikCast Musician! Guy with a HatSomewhat CrazyARGH SignLikes TDCHas Donated, Thank You!Retired Admin
29th May, 2008 at 19:08:31 -

Well, the first thing that pops into mind is syncing with an online source... but that would make the game require an internet connection... which isn't always a good thing.

 

  		
  		

Jon Lambert

Administrator
Vaporware Master

Registered
  19/12/2004
Points
  8235

VIP MemberWii OwnerTDC Chat Super UserI am an April FoolSSBB 3265-4741-0937ACCF 3051-1173-8012360 Owner
29th May, 2008 at 19:14:46 -

Clayton: I thought of the online sync option, but disregarded it for the same reasons.

-Ricky-: That helps me with the crashing. That is what I will use unless I find a way to program a custom clock for the game. Thanks.

 
Sandwich Time!Whoo!

JoyCheck & KeyCheck Widgets
For easy implementation of customizable joystick and keyboard controls.
http://www.create-games.com/download.asp?id=8364

OMC

What a goofball

Registered
  21/05/2007
Points
  3516

KlikCast Musician! Guy with a HatSomewhat CrazyARGH SignLikes TDCHas Donated, Thank You!Retired Admin
29th May, 2008 at 19:28:18 -

How in the world did Ricky's response get in there before mine? I wouldn't have posted if I had known it was there...

 

  		
  		

Ricky

loves Left For Dead 2

Registered
  28/12/2006
Points
  4175

Has Donated, Thank You!Game of the Week WinnerVIP MemberWii OwnerHero of TimeGOTM Winner! - November 2009I am an April Fool
29th May, 2008 at 19:32:38 -

Yikes, I found a serious bug in what i gave you. In its current state, it will always crash at 12:00 A.M.

Fix it by putting this event in front of all the others:
-If TIME=0 set global value to 0

My formula for time is (hours of( "Date & Time" )*60*60)+(minutes of( "Date & Time" )*60)+seconds of( "Date & Time" )

 
-

OMC

What a goofball

Registered
  21/05/2007
Points
  3516

KlikCast Musician! Guy with a HatSomewhat CrazyARGH SignLikes TDCHas Donated, Thank You!Retired Admin
29th May, 2008 at 19:52:33 -

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.

Image Edited by the Author.

 

  		
  		

Windybeard Games



Registered
  14/04/2005
Points
  219

You've Been Circy'd!VIP MemberCandy Cane
29th May, 2008 at 20:47:08 -

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.

 
n/a

OMC

What a goofball

Registered
  21/05/2007
Points
  3516

KlikCast Musician! Guy with a HatSomewhat CrazyARGH SignLikes TDCHas Donated, Thank You!Retired Admin
29th May, 2008 at 21:41:19 -

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

Registered
  29/07/2002
Points
  5686

Game of the Week WinnerVIP Member360 OwnerGOTM JUNE - 2009 - WINNER!GOTM FEB - 2010 - WINNER!	I donated an open source project
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.

 
Creator of Faerie Solitaire:
http://www.create-games.com/download.asp?id=7792
Also creator of ZDay20 and Dungeon Dash.
http://www.Jigxor.com
http://twitter.com/JigxorAndy

Dr. James MD

Addict

Registered
  08/12/2003
Points
  11941

First GOTW AwardSecond GOTW AwardThird GOTW AwardPicture Me This -Round 26- Winner!
30th May, 2008 at 03:28:34 -

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.

Looks like you're stuck with the computer clock.

 
Image
http://uk.youtube.com/watch?v=j--8iXVv2_U
On the sixth day God created Manchester
"You gotta get that sand out your vaj!" x13
www.bossbaddie.com

viva/volt

Awesome Sauce

Registered
  26/08/2006
Points
  1694

Game of the Week WinnerSilverNova MemberKlikCast StarVIP Member
30th May, 2008 at 05:48:12 -

Surely you could save the last date and time played at and compare it at start-up?

If people mess with their clocks why punish them anyway? I've always had the feeling that if a player wants to cheat then by all means let them.

 
Image
http://bfollington.tumblr.com

OMC

What a goofball

Registered
  21/05/2007
Points
  3516

KlikCast Musician! Guy with a HatSomewhat CrazyARGH SignLikes TDCHas Donated, Thank You!Retired Admin
30th May, 2008 at 08:41:05 -

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.

 

  		
  		

Jon Lambert

Administrator
Vaporware Master

Registered
  19/12/2004
Points
  8235

VIP MemberWii OwnerTDC Chat Super UserI am an April FoolSSBB 3265-4741-0937ACCF 3051-1173-8012360 Owner
30th May, 2008 at 12:57:05 -

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.

 
Sandwich Time!Whoo!

JoyCheck & KeyCheck Widgets
For easy implementation of customizable joystick and keyboard controls.
http://www.create-games.com/download.asp?id=8364

Jon Lambert

Administrator
Vaporware Master

Registered
  19/12/2004
Points
  8235

VIP MemberWii OwnerTDC Chat Super UserI am an April FoolSSBB 3265-4741-0937ACCF 3051-1173-8012360 Owner
30th May, 2008 at 12:58:41 -


Originally Posted by »Ben <3 Cake«
Surely you could save the last date and time played at and compare it at start-up?

If people mess with their clocks why punish them anyway? I've always had the feeling that if a player wants to cheat then by all means let them.



I was already going to make it compare the times at start up... Besides, the punishment has some fun qualities to it that I can't divulge until later in development, when I announce the game.

 
Sandwich Time!Whoo!

JoyCheck & KeyCheck Widgets
For easy implementation of customizable joystick and keyboard controls.
http://www.create-games.com/download.asp?id=8364
   

Post Reply



 



Advertisement

Worth A Click