Notice: Any messages purporting to come from this site telling you that your password has expired, or that you need to verify your details, confirm your email, resolve issues, 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.
Due to spam on this forum, all posts now need moderator approval.
Entire forum
➜ MUSHclient
➜ General
➜ OnPluginTick getting blocked by other plugin processing?
|
OnPluginTick getting blocked by other plugin processing?
|
It is now over 60 days since the last post. This thread is closed.
Refresh page
| Posted by
| Fiendish
USA (2,551 posts) Bio
Global Moderator |
| Date
| Tue 30 Nov 2010 02:09 AM (UTC) Amended on Tue 30 Nov 2010 02:13 AM (UTC) by Fiendish
|
| Message
| It looks like OnPluginTick isn't getting called at all, let alone 25 times per second, if other plugins are doing a lot of work on a lot of input.
Having, for example,
local reset_on_tick = false
function OnPluginBroadcast (msg, id, name, text)
if (msg == 999 and text == "repaint") then
Note("repaint broadcast from "..name)
reset_on_tick = true
end
end
function OnPluginTick()
Note("tick")
if reset_on_tick then
reset_on_tick = false
Note("repainting")
Repaint()
end
end
and replacing all calls to repaint in other plugins with related broadcasts results in this...
Quote:
tick
tick
tick
tick
tick
tick
tick
run 6e
tick
tick
tick
tick
Great Andolor Highway (3210)
repaint broadcast from Aardwolf_BigMap_Graphical
repaint broadcast from Aardwolf_Ascii_Mapper
repaint broadcast from Aardwolf_Ascii_Mapper
repaint broadcast from Aardwolf_GMCP_Mapper
repaint broadcast from Aardwolf_Statmon
repaint broadcast from Aardwolf_Health_Bars
repaint broadcast from Aardwolf_Statmon
repaint broadcast from Aardwolf_Health_Bars
North of a Great Carnivale (3209)
repaint broadcast from Aardwolf_BigMap_Graphical
repaint broadcast from Aardwolf_Ascii_Mapper
repaint broadcast from Aardwolf_Ascii_Mapper
repaint broadcast from Aardwolf_GMCP_Mapper
repaint broadcast from Aardwolf_Statmon
repaint broadcast from Aardwolf_Health_Bars
A dusty field (3208)
repaint broadcast from Aardwolf_BigMap_Graphical
repaint broadcast from Aardwolf_Ascii_Mapper
repaint broadcast from Aardwolf_Ascii_Mapper
repaint broadcast from Aardwolf_GMCP_Mapper
repaint broadcast from Aardwolf_Statmon
repaint broadcast from Aardwolf_Health_Bars
Fields near the Dragon River (3207)
repaint broadcast from Aardwolf_BigMap_Graphical
repaint broadcast from Aardwolf_Ascii_Mapper
repaint broadcast from Aardwolf_Ascii_Mapper
repaint broadcast from Aardwolf_GMCP_Mapper
repaint broadcast from Aardwolf_Statmon
repaint broadcast from Aardwolf_Health_Bars
The Dragon River (3206)
repaint broadcast from Aardwolf_BigMap_Graphical
repaint broadcast from Aardwolf_Ascii_Mapper
repaint broadcast from Aardwolf_Ascii_Mapper
repaint broadcast from Aardwolf_GMCP_Mapper
repaint broadcast from Aardwolf_Statmon
repaint broadcast from Aardwolf_Health_Bars
A Small Village
repaint broadcast from Aardwolf_BigMap_Graphical
There are several small fields filled with crops surrounding a cluster of
log houses here. People dressed in rough woolen clothing are scattered
around doing various activities which keep any small, rural settlement
alive. In the distance, a young boy can be seen watching over a flock of
sheep, and a woman seems to be carrying water back to one of the houses.
Several men seem to be heading for the larger town, and its extensive
forests. There is a very large forest a bit farther to the east, and the
people of this village seem to be avoiding it, almost desperately. The
skyline in that direction seems to give off a bright shimmer, almost as if
the trees themselves glitter softly.
repaint broadcast from Aardwolf_Ascii_Mapper
repaint broadcast from Aardwolf_Ascii_Mapper
repaint broadcast from Aardwolf_GMCP_Mapper
[Exits: north east south west]
repaint broadcast from Aardwolf_Statmon
repaint broadcast from Aardwolf_Health_Bars
repaint broadcast from Aardwolf_Statmon
repaint broadcast from Aardwolf_Health_Bars
< 3039/3039hp 2324/2324mp 3191/3211mv 3341tnl 820737g Quest=0 Dbl: 10 > < -2470 >
INFO: Zodiac raises a level. Now up to level 195.
INFO: Bladedge raises a level. Now up to level 12.
tick
repainting
tick
tick
tick
tick
tick
tick
If this is expected behavior, something in the helps should indicate it. Currently forum posts and the very limited documentation on OnPluginTick indicates that we can expect 25 updates per second, not 25 or 0 updates per second. It doesn't even fire in between other plugin events. |
https://github.com/fiendish/aardwolfclientpackage | | Top |
|
| Posted by
| Nick Gammon
Australia (23,169 posts) Bio
Forum Administrator |
| Date
| Reply #1 on Tue 30 Nov 2010 02:16 AM (UTC) |
| Message
| Hmmmmm.
http://msdn.microsoft.com/en-us/library/ms644902%28VS.85%29.aspx
The WM_TIMER message is a low-priority message. The GetMessage and PeekMessage functions post this message only when no other higher-priority messages are in the thread's message queue.
OnPluginTick uses WM_TIMER messages. |
- Nick Gammon
www.gammon.com.au, www.mushclient.com | | Top |
|
| Posted by
| Nick Gammon
Australia (23,169 posts) Bio
Forum Administrator |
| Date
| Reply #2 on Tue 30 Nov 2010 02:17 AM (UTC) |
| Message
|
Fiendish said:
repaint broadcast from Aardwolf_Ascii_Mapper
repaint broadcast from Aardwolf_Ascii_Mapper
repaint broadcast from Aardwolf_GMCP_Mapper
repaint broadcast from Aardwolf_Statmon
repaint broadcast from Aardwolf_Health_Bars
repaint broadcast from Aardwolf_Statmon
repaint broadcast from Aardwolf_Health_Bars
What's all this then? Simulating Redraw? |
- Nick Gammon
www.gammon.com.au, www.mushclient.com | | Top |
|
| Posted by
| Nick Gammon
Australia (23,169 posts) Bio
Forum Administrator |
| Date
| Reply #3 on Tue 30 Nov 2010 02:36 AM (UTC) |
| Message
|
Fiendish said:
If this is expected behavior, something in the helps should indicate it.
I've updated the documentation. There is no real way of guaranteeing a firing of 25 times a second, because an individual script might take more than 40 milliseconds to run.
In your particular case, you might check for elapsed time in the repaint broadcast message, and do whatever you are planning to do if 40 milliseclonds have elapsed. |
- Nick Gammon
www.gammon.com.au, www.mushclient.com | | Top |
|
| Posted by
| Fiendish
USA (2,551 posts) Bio
Global Moderator |
| Date
| Reply #4 on Tue 30 Nov 2010 02:41 AM (UTC) Amended on Tue 30 Nov 2010 02:44 AM (UTC) by Fiendish
|
| Message
|
Nick Gammon said:
What's all this then? Simulating Redraw?
I was experimenting with a way to batch calls to repaint. Essentially I want something sort of like Redraw, in that it doesn't do something expensive every single call, but that actually still forces painting periodically like repaint does.
Quote: There is no real way of guaranteeing a firing of 25 times a second, because an individual script might take more than 40 milliseconds to run. That much I expected, but it wasn't even firing in between function calls because it's getting co-opted by processing new mud output. The WM_TIMER explanation makes sense.
Quote: In your particular case, you might check for elapsed time in the repaint broadcast message, and do whatever you are planning to do if 40 milliseclonds have elapsed.
An excellent suggestion. I'll try that. |
https://github.com/fiendish/aardwolfclientpackage | | Top |
|
| Posted by
| Fiendish
USA (2,551 posts) Bio
Global Moderator |
| Date
| Reply #5 on Tue 30 Nov 2010 07:12 PM (UTC) Amended on Tue 30 Nov 2010 07:14 PM (UTC) by Fiendish
|
| Message
| FYI, Nick, my current solution is this:
local repaint_on_tick = false
local last_repaint_time = utils.timer()
function OnPluginBroadcast (msg, id, name, text)
if (msg == 999 and text == "repaint") then
repaint_on_tick = true
if (utils.timer() - last_repaint_time > .1) then
repaint_on_tick = false
Repaint()
last_repaint_time = utils.timer()
end
end
end
-- if ticks are coming through, then we have enough time to repaint again
function OnPluginTick()
if repaint_on_tick == true then
repaint_on_tick = false
Repaint()
last_repaint_time = utils.timer()
end
end
I *think* this allows me to get deferred drawing for better performance when running a lot of plugins at once like Redraw and also the higher priority of Repaint that causes it to happen at all instead of never when under load. |
https://github.com/fiendish/aardwolfclientpackage | | 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.
16,232 views.
It is now over 60 days since the last post. This thread is closed.
Refresh page
top