FrameSort

FrameSort

88.4k Downloads

[alpha] Frames changing mid-combat in arena

clicketz opened this issue ยท 37 comments

commented

Likely related to #25, frames were resorted seemingly randomly throughout the game

https://streamable.com/6x8acu

Gets sorted at about 0:05, then again at ~0:57 and ~1:09

Can't really tell why. This is on secure sort, btw.

v5.9.2a-3

commented

Also did you happen to notice whether this was happening or not in one of the previous 5.9.2 alpha versions?

commented

Thanks for the video example, it's very useful.
Was the correct sorting order Pally -> Sham -> Lock?

commented

Correct sorting order was Lock->Pally->Sham. The order in the very beginning of the video.

commented

Likely correlated events:

0:05 - Lock observer
~0:57 - No idea
~1:09 - Ele shaman fire elemental

Pet/guardian/minion events in general have been giving me trouble, so looks like there is somewhere I'm missing a trigger to re-sort frames after blizzard unsort them.

If by chance you are still queuing would you mind hitting a target dummy or something to place yourself in combat, and then summon your observer to see if it causes frames to become unsorted? (I don't have a warlock to test with).

commented

I was qing as a different class the rest of the night (resto druid) but when we queued into an aff lock the frames resorted a ton again. Observer seems likely (and probably fire ele).

This was the first alpha version I've noticed it on.

Will test more later.

commented

I have an idea what it could be, will release another alpha version soon with a potential fix.

commented

Released a potential fix in 5.9.2a-4.

commented

https://streamable.com/l5ra7v

Still happening. Happens at about ~0:07. No pets that I pressed. Maybe shadowfiend from the enemy priest (though I don't see it).

commented

Wow that is bizarre, can't see any events that would cause that.

Looking into it!

commented

Tested 5.9.2a-4 on a training dummy, casting observer and darkglare in combat and everything seems to be working properly so far. Will update again later on with more actual games played.

commented

Looking at it again, it looks like in that particular incident it was the dead pet frame (from sac'ing my pet) that got removed and caused a resorting.

commented

I've made more fixes for this in alpha release 6.
It's hard for me to confirm whether it's fixed the issue or not as it's a bit chaotic dealing with blizzard's frame positioning.

Would be really helpful if you could try it out and see if there is any improvement.

commented

Sure, will keep looking out for it when I queue and let you know if I find anything.

commented

Made an improvement to this area in 6.0.3.
Unsure if it'll fix this bug or not as I can't reproduce this locally but it might help.

commented

Oh interesting that you can't reproduce. It probably is some addon then, although I can't really imagine which one it would be. I'll give those hooks a try next time I q and see what it looks like.

I've just been avoiding the issues by playing with pets disabled lately, ha.

commented

Added another sort trigger on the player's own pet events in alpha release 10, might help with this.

commented

Looks like this is still happening quite a lot with hunter pet deaths (with me playing hunter).

commented

Roger that.

commented

https://drive.google.com/open?id=13JzlE68e3ebpG3sBBOYq_AUdYyKq9a7e

v5.9.2a-10

Supposed to be Druid>Mage>Warlock top-to-bottom.

~00:39

~00:53

~02:00

~02:06

~02:36

~03:02

~04:36

Sorry, I only had the one game because I had to change it back to taint-sorting since I couldn't play with it doing it this often.

commented

That's insane, looks like pet events are still causing it and hasn't had any improvement.

Do you by chance have some sort of other functional (ignoring textures/fonts) addon or customisation to your party frames? Something that might be calling CompactPartyFrame:RegisterEvent() or CompactRaidFrameContainer:RegisterEvent()?

commented

I don't have any addons that directly alter raid frames, but there are a few that interact with them.

BigDebuffs
BuffOverlay
Lifebloom Glow
Overshields
WeakAuras

I'd be highly surprised if any of them register additional events for the blizzard frames though.

commented

I've implemented a dodgy fix in alpha 11 that might resolve it.

My theory on what's happening is:

  1. We're in combat and a GROUP_ROSTER_UPDATE or UNIT_PET event happens.
  2. Blizzard notifies event subscribers.
  3. It just so happens that FrameSort is notified first which is too early as frames haven't changed yet.
  4. Now Blizzard notify themselves and they refresh their frames (which undoes any sorting).
  5. I don't get another opportunity to run code here to re-apply sorting.

This is easily solved in the insecure environment (regular addon code) with being able to use hooks to ensure code runs after some other code. However during combat we need the use of the restricted environment to be able to call SetPoint() on frames to move/sort them.

In the restricted environment I don't have the luxury of using a mechanism (like hooks) to ensure FrameSort's code runs after Blizzard's and have to rely on the limited triggers available (e.g. hardware events, SecureHandlerWrapScript, or SecureGroupHeaders.

I've discovered Blizzard generally notify event subscribers in the order that they were registered, so I can coerce FrameSort's code to run later by registering events later. This is the dodgy workaround I've implemented.

I know this isn't a reliable nor good solution but it's the best I can come up with at this point. If you have any other ideas (I know you're also an addon developer) please let me know!

Also I don't how it's the case that Blizzard seemingly register events on their CompactPartyFrame/RaidFrame after FrameSort which is the only explanation I can think of why it's happening so often for you (yet for me it's not happening). Perhaps there is some weird business happening through UI reloads that causes things to become out of order.

tl;dr: implemented a dodgy fix in alpha 11 and if my theory is correct it should solve the issue.

commented

A pretty interesting theory--it makes sense other than Blizzard registering their own frames after addons. Kind of makes me want to test it with only FS enabled to see if there really is another addon culprit. I wish it was easier to get some good testing for it.

I did get about 50 games (with all my other addons enabled) with alpha 11 tonight and didn't notice a single resort, so it's looking promising.

Will definitely let you know if I think of a more robust solution, though. It's wild to me that Blizzard has allowed this sorting nonsense to persist for so long. I was so hopeful that the new party frames in DF were going to finally be the end.

commented

That's great news!

Btw I have some very basic logging that might help which you can enable:

/run FrameSortApi.v1.Logging:SetEnabled(true)

Can also expose my addon table to poke around with:

/run FrameSortApi.v1.Debugging:SetEnabled(true) then /tinspect FrameSort

I should probably add more logging and perhaps store a copyable log in the options somewhere which would help future bug reports.

commented

Oh that's great, will definitely make use of those

commented

Ah I think I know exactly where that bug is.
I have a feeling if there are 2 or more pets it should work, but if there is only 1 pet and it's your own I spot a bug.

With the hunter did you happen to play with another pet class from memory?

commented

Unfortunately summon water ele seems to be triggering resorting mid-combat (when I'm the mage). Alpha 13. Interestingly, my pet dying/summoning when I was on hunter didn't seem to trigger it.

https://drive.google.com/open?id=13SegYpE2OtPng7pw4rSiPjNIXzHJC1Gr

~0:25
~2:13 (losing combat, looks like)
~2:27

commented

I wish I had video of the hunter games because it's certainly possible I'm misremembering if I actually encountered resorting or not (they were yesterday). But no, it was cupid and I was the only one with a pet. I can try to get some more games in on the hunter at some point.

commented

All good. I'm pretty sure this is just a small logic bug in my code as opposed to some weird event ordering or other craziness, so it should be easy to fixโ„ข.

commented

Fixed in 6.0.1.

commented

Currently qing so I can't analyze much but welly seems to still trigger resort. v6.0.1 (wanting me/healer on top)

https://drive.google.com/open?id=13esOAKCdoHi6KkRW-1fzoZEO5w__pv8V

commented

I can't seem to reproduce it and wonder if another addon is somehow causing interference.

Would you mind adding the below code somewhere (e.g. chuck it in FrameSort\Init.lua or one of your own addon files):

    hooksecurefunc(CompactPartyFrame, "RegisterEvent", function()
        print("RegisterEvent called on CompactPartyFrame.")
    end)
    hooksecurefunc(CompactPartyFrame, "RefreshMembers", function()
        print("RefreshMembers called on CompactPartyFrame.")
    end)
    FrameSortApi.v1.Sorting:RegisterPostSortCallback(function()
        print("FrameSort performed a sort, hopefully after RefreshMembers was called.")
    end)

If we see RefreshMembers being called after FrameSort, then it's an ordering issue.
If we see RefreshMembers and don't see a FrameSort call, then I'm missing a sort trigger.
If we see RegisterEvent being called, then this might explain an ordering issue.

commented

Don't suppose you've had a chance to re-test with pets enabled?

commented

No, sorry. Was doing glad push these last couple weeks, so I didn't really mess with addons at all. I've added pets back this week though and will be able to fully test again when the season starts this upcoming week.

commented

Been playing quite a bit since Tues and haven't noticed any sorting mistakes related to pets (or otherwise). I'm cautiously optimistic that this is fixed.

commented

That's great news.
Happy to keep this ticket open longer for more testing.

I did have one report recently that frost mage's wele was still causing frames to become unsorted, but I have a feeling they were using an out of date version (still TBC).

commented

Think it's safe to close this off now as fixed.
Will still keep an eye on things and re-open if the issue arises again.

Thanks for all your testing and help with this @clicketz!