Notice: Any messages purporting to come from this site telling you that your password has expired, or that you need to "verify" your details, making threats, or asking for money, are
spam. We do not email users with any such messages. If you have lost your password you can obtain a new one by using the
password reset link.
Entire forum
➜ MUSHclient
➜ General
➜ updating miniwindows more frequently than 1/10th a second
updating miniwindows more frequently than 1/10th a second
|
It is now over 60 days since the last post. This thread is closed.
Refresh page
Posted by
| Hollisgf
(4 posts) Bio
|
Date
| Thu 25 Aug 2011 06:12 AM (UTC) |
Message
| I am writing a MUSHclient plugin for my mud. The mud makes makes frequent use of 3-second windows for actions. I would like to visually display these windows by having a bar that slowly drains from "full" to "empty" over the course of the window.
I have tried doing this with timers, but they are capped at 0.1 second resolution, which makes the draining look very choppy.
Is there an alternate way I could go about doing there, where I can update the bar at a higher frequency? Say, once ever 0.01 seconds? | Top |
|
Posted by
| Twisol
USA (2,257 posts) Bio
|
Date
| Reply #1 on Thu 25 Aug 2011 06:51 AM (UTC) |
Message
| You can implement an OnPluginTick callback, which is provided specifically for doing animations. It's called 25 times a second. |
'Soludra' on Achaea
Blog: http://jonathan.com/
GitHub: http://github.com/Twisol | Top |
|
Posted by
| Hollisgf
(4 posts) Bio
|
Date
| Reply #2 on Thu 25 Aug 2011 07:50 AM (UTC) |
Message
| Aha! Better, but still a little jumpy. Is there anything else that is a little faster? | Top |
|
Posted by
| Nick Gammon
Australia (23,046 posts) Bio
Forum Administrator |
Date
| Reply #3 on Thu 25 Aug 2011 08:08 AM (UTC) |
Message
| 25 frames per second is about what movies are recorded at.
Make sure you are updating the screen (maybe call Repaint, although that can be pretty CPU intensive). At least make sure you are calling Redraw. |
- Nick Gammon
www.gammon.com.au, www.mushclient.com | Top |
|
Posted by
| Hollisgf
(4 posts) Bio
|
Date
| Reply #4 on Thu 25 Aug 2011 08:33 AM (UTC) |
Message
| Yup, I am repainting and it is still choppy (not as bad as using timers though).
Movies look smooth at 25 fps because they have lots of things changing; more changes in our field of view means a lower frequency threshold for perceiving apparent motion as smooth change. When there are fewer things changing, we have a much higher threshold for perceiving apparent motion as smooth change. It's basic human vision. Standard arguments about fps don't really apply to small changes.
| Top |
|
Posted by
| Nick Gammon
Australia (23,046 posts) Bio
Forum Administrator |
Date
| Reply #5 on Thu 25 Aug 2011 09:55 AM (UTC) |
Message
| If you have a bar of more than 75 pixels width, and it has to drain in 3 seconds, some choppiness is going to be unavoidable at 25 fps. eg. if it is 150 pixels wide, it will decrease at the rate of 2 pixels each time.
You could make timers have a higher resolution, but as other threads have discovered, Windows timers are actually quite a low priority. So you can specify a 1/1000 of a second resolution, but that might not be realized if some other higher-priority event happens first (like, data from the MUD).
It's a trade-off. You could have really smooth animations, but slower responses to messages from the MUD. |
- Nick Gammon
www.gammon.com.au, www.mushclient.com | Top |
|
Posted by
| Hollisgf
(4 posts) Bio
|
Date
| Reply #6 on Thu 25 Aug 2011 10:34 AM (UTC) |
Message
| Ohh, duh... I shrunk the bars down from 180 pixels to 75, and it looks much nicer now. Thanks! | Top |
|
The dates and times for posts above are shown in Universal Co-ordinated Time (UTC).
To show them in your local time you can join the forum, and then set the 'time correction' field in your profile to the number of hours difference between your location and UTC time.
19,488 views.
It is now over 60 days since the last post. This thread is closed.
Refresh page
top