Various objects in the game world will need to do things on a timed basis. There should be a central service of some sort to register timed chunks of code so they can all be managed from one place without having to give objects their own threads or something.
We'd talked about some kind of science to handle this (Chronology or something?), so implementing it as a Science would be cool.
It needs to:
- Allow objects to register callbacks to be executed:
- In a specified number of seconds
- At a specified future time (Time object)
- Repeated every n seconds
- Allow objects to unregister their callbacks somehow. Registering could return a key or something which could be used to refer back to the callback later. Or maybe the callback Proc object itself?
It should probably be implemented as a DeltaQueue? or something similar. The MUES Engine class does this, but it's probably overly complex in its implementation; see the #scheduleEvents method for specifics.