This isn't under creations because for one thing, I'm not creating time. I'm only showing my implementation of it, in hopes of getting some ideas and fixes.
Right now I'm just making parts of an RPG I'm going to be making in the future. So this is what I have for time so far...
_Time()
while(world)
spawn() update_seconds(1)
sleep(10)
//-----------------------
update_seconds(var/i)
seconds += i
while(seconds >= 60)
seconds -= 60
spawn() update_minutes(1)
//-----------------------
update_minutes(var/i)
minutes += i
while(minutes >= 60)
minutes -= 60
spawn() update_hours(1)
//-----------------------
update_hours(var/i)
hours += i
while(hours >= 24)
hours -= 24
spawn() update_days(1)
//-----------------------
update_days(var/i)
days += i
while(days > 28) //All my months are 28 days long and there are 13 months so a total of 365 days.
days-=28
spawn() update_month(1)
//-----------------------
update_month(var/i)
months += i
if(month == 13)
Sanguine_Eclipse()//Name of the game and a big part of the story.
while(month > 13)
month -= 13
spawn() update_year(1)
//-----------------------
update_year(var/i)
year += i
if(year % 8 == 0)//Don't worry about this.
update_cycle()//Or this...
//-----------------------
I know it can't be perfect, It only took me a couple min...
Anyone see any problems, or have any questions about the way I'm implementing time.
Now for me to ask some questions:
Is it efficient?
Will it have time to update everything with in one tick?
Any loopholes where the code won't work?
I will make these times shorter so that years could pass by quicker than real life. Whats the best way to go about it?(ie seconds happen twice as fast?)
If you reply thanks in advance.
-KirbyAllStar
As for matching it to real life or not... as much as I like the idea of a real time roleplaying game, consider that everything else in the game world will be "scaled down" somehow, by necessity. How big is your game map supposed to be? A country? A continent? A whole world? If time flows the same as real time, it should take months (at the least) to cross such a map... but it'll probably take well less than an hour, even if you string multiple large maps together and/or institute a reasonable movement delay.
How long would it take to perform actions in the game world like (assuming these things were planned) researching/practicing a new skill, making a sword, building something, etc.? If time flows at a normal rate, then the fact that these things take far less time than they do in real life becomes more blatantly obvious.