simple 24 hour game clock
-
- Posts: 13
- Joined: Tue Jun 09, 2009 11:53 am
- Location: Wales, UK
- Contact:
simple 24 hour game clock
(deleted; here was a broken clock demo)
Last edited by bit-pusher on Fri Jun 12, 2009 9:54 am, edited 4 times in total.
coldcity.com - code, games, stuffs
-
- Competition winner
- Posts: 1123
- Joined: Sun Jun 10, 2007 11:14 pm
-
- Posts: 13
- Joined: Tue Jun 09, 2009 11:53 am
- Location: Wales, UK
- Contact:
-
- Competition winner
- Posts: 1123
- Joined: Sun Jun 10, 2007 11:14 pm
-
- Posts: 13
- Joined: Tue Jun 09, 2009 11:53 am
- Location: Wales, UK
- Contact:
-
- Posts: 13
- Joined: Tue Jun 09, 2009 11:53 am
- Location: Wales, UK
- Contact:
-- Oops it's maybe not that clear how to use... my bad. GetGameTime() returns a float in range 0.0f - 24.0f; GetGameMinutes() and GetGameHours() return integers. I'll post a more complete demo.Midnight wrote:Yeah it's comming. I'm adding some new features now and I got side tracked by bit-pushers code.JuppS wrote:great, second site of this thread and still no Midnight-code!
I'm realy looking forward to see the great code snippet that needs so long to be finished!
I found a bug in it btw. GetGameTime() doesn't even return hours what it returns is a minute count divided by 24. It's totally wrong.
I'm not going to fix his code but later I'll replace it.
Last edited by bit-pusher on Thu Jun 11, 2009 11:25 am, edited 1 time in total.
-
- Posts: 13
- Joined: Tue Jun 09, 2009 11:53 am
- Location: Wales, UK
- Contact:
(deleted)
Last edited by bit-pusher on Fri Jun 12, 2009 9:54 am, edited 1 time in total.
coldcity.com - code, games, stuffs
-
- Posts: 13
- Joined: Tue Jun 09, 2009 11:53 am
- Location: Wales, UK
- Contact:
Cool; updated the original post to add the demo link and for context.
coldcity.com - code, games, stuffs
-
- Posts: 13
- Joined: Tue Jun 09, 2009 11:53 am
- Location: Wales, UK
- Contact:
Hmm wierd.. seems to work OK for me. Any probs with the demo, or is it just the code on this page? :S
coldcity.com - code, games, stuffs
Yes I've read it. One would think that was in response to a question about changing the time factor. should it not be defaulted to real world milliseconds?Nox wrote:Midnight did not read the following:bit-pusher wrote:Change DAY_LENGTH_MS to the number of real-world ms you want a game day to last.
anyways I decided I would test this.. oh and guess what 86400000 milliseconds aka 24 hours is far too large of a number to be handled by any common variable type limits.
so I guess at this point one might say fail?
For all of you that need a 12 OR 24 hour clock try mine which "inspired" bit-pusher to steal my thunder. well now I'm stealing it back!
http://irrlicht.sourceforge.net/phpBB2/ ... hp?t=33947
let me guess bit-pusher. either you had this junk laying around and decided that it was clock posting time because I made you think of it. OR you thought hey a clock I can do that faster then midnight maybe I should throw some poop together really fast and try to out do him. it'll be easy it's just a clock. sound about right bit-pusher? it's ok don't answer I don't want to hear your lies.
... after browsing his website I already know which one it was.
18446744073709551615 u64 or time_t in most case
4294967295 u32 or time_t in some rare case
86400000
And let's not talk about floats or time_t as floats or double. And since I'm pretty certain it is only used for division, it will not push through the roof any value.
Also, just learn to use friggin gmtime or localtime if you want real day time (and it's tm struct). It has been coded to handle the pre-1970 case, the leap years, the daytime, etc. It is far more solid and reliable than either your clock (when used for the purpose of tracking real time, ofc) and will not fail misteriously when ported to another system.
4294967295 u32 or time_t in some rare case
86400000
And let's not talk about floats or time_t as floats or double. And since I'm pretty certain it is only used for division, it will not push through the roof any value.
Also, just learn to use friggin gmtime or localtime if you want real day time (and it's tm struct). It has been coded to handle the pre-1970 case, the leap years, the daytime, etc. It is far more solid and reliable than either your clock (when used for the purpose of tracking real time, ofc) and will not fail misteriously when ported to another system.
First of all my code is only coded for windows. I'll be sure to specify that just for you.Dorth wrote:18446744073709551615 u64 or time_t in most case
4294967295 u32 or time_t in some rare case
.......
Secondly I have tested bit-pushers code using 86400000 and guess what the result was?
Since when is u32 4294967295?? is it not 65535 give or take?
I know for a fact that u32 is limited to 65535 because I've actually tested it in my own code. unlike bit-pusher that will perhaps never even use his own code.
And as for gmtime my code was never designed for accurate real world time keeping. It was designed as a GAME Clock hence the name and the time warping functions.
It seems to me you'd be better off actually testing it yourself before trying to discredit me. As if I don't get enough abuse from this community as it is.
oh and it's spelled mysteriously. I'll let you slide though because it appears to be a typo.
fail dorth. fail.
Last edited by Midnight on Fri Jun 12, 2009 7:25 am, edited 2 times in total.