VRCX icon indicating copy to clipboard operation
VRCX copied to clipboard

[Bug] Playerlist sorting by name is not identical to 'Sorted by Name' in VRChat itself

Open Wasmachineman-NL opened this issue 1 year ago • 5 comments

Title. VRChat's playerlist ignores special characters while VRCX doesn't, making crossreferencing the ingame playerlist significantly harder.

Wasmachineman-NL avatar Dec 14 '23 20:12 Wasmachineman-NL

This sounds like the correct alphabetical order to me, how does it differ?

Natsumi-sama avatar Dec 30 '23 22:12 Natsumi-sama

This sounds like the correct alphabetical order to me, how does it differ?

What I would like to see is that VRCX sorts players exactly as the game itself does, since I often crossreference the playerlist for reasons I will not go into publicly.

Wasmachineman-NL avatar Dec 30 '23 22:12 Wasmachineman-NL

But how does the game sort differently, what weird sorting are they using?

Natsumi-sama avatar Dec 30 '23 22:12 Natsumi-sama

Special characters are ignored by VRChat itself when sorting the playerlist ingame.

If user X is called Bart and user Y is called Вart then VRCX doesn't sort them properly when using Sort by Name in VRCX.

Wasmachineman-NL avatar Dec 30 '23 22:12 Wasmachineman-NL

So I actually did some investigation into this, and long story short it's a lot harder than it may seem. I'm just gonna gloss over the details, but because VRChat is built using Il2Cpp, the .NET backend is (a custom fork of) mono. As a result, string comparison is different than regular .NET, yielding different sorting orders when dealing with unicode characters. Therefore, to fix this issue, VRCX would have to reimplement mono's string comparison behavior.

I'm fairly certain that VRChat uses this method while sorting. However this presents many challenges:

  • Reimplementing it would involve several thousand lines of code.
  • It would probably need to be done in JavaScript to avoid the performance drawbacks interop has.
  • There is a chance that VRChat uses a different comparison method, leading to many wasted hours coding and starting at square one.
  • There is also a chance that Unity's fork of mono changes sorting behavior. I already saw small differences when I was doing my investigations, so this is relatively likely.

That being said, I am 100% sure that it compares the display names of users directly and does no preprocessing (as of writing this). I'm also almost certain the only CompareOptions it passes in is IgnoreCase.

I'd also like to say that investigating this has taken about 30 hours off my life for such a simple small little fix and still no satisfying conclusion. So, to end off, I would just like to curse VRChat, Unity, Il2Cpp, and mono. Anyway, I think this should be marked with Good First Issue

loukylor avatar Aug 26 '24 09:08 loukylor