> > The third select() call is used to achieve a fixed loop timing. > > You have no way of knowing how long a main loop cycle will take, Getting off the subject for a second... I'm playing with a bit of code that makes it so you don't have to know how long a loop takes. One of the weaknesses I see in circle code is that everything happens in lock-step with the clock.. i.e. the mud is time driven, not event driven. I've whipped up some priority queues to manage the various event types. A master clock is still used to tick off milliseconds. Every time related act is time stamped and tossed into one of the queues. Take ferinstance spells with duration. The spell is cast, the player affected, and an event is posted to some queue time-stamped for when the spell should wear off. Each trip through the main loop checks the queue for events due or overdue. The result (hopefully) is a system where time granularity is in milliseconds, not arbitrary "ticks". The only problem is that I haven't played with it long enough to give evidence on how well it _really_ works. Hopefully, the result is a mud where "ticks" are meaningless and action proceeds a bit more smoothly. -Todd
This archive was generated by hypermail 2b30 : 12/07/00 PST