TeensyMud - 'A ruby mud server.'

Subject: World timer
Subject: World timer
Author: Massaria
Posted: 01/25/2006 12:33PM


I'm currently trying to figure out some timer rates for various energy calculations on the players, and I've found that I lack some sort of world timer - a la 'The sun sets/rises' - for all players - something to hold the speed of the calculations up against.
I gather this will be easy enough when you implement the new timer-types, but if I don't have the patience to wait, where (and how, if unusual method) would I put in such a timer?

Thanks,
Mass.

______

EDIT:
Oops - Wrong board. sorry :-(

reply
Subject: World timer
Author: Tyche
Posted: 01/26/2006 01:41PM

Massaria wrote:
>
> I'm currently trying to figure out some timer rates for various energy calculations on the players, and I've found that I lack some sort of world timer - a la 'The sun sets/rises' - for all players - something to hold the speed of the calculations up against.
> I gather this will be easy enough when you implement the new timer-types, but if I don't have the patience to wait, where (and how, if unusual method) would I put in such a timer?

Oh I have already checked it in.
/repository/show/lib/core/world.rb

I don't believe this timer nor the hamster one will provide long term accuracy. After all the time between ticks is 1.0 second plus the time to lock/unlock the event queue and run through the loop of timer objects. That is if you want something to run at 6:00am everyday setting this timer 24*60*60 is bound to be off by a number of seconds, maybe even a few minutes a day.

The new one does save its state to the database though. So if you had set a timer for 5 minutes and then shut the server down 3 minutes later, upon restarting you'll get the timer event in about 2 minutes.

Jon



reply