My game is growing slowly and becoming more than I thought it would. I would like to add a calendar now, so that I can simulate the passage of time.
Characters will age (although you won't die of old age) and certain events will happen as time moves, etc.
I'm assuming this will require the implementation of a tick system and probably a cron to update it? Or is there another way?
Simulating the passage of time
- Jackolantern
- Posts: 10891
- Joined: Wed Jul 01, 2009 11:00 pm
Re: Simulating the passage of time
Could you not figure out a formula to truncate the real-world time into the format you want it in? This could be done with the time() function and some formatting, and would be much less taxing than implementing a tick with crons.
The indelible lord of tl;dr
Re: Simulating the passage of time
That's what I'm wondering... if there's a better way than a cron?
I suppose I could just store a start time for the world calendar some place permanent, and then just update everything from that initial start time...
I suppose I could just store a start time for the world calendar some place permanent, and then just update everything from that initial start time...
- Jackolantern
- Posts: 10891
- Joined: Wed Jul 01, 2009 11:00 pm
Re: Simulating the passage of time
Ohhh, yeah, I see what you mean for the calendar. You would need to have one master calculation to increment the date. Yeah, I guess a crons would be the best way I can think of. Depending on how you wanted the dates to run in your game, there probably is some way to work it out with a formula on a player-by-player basis, though.
The indelible lord of tl;dr
- hallsofvallhalla
- Site Admin
- Posts: 12026
- Joined: Wed Apr 22, 2009 11:29 pm
Re: Simulating the passage of time
you could still use normal time without a cron. Just setup the start time int he database and have everyone's character age checked when they log in.
Example, you start the server at 1pm on Monday. Characters age 1 year every 24 hours. I sign up on tuesday at 5pm. I am 0 years old
so I log in at wednesday 6pm and the log in script checks how much time has past since my first sign up, 25 hours, i am 1 years old. then it checks the server start date. 49 hours, the world is 2 years old. It updates the appropriate settings for the players page.
Example, you start the server at 1pm on Monday. Characters age 1 year every 24 hours. I sign up on tuesday at 5pm. I am 0 years old
so I log in at wednesday 6pm and the log in script checks how much time has past since my first sign up, 25 hours, i am 1 years old. then it checks the server start date. 49 hours, the world is 2 years old. It updates the appropriate settings for the players page.
Re: Simulating the passage of time
Have a weather forcast that is connected to real life weather forcast. That way in the later months its colder, other months its warmer etc 

Re: Simulating the passage of time
@towcar That is somewhat the idea of some mmorts's but they have random weather like if its raining you get more wheat or if its scorching hot your workers quit early causing resource production to go down and in an rpg I think you could come up with some pretty sweet idea like if its raining or snowing it cost more turns to travel etc etc
Coding-PHP, Javascript, C++, HTML, mySQL
Modeling/Art-Blender, GIMP
Games-Unity, Game Maker 8
Modeling/Art-Blender, GIMP
Games-Unity, Game Maker 8
- Jackolantern
- Posts: 10891
- Joined: Wed Jul 01, 2009 11:00 pm
Re: Simulating the passage of time
@OldRod
I may have an alternative for you to use outlined in this thread. I actually used your case as an example
It is an alteration on the "On view" method.
I may have an alternative for you to use outlined in this thread. I actually used your case as an example
The indelible lord of tl;dr
Re: Simulating the passage of time
I just saw that thread. I'll be checking it out, thanks 