OmniCC

OmniCC

54M Downloads

Timer sticks sometimes when refreshing at low duration

Opened this issue · 8 comments

commented

I have noticed this a few times while playing, but it is proving very difficult to reproduce. I did manage to snap one screenshot while doing a dungeon earlier of the issue happening to displays for Serpent Sting: http://imgur.com/xEEDx

What is happening is that when a timer gets refreshed at a low duration (this seems to be the only cause that I have found), the OmniCC countdown freezes at whatever number it was at before the timer was refreshed. The sweep animation continues to function normally (if you look closely in the screenshot, you can tell that the sweep on the TellMeWhen icon (Between my player and target unit frames) is at the same position as the sweep on my debuff display attached to my target unit frame. The countdown on the TMW icon was stuck at 1, while the countdown on my unit frames was actively counting down.

I have also seen the issue reversed - the TMW icon's countdown works fine, but the unit frame display's countdown is stuck.

I think this may be related to another bug that I found - while i was trying to reproduce this issue, I found that refreshing a timer at a very low duration also sometimes caused the timer to not show up at all on both displays after the refresh. Could it be that in both cases, the timer is being stopped prematurely (either while it still shows a duration of 1 or right after the count dissapears), but is not being properly hidden, and also is not being re-started with the new start time and duration?

commented

here is the screen shot
you can notice that i refreshed the immorlate on the target, but the timer freezed at 2 second.

http://i39.tinypic.com/970dw6.jpg

commented

PROBLEM FOUND!

It seems that this is not really related to low durations, but it is related to buff/debuff refreshing. Sometimes, a buff/debuff will get refreshed at a moment that causes OmniCC's Timer:GetNextUpdate(remain) to return a very small value (in my testing by injecting print()s everywhere, it broke when it returned and passed into :ScheduleUpdate() a value of 4.54e-013 while using the animation updater.) I'm guessing that Blizzard's animations do not support intervals this small, and so it will just not play the animation instead of playing it instantly. This behavior seems to be new in 4.3, as I have never noticed this before.

Doing further testing, I found that 0.00010000000111199 is just about the smallest delay that still allows an animation to complete instead of silently failing (yeah, I was a little bored. 0.0002 is probably a more practical number to use.) I'm not sure if this number can vary between different OSes/systems/processors/etc, but using this information, I changed line 134 of timer.lua from:

self:ScheduleUpdate(self:GetNextUpdate(remain))

to

self:ScheduleUpdate(max(self:GetNextUpdate(remain), 0.0002))

I haven't tested it yet, but I don't see why it wouldn't fix this issue.

commented

Actually, I have seen this happen when updating from timer.lua:106 as well, so I think a more elegant solution would be to change aniUpdater's ScheduleUpdate function from:

function AniUpdater:ScheduleUpdate(delay)
    -- print('AniUpdater:ScheduleUpdate', delay)

    self:StopAnimation()
    if delay > 0 then
        self:Show()
        self.ani:SetDuration(delay)
        self.aniGroup:Play()
    else
        self:OnFinished()
    end
end

to

function AniUpdater:ScheduleUpdate(delay)
    -- print('AniUpdater:ScheduleUpdate', delay)

    self:StopAnimation()
    if delay > 0 then
        delay = max(delay, 0.0002)
        self:Show()
        self.ani:SetDuration(delay)
        self.aniGroup:Play()
    else
        self:OnFinished()
    end
end
commented

Just tested this and it seems to be a functional fix without adverse effects.

commented

Kk i am gonna try it now, thanks for your help =D

are you gonna update the OmniCC really soon? Lots of my friends are having the same issue, and it drives them crazy.

------------------ ԭʼʼ ------------------
: "Cybeloras"[email protected];
ʱ: 20111213(ڶ) 8:21
ռ: "nocryg"[email protected];

: Re: [OmniCC] Timer sticks sometimes when refreshing at low duration (#34)

Just tested this and it seems to be a functional fix without adverse effects.


Reply to this email directly or view it on GitHub:
#34 (comment)

commented

@Cybeloras, cold you test if this works as well? Trying to avoid using max for performance sake.

function AniUpdater:ScheduleUpdate(delay)
    -- print('AniUpdater:ScheduleUpdate', delay)

    self:StopAnimation()
    if delay > 0 then
        self:Show()
        self.ani:SetDuration(delay + 0.0002)
        self.aniGroup:Play()
    else
        self:OnFinished()
    end
end

That small amount of time should be visually undetectable to the user.

commented

I don't see any reason why it wouldn't. As long as the time passed to :SetDuration is greater than 0.00010000000111199, there shouldn't be any problem.

commented

Hi Cybeloras,

It's cant find the line in timer.lua, where should i put

function AniUpdater:ScheduleUpdate(delay)
-- print('AniUpdater:ScheduleUpdate', delay)

self:StopAnimation()
if delay > 0 then
    delay = max(delay, 0.0002)
    self:Show()
    self.ani:SetDuration(delay)
    self.aniGroup:Play()
else
    self:OnFinished()
end

end

Thanks for your help~!