[0.17.39] Mods with icon beside their name not sorted correctly

This subforum contains all the issues which we already resolved.
mrvn
Smart Inserter
Smart Inserter
Posts: 5682
Joined: Mon Sep 05, 2016 9:10 am
Contact:

Re: [0.17.39] Mods with icon beside their name not sorted correctly

Post by mrvn »

Seriously? How do you even manage to sort mod names in that order?

Every string sort I know first looks at the first character. See, "E" < "Y". Who cares that there is an "[item=whatever]" later in the string. "E" < "Y", end of comparison.

How do you get 100s of lines of code to add to simply ignore rich text all together and just call strcmp() on the string? This would sort all names with icons at the end according to their leading text and then the icons type and name. And mods with icons at the start woult all end up together because they all start with "[", then sorted by type and name of the icon. Which I believe would be perfectly fine and sensible.

Also you already have the sorting of strings with rich text for train stations. Any 100s of lines of code you may or may not need for that are required there. So for train stations you already need and have a function "strcmp_richtext()" (although I don't see why basic strcmp() won't do that job). Simply call the same function in the mod portal. How does that add extra code? Adding a check and preventing rich text in module names seem like it would add more code and maintanance overhead. And you still have to allow it for migration purposes.

Just saying.

Qon
Smart Inserter
Smart Inserter
Posts: 2091
Joined: Thu Mar 17, 2016 6:27 am
Contact:

Re: [0.17.39] Mods with icon beside their name not sorted correctly

Post by Qon »

I agree with mrvn.

This is disappointing. I like rich text in mod names because of the same reason rich text was added to the game in the first place. Pictures makes things easier to find and and faster to recognise than words. My mod list is 6 pages long. And there's no search functionality for your installed mods, just for the mod portal list.

Are you going to remove rich text from train stop names too now Rseding91? Those have to be sorted too. Why not remove all features that require a few lines of code?

"100s of lines of code"... is that a joke?

Rseding91
Factorio Staff
Factorio Staff
Posts: 13173
Joined: Wed Jun 11, 2014 5:23 am
Contact:

Re: [0.17.39] Mods with icon beside their name not sorted correctly

Post by Rseding91 »

Qon wrote:
Mon May 27, 2019 12:48 pm
Are you going to remove rich text from train stop names too now Rseding91?
I would if I was allowed. I would remove it from everywhere except in-game chat.
If you want to get ahold of me I'm almost always on Discord.

User avatar
eradicator
Smart Inserter
Smart Inserter
Posts: 5206
Joined: Tue Jul 12, 2016 9:03 am
Contact:

Re: [0.17.39] Mods with icon beside their name not sorted correctly

Post by eradicator »

@Qon:

The main problem i have with rich text in mod names is that i can not control them. If i don't want them i can't hide them. And i have no doubt that rainbow-colored mod names would be everywhere. Modders would use whatever fancy colors they like best, resulting in a chaotic list and an attention grabbing war where nobody cares about proper GUI contrast or readability. This would be especially bad for people with impaired vision. It would also lead to the same mod having different names in-game and on the portal.

With train-stops i can (and have to) chose the icons *myself*. Which strenghtens my memory link to those names - the very same effect that the new hotbar achieves by forcing everyone to fill it themselfs. I like this alot. And it makes finding names on the large station name drop down list easier.

So imho "in-game" and "out-of-game" are different scenarios and should be treated accordingly.
Author of: Belt Planner, Hand Crank Generator, Screenshot Maker, /sudo and more.
Mod support languages: 日本語, Deutsch, English
My code in the post above is dedicated to the public domain under CC0.

User avatar
mexmer
Filter Inserter
Filter Inserter
Posts: 869
Joined: Wed Aug 03, 2016 2:00 pm
Contact:

Re: [0.17.39] Mods with icon beside their name not sorted correctly

Post by mexmer »

Rseding91 wrote:
Mon May 27, 2019 6:36 pm
Qon wrote:
Mon May 27, 2019 12:48 pm
Are you going to remove rich text from train stop names too now Rseding91?
I would if I was allowed. I would remove it from everywhere except in-game chat.
+2

Qon
Smart Inserter
Smart Inserter
Posts: 2091
Joined: Thu Mar 17, 2016 6:27 am
Contact:

Re: [0.17.39] Mods with icon beside their name not sorted correctly

Post by Qon »

Rseding91 wrote:
Mon May 27, 2019 6:36 pm
Qon wrote:
Mon May 27, 2019 12:48 pm
Are you going to remove rich text from train stop names too now Rseding91?
I would if I was allowed. I would remove it from everywhere except in-game chat.
Removing rich text from mod names isn't a big deal. It's not the users own choice if they want it or not so I can understand how it could become really bad.

