> > So, again, my thought is to provide some explicit mechanism for this in > Win32, and to couple it with some advice about how to deploy it. >
That sounds good. It doesn't seem like something that we can default to, but it certainly is useful as an option. On Tuesday, January 30, 2018 at 12:23:05 AM UTC+9, Serdar Yegulalp wrote: > > Yes, that's exactly right. Raising the timer resolution on Win32 causes > increased power consumption, as has been documented elsewhere. > > I did some investigation into this by way of a game I wrote using Pyglet, > and I found that the following seems to be the best advice: > > - Turn ON the higher timer resolution when the game starts and during game > play, since you need it during that time. > - Turn OFF higher timer resolution when the player pauses the game, or > when you're not running other active animation events that need the higher > resolution. Turn it back ON when play resumes. > - Turn OFF higher timer resolution when the program exits. > > One thing I also tried was to toggle the higher timer resolution on and > off for each execution of the draw loop -- on right before the sleep > function, then off again. Microsoft advises against this, however. I tried > it and while it did seem to work, it also didn't provide any discernible > advantage over simply turning it on and leaving it on during active > gameplay, and then toggling it off when the game paused or exited. > > So, again, my thought is to provide some explicit mechanism for this in > Win32, and to couple it with some advice about how to deploy it. > > On Sunday, January 28, 2018 at 10:27:16 PM UTC-5, Benjamin Moran wrote: >> >> Hi Serdar, >> >> Yes, this is definitely something I would like to explore. If I >> understand it, raising the timer resolution will affect how Windows idles, >> which could have a significant (or not?) impact on power usage. Is that >> right? This would be important on laptops of course, so as you said it >> would need to be a user choice. >> I would be interesting to compare this to busy-waiting, with regards to >> accuracy and system load. >> >> >> >> >> On Sunday, January 28, 2018 at 12:03:21 AM UTC+9, Serdar Yegulalp wrote: >>> >>> On Win32, you need to raise the timer resolution to get truly accurate >>> sleep on a 1/60 second basis. I've written some functions to do this >>> manually, but I'm thinking we might want to provide a way to do this >>> natively in Pyglet. >>> >>> The big caveat is that the user should have some way to control it. If >>> you have an app that doesn't need that granular a level of timing, you're >>> not supposed to raise the timer resolution, since that's >>> resource-intensive. You turn it on when you need it and turn it off when >>> you don't. This also eliminates the need for busy-waiting, since you can >>> get extremely precise wait times this way. >>> >>> Perhaps for 1.4 I could provide a pull request where there's a clock >>> setting that allows toggling of the use of the higher timer resolution on >>> demand. >>> >> -- You received this message because you are subscribed to the Google Groups "pyglet-users" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected]. Visit this group at https://groups.google.com/group/pyglet-users. For more options, visit https://groups.google.com/d/optout.
