ID:1312206
 
How should a game handle long lengths of time?

For example, if a player orders some rare item from afar, and it is meant to take 2 hours to reach their inventory, what is the best way to go about programming that in BYOND? Surely a 2 hour sleep() would be truly ridiculous.

Furthermore, what happens if the server crashes in that time? They've already paid for the item; they need to receive it.
A 2 hour sleep(or well, spawn, probably) is fine. If server shutdown/crash is a concern (which I suspect it is), then you'd also want a way to persist the event, and load those up on start-up, compare the time you saved it versus the current time, then spawn() the difference / process it right away.

This has given me an idea for my event scheduler library.
I personally would write a item delivery scheduler. It would be told what items to deliver to who and when. Then you just save it and load it.
How do you do "and when" though? Check every tick if it holds some items to be delivered at that second?
Haha, I knew there was a lib out there that would help with this, and I suspected you were the author Stephen. I'm currently developing another section of my project, but once that's done I'll have a thorough look at your library and see if it will facilitate the development of the next section.

(Once I have a concept concreted in my mind I build it, and with the spare mental time start thinking and conceptualizing the next section)

I suspect you'll have to deal with me pestering you a bit when that happens :P
No problem. Best to use the forums on that hub entry, so I don't forget. I'll look to add some persistence backing to schedulers at some point soon(ish).