I thought rich text was a fairly pointless feature when it was introduced. Train stop names is the most reasonable use case that finally convinced me that rich text was a worthwhile feature. Trains stops almost always have resources in their names and that makes them unweildy long and hard to look through with different lengths. Icons are all the same size and much more fitting in train stop names. I'd rather have it in train stop names than in chat. If you don't understand that then you don't understand the point of rich text.
How often does anyone actually use the chat at all? Most play singleplayer. 99% of multiplayers probably don't bother using rich text ever. If you mention a resource you use a shorthand or type the full (localised, non-prototype) name. Only mods ever really use rich text in chat, and only the few that need to print text often, which is a small % of all the mods.

I'm glad kovarex is the one in charge and not you. You are amazing at fixing bugs and amazing at improving performance and I love the cool things that the mod API lets us do, which you are apparently also the one coding for. But you are not a game designer, that is clear from from reading what you wrote. But not everyone has to be great at all things. Wube is a team, so people can have responsibilities for the areas of their competency. And you are the perfect asset at the right position in the greatest game dev team there is. Thank you for your contributions. <3

mrvn
Smart Inserter
Smart Inserter
Posts: 5682
Joined: Mon Sep 05, 2016 9:10 am
Contact:

Re: [0.17.39] Mods with icon beside their name not sorted correctly

Post by mrvn »

eradicator wrote:
Mon May 27, 2019 6:56 pm
@Qon:

The main problem i have with rich text in mod names is that i can not control them. If i don't want them i can't hide them. And i have no doubt that rainbow-colored mod names would be everywhere. Modders would use whatever fancy colors they like best, resulting in a chaotic list and an attention grabbing war where nobody cares about proper GUI contrast or readability. This would be especially bad for people with impaired vision. It would also lead to the same mod having different names in-game and on the portal.

With train-stops i can (and have to) chose the icons *myself*. Which strenghtens my memory link to those names - the very same effect that the new hotbar achieves by forcing everyone to fill it themselfs. I like this alot. And it makes finding names on the large station name drop down list easier.

So imho "in-game" and "out-of-game" are different scenarios and should be treated accordingly.
I can see that you want to prevent abuse of rich text in mod names. That is a good argument but something that can be dealt weith on the upload side. Don't let modders upload mods that do crazy things in their mod names. But that has nothing to do with the mod names in game. User could have crazy mod names locally if they so desire and the official mod protal would have sane names.

I'm still interested how the original weird sorting of mod names happened. I simply can't see any way to code a sane string compare function that would behave the way it did. Can you share the part of the code that resulted in that?

Rseding91
Factorio Staff
Factorio Staff
Posts: 13173
Joined: Wed Jun 11, 2014 5:23 am
Contact:

Re: [0.17.39] Mods with icon beside their name not sorted correctly

Post by Rseding91 »

If you want to get ahold of me I'm almost always on Discord.

mrvn
Smart Inserter
Smart Inserter
Posts: 5682
Joined: Mon Sep 05, 2016 9:10 am
Contact:

Re: [0.17.39] Mods with icon beside their name not sorted correctly

Post by mrvn »

At first glance that seems sane. Lines 156-160 should ensure that "foo[item=iron-ore]" comes after "bla", which was not the case. Did you figure out where it went wrong to sort the mods so wrong? And why does it work on train stops or does that have a different compare? From looking at the code I can't spot it. From looking at the code I would say that is the sort the train stops use.

I also thought that compare_left() would buffer overflow since there is no test for 0 termination like in compare_right(). But at second glance I recognized that nat_isdigit(0) is false so the loop breaks correctly. Which also applies to compare_right(). Line 84 is dead code as line 72 already covers that case I believe.

User avatar
eradicator
Smart Inserter
Smart Inserter
Posts: 5206
Joined: Tue Jul 12, 2016 9:03 am
Contact:

Re: [0.17.39] Mods with icon beside their name not sorted correctly

Post by eradicator »

mrvn wrote:
Thu May 30, 2019 9:36 am
At first glance that seems sane. Lines 156-160 should ensure that "foo[item=iron-ore]" comes after "bla", which was not the case.
Except if it's

Code: Select all

[color=white]foo
Author of: Belt Planner, Hand Crank Generator, Screenshot Maker, /sudo and more.
Mod support languages: 日本語, Deutsch, English
My code in the post above is dedicated to the public domain under CC0.

mrvn
Smart Inserter
Smart Inserter
Posts: 5682
Joined: Mon Sep 05, 2016 9:10 am
Contact:

Re: [0.17.39] Mods with icon beside their name not sorted correctly

Post by mrvn »

eradicator wrote:
Thu May 30, 2019 10:51 am
mrvn wrote:
Thu May 30, 2019 9:36 am
At first glance that seems sane. Lines 156-160 should ensure that "foo[item=iron-ore]" comes after "bla", which was not the case.
Except if it's

Code: Select all

[color=white]foo
Oh, was that what the mods did? Then they got what they deserved in being sorted badly.

The report said the mods got sorted wrong for having an icon at the end of the name. Not for having a color at the front.

Pi-C
Smart Inserter
Smart Inserter
Posts: 1639
Joined: Sun Oct 14, 2018 8:13 am
Contact:

Re: [0.17.39] Mods with icon beside their name not sorted correctly

Post by Pi-C »

mrvn wrote:
Fri May 31, 2019 5:14 am
The report said the mods got sorted wrong for having an icon at the end of the name. Not for having a color at the front.
What was I supposed to do? I was baffled by the fact that the mod name contained an icon but I couldn't see where it was defined. I'd looked at info.json, but didn't know that things like the mod name could also be localized.
I usually do try to do my homework and research a bit before reporting bugs, but it was really hard this time. From about 90+ mods I'd installed, that was the only one where the mod name contained an icon (or "rich text", as I now know I should have called it). I tried to locate other mods with icons in their name using the mods manager, but couldn't because rich text wasn't displayed there. If you're lacking material, you can only guess what's wrong, and describe symptoms (that's why I included the screenshot). The white text looked normal in the mods list, but the icon did stand out -- it was the only obvious difference between this mod and the others, so naturally I focused on it in my description. But symptoms are just symptoms: If you're experienced enough they can give you a clue where to look for the cause of the symptom, otherwise they can lead you off the track.
A good mod deserves a good changelog. Here's a tutorial (WIP) about Factorio's way too strict changelog syntax!

mrvn
Smart Inserter
Smart Inserter
Posts: 5682
Joined: Mon Sep 05, 2016 9:10 am
Contact:

Re: [0.17.39] Mods with icon beside their name not sorted correctly

Post by mrvn »

Pi-C wrote:
Fri May 31, 2019 6:57 am
mrvn wrote:
Fri May 31, 2019 5:14 am
The report said the mods got sorted wrong for having an icon at the end of the name. Not for having a color at the front.
What was I supposed to do? I was baffled by the fact that the mod name contained an icon but I couldn't see where it was defined. I'd looked at info.json, but didn't know that things like the mod name could also be localized.
I usually do try to do my homework and research a bit before reporting bugs, but it was really hard this time. From about 90+ mods I'd installed, that was the only one where the mod name contained an icon (or "rich text", as I now know I should have called it). I tried to locate other mods with icons in their name using the mods manager, but couldn't because rich text wasn't displayed there. If you're lacking material, you can only guess what's wrong, and describe symptoms (that's why I included the screenshot). The white text looked normal in the mods list, but the icon did stand out -- it was the only obvious difference between this mod and the others, so naturally I focused on it in my description. But symptoms are just symptoms: If you're experienced enough they can give you a clue where to look for the cause of the symptom, otherwise they can lead you off the track.
Not your fault. You see a problem, you report a problem. If the problem then turns out to be something else that's life.

What got me was the devs reply after looking at what actually was the underlying problem:
Rseding91 wrote:
Thu May 16, 2019 6:25 pm
Thanks for the report however as the primary person who manages mods and works on the features put in for mods I'm going to say: play stupid games win stupid prizes.

I'm not going to implement some multiple hundreds of lines of code to handle sorting things like this. If mods put rich text bull shit in their mod names then they can deal with the fallout. Or I can disable it for mod names to be sure people don't do it.
To me that reads like: "Yes, having an icon at the end of the mod name totally screws up the sorting function I wrote. And I'm not going to write hundreds of lines of code to make my sort do what strcmp() already does or what the sorting of train station names already does perfectly fine."

What I would have expected from the devs would be more something like this: "The reason why the sorting behaves oddly is not the icon at the end of the name but rather that the mod name starts with:

Code: Select all

[color=white]
The sorting works alphanumerical and '[' comes after 'z'. Everything starting with a color gets thus sorted after everything with a sane mod name.I'm going to say: play stupid games win stupid prizes."

Knowing the real cause now I have to agree. Don't use a color tag in your mod name for so many reasons and this isn't something the sort function should work around But I still like icons in mod names. Just some rich text tags are stupid. All the (potentially) invisible ones.

Rseding91
Factorio Staff
Factorio Staff
Posts: 13173
Joined: Wed Jun 11, 2014 5:23 am
Contact:

Re: [0.17.39] Mods with icon beside their name not sorted correctly

Post by Rseding91 »

The train GUI actually uses the exact same sort function:
schedule order.PNG
schedule order.PNG (24.02 KiB) Viewed 2394 times
That's with a white color tag around the "[z"
If you want to get ahold of me I'm almost always on Discord.

Post Reply

Return to “Resolved Problems and Bugs”