Sort item icons in rich text by where they would appear in the inventory

Post your ideas and suggestions how to improve the game.

Moderator: ickputzdirwech

Sachertorte
Inserter
Inserter
Posts: 25
Joined: Wed Sep 06, 2017 2:53 pm
Contact:

Sort item icons in rich text by where they would appear in the inventory

Post by Sachertorte »

Train stops are currently sorted alphabetically. When train stop names contain rich text icons, this ordering becomes nonintuitive, because the '[item=internal-entity-name]' syntax is invisible to the user. While the user might still guess that the stops are sorted alphabetically by item name, in languages other than English this is near impossible - the ordering appears to be effectively random. There's a mental barrier to picking a train stop from a long list.

I propose sorting rich text icons by their entity's internal 'order' string so that icons in train stops are ordered the same as the player's inventory. I feel this ordering is very intuitive.

In the below example note how the science stops, circuit stops are all next to each other and 'in order'. The current behaviour on the left, while logical, appears nonsensical in comparison.

train-stop-sorting.png
train-stop-sorting.png (70.46 KiB) Viewed 2521 times

I have implemented this as a mod, with a separate UI for listing the stops: https://mods.factorio.com/mod/ordered-r ... rain-stops


Old OP archived 2023-10-25
Last edited by Sachertorte on Tue Oct 31, 2023 2:42 am, edited 6 times in total.
User avatar
NotRexButCaesar
Smart Inserter
Smart Inserter
Posts: 1133
Joined: Sun Feb 16, 2020 12:47 am
Contact:

Re: Sort icons by their position in the crafting menu

Post by NotRexButCaesar »

Sachertorte wrote: Thu Apr 08, 2021 6:50 pm the ordering appears to the layman (me) to be effectively random (see image).
Those icons are really hidden text. If you copy paste into a text editor you will see something like [item=automation-science-pack]. https://wiki.factorio.com/Rich_text
The text is then sorted alphabetically:
  • plastic-bar
  • production-science-pack
  • productivity-module
  • rail
  • steel-plate
  • stone-brick
  • stone
  • sulphur (get it right devs :twisted:)
  • transport-belt
—Crevez, chiens, si vous n'étes pas contents!
User avatar
ssilk
Global Moderator
Global Moderator
Posts: 12889
Joined: Tue Apr 16, 2013 10:35 pm
Contact:

Re: Sort icons by their position in the crafting menu

Post by ssilk »

This is very hard to be fixed, because the internal name will not change anymore, but the displayed name is translated.

The sorting routine must do the same as the display-routine: scan over the name, pick out the icons, lookup the translation for this icon, and replace it with the icon. Then it can start to sort. For some long lists will influence the performance hard.
NotRexButCaesar wrote: Thu Apr 08, 2021 6:56 pm [*] sulphur (get it right devs :twisted:)
Both writings are correct English.
Cool suggestion: Eatable MOUSE-pointers.
Have you used the Advanced Search today?
Need help, question? FAQ - Wiki - Forum help
I still like small signatures...
User avatar
jodokus31
Smart Inserter
Smart Inserter
Posts: 1621
Joined: Sun Feb 26, 2017 4:13 pm
Contact:

Re: Sort icons by their position in the crafting menu

Post by jodokus31 »

ssilk wrote: Fri Apr 09, 2021 5:25 am
NotRexButCaesar wrote: Thu Apr 08, 2021 6:56 pm [*] sulphur (get it right devs :twisted:)
Both writings are correct English.
"sulphur" seems to be british and "sulfur" american
GrumpyJoe
Filter Inserter
Filter Inserter
Posts: 491
Joined: Fri Apr 06, 2018 7:10 pm
Contact:

Re: Sort icons by their position in the crafting menu

Post by GrumpyJoe »

Alumin(i)um
chchch :twisted:
Sachertorte
Inserter
Inserter
Posts: 25
Joined: Wed Sep 06, 2017 2:53 pm
Contact:

Re: Sort icons by their position in the crafting menu

Post by Sachertorte »

ssilk wrote: Fri Apr 09, 2021 5:25 am This is very hard to be fixed, because the internal name will not change anymore, but the displayed name is translated.

The sorting routine must do the same as the display-routine: scan over the name, pick out the icons, lookup the translation for this icon, and replace it with the icon. Then it can start to sort. For some long lists will influence the performance hard.
If the code to create a stone wall icon, for example, is [item=stone-wall] in English regardless of client language (I assume "stone-wall" is the 'internal name'), surely alphabetising this syntax by position in the crafting menu would replace looking up that item's name in the client language? It might be a heavier operation but if that's correct then it's at least not additive.
jodokus31 wrote: Fri Apr 09, 2021 7:49 am
ssilk wrote: Fri Apr 09, 2021 5:25 am
NotRexButCaesar wrote: Thu Apr 08, 2021 6:56 pm [*] sulphur (get it right devs :twisted:)
Both writings are correct English.
"sulphur" seems to be british and "sulfur" american
I'm British and I have a Master's degree in chemistry - sulfur is the 'correct' spelling and it brings me unending pain
User avatar
NotRexButCaesar
Smart Inserter
Smart Inserter
Posts: 1133
Joined: Sun Feb 16, 2020 12:47 am
Contact:

Re: Sort icons by their position in the crafting menu

Post by NotRexButCaesar »

ssilk wrote: Fri Apr 09, 2021 5:25 am
NotRexButCaesar wrote: Thu Apr 08, 2021 6:56 pm [*] sulphur (get it right devs :twisted:)
Both writings are correct English.
I know, it was sarcasm.
—Crevez, chiens, si vous n'étes pas contents!
Krid
Burner Inserter
Burner Inserter
Posts: 6
Joined: Mon Apr 08, 2019 1:02 am
Contact:

Re: Sort icons by their position in the crafting menu

Post by Krid »

my workaroud suggestion: (works in most ERP Systems untested for factorio)

get a Name Icon
get b Name Icon
get c Name Icon

or if you need more letters for sorting:
get ab Name Icon
get ac Name Icon
get a Name Icon

or if that not enough
get aaa Name Icon ....

(if you use 2 or more letter codes as prefix; i guess you can even put the icon in front)
Sachertorte
Inserter
Inserter
Posts: 25
Joined: Wed Sep 06, 2017 2:53 pm
Contact:

Re: Alphabetise item icons in rich text by inventory order

Post by Sachertorte »

I've been thinking about a mod that attempts to implement this, but I don't think it's feasible.

In theory, creating the new order should be easy. If the lexograhpical sort function can be hijacked, or if another sort can be inserted inside/after each method that produces such a list, e.g. LuaGameScript::get_train_stops:
  1. Get the train stop name, e.g. from my first screenshot, "get [item=productivity-module]Modules"
  2. For each rich text icon syntax in the string, extract the internal name of the item
  3. Look up the order string from the corresponding item prototype - e.g. game.entity_prototypes[name].order
  4. Subsitute the order string back into the train stop name - e.g. "get c[productivity]-a[productivity-module-1]Modules"
  5. Sort the first list using the second list as the key
Problem is I don't think it's possible to just insert that behaviour somewhere and call it a day. You can't just override class methods in Lua like you can in, say, Ruby. You can't just have the trains GUI call this new function - not without building an entirely new GUI that looks the same, anyway, and that's way out of scope for this (and for me!)

Anyone have any suggestions on how it might be possible to get a mod to do this?
Illiander42
Filter Inserter
Filter Inserter
Posts: 521
Joined: Mon Feb 05, 2018 10:01 am
Contact:

Re: Sort icons by their position in the crafting menu

Post by Illiander42 »

ssilk wrote: Fri Apr 09, 2021 5:25 am [*] sulphur (get it right devs :twisted:)
Both writings are correct English.
[/quote]

We really need to normalise the knowledge that English and American are different, but mutually intelligable languages. Same as the Danish/Norwegian/Swedish set.
Koub
Global Moderator
Global Moderator
Posts: 7784
Joined: Fri May 30, 2014 8:54 am
Contact:

Re: Alphabetise item icons in rich text by inventory order

Post by Koub »

TBH, I'm not fond of the suggestion. Icons are icons, and the alphabet is the alphabet. Sorting with alphabetic order is one thing, ordering pictures by the the alphabetic order of the word they're supposed to represent is another.

Even sorting characters can be tricky when numbers are involved : should the sorting be alphabetical or numerical based ? Order 5, 320, 12, 130, and 20.
5, 12, 20, 130, 320 (by increasing numbers) or 12, 130, 20, 320, 5 (increasing number in the alphanumeric ordering) ? There is no consensus, and off topic in the context of the original suggestion, just an example that not all sorting systems are universal. And sorting pictures is probably the least universal of all :)
Koub - Please consider English is not my native language.
Illiander42
Filter Inserter
Filter Inserter
Posts: 521
Joined: Mon Feb 05, 2018 10:01 am
Contact:

Re: Alphabetise item icons in rich text by inventory order

Post by Illiander42 »

How about we sort pictures by the RGB values in the order they are in the pixel buffer, sorted alphabetically? Just to get really confusing :mrgreen:
Qon
Smart Inserter
Smart Inserter
Posts: 2164
Joined: Thu Mar 17, 2016 6:27 am
Contact:

Re: Sort icons by their position in the crafting menu

Post by Qon »

ssilk wrote: Fri Apr 09, 2021 5:25 am This is very hard to be fixed, because the internal name will not change anymore, but the displayed name is translated.
It's not hard.
It doesn't really matter if it changes. The order it is in now is not really the one you expect if you use the GUI to enter the icons anyways. But you find it by scrolling through the list, and a familiar order of icons will feel more consistent. Who selects train stops by list index number?
Translated name is irrelevant for the thread. No one asked for translated name to affect the order. And even if the order changed every time you changed display language, who cares? And no one changes display language anyways.
ssilk wrote: Fri Apr 09, 2021 5:25 am The sorting routine must do the same as the display-routine: scan over the name, pick out the icons, lookup the translation for this icon, and replace it with the icon. Then it can start to sort. For some long lists will influence the performance hard.
Not translation, the sort order property. It's another internal string. But a computer can sort a million items instantly. The list order is only updated when stations are added or removed or renamed. Yeah doing lookups will slow the process down a bit, but this happens so rarely. And how much will it slow down this rare task, really? If done in Lua yeah maybe you could skip a frame when adding a station on the largest train base ever. But it's not like people doing rails to the edge of the map add a stop on every tile with a million unique icon prototypes to iterate through. And even if they did, the sort is already happening and you aren't arguing against presenting in text order all together for speed ups.
Koub wrote: Wed Oct 25, 2023 11:45 am TBH, I'm not fond of the suggestion. Icons are icons, and the alphabet is the alphabet. Sorting with alphabetic order is one thing, ordering pictures by the the alphabetic order of the word they're supposed to represent is another.
You didn't understand the suggestion. Currently the icons ARE sorted in alphabetical order (of the internal name). You arguing for the status quo is you arguing against your reasoning.

Facts: The user benefits from having the list sorted in a predictable order. The list is strings of both icons and letters. The icons are internally represented by text strings, but this is not obvious to all users and can't be a reason for arguing that the order is the expected one. It's sorting on text currently, but it doesn't have to be that way when names can be exclusively icons now. The internal name doesn't even perfectly correspond to the EN translation. But for users playing with another display language the icons being sorted by an English internal name will be completely unpredictable unless they write in the icons as text themselves.

If the icons were sorted in same order as the display language translation, then users could replace the name in a train station with the icon and the stations would stay in the same order, meaning they could scroll to the end of the list to quickly find the sulfur if it was spelled "zzzulfur" in their language, regardless if the name was written or represented by the sulfur icon. That would be an improvement for them.

If the icons were sorted in the same order as the crafting GUI, then that is also a familiar order that helps you quickly scroll to the right position to find the stop named [sulfur icon].

But yes, it would be slower. And it would require dev time. And is it really necessary? I might be convinced either way that the dev time is not worth it for a useless feature, personally I am building self building factories so I don't need a GUI at all mostly. But you can't convince me that the current system is the only one the devs are capable of programming and other better solutions are too hard. You can't convince me that the current order is better for the users, all else being equal. It's objectively inferior for the users that the icons are sorted "randomly".
My mods: Capsule Ammo | HandyHands - Automatic handcrafting | ChunkyChunks - Configurable Gridlines
Some other creations: Combinassembly Language GitHub w instructions and link to run it in your browser | 0~drain Laser
Koub
Global Moderator
Global Moderator
Posts: 7784
Joined: Fri May 30, 2014 8:54 am
Contact:

Re: Sort icons by their position in the crafting menu

Post by Koub »

Qon wrote: Wed Oct 25, 2023 4:11 pm
Koub wrote: Wed Oct 25, 2023 11:45 am TBH, I'm not fond of the suggestion. Icons are icons, and the alphabet is the alphabet. Sorting with alphabetic order is one thing, ordering pictures by the the alphabetic order of the word they're supposed to represent is another.
You didn't understand the suggestion. Currently the icons ARE sorted in alphabetical order (of the internal name). You arguing for the status quo is you arguing against your reasoning.

Facts: The user benefits from having the list sorted in a predictable order. The list is strings of both icons and letters. The icons are internally represented by text strings, but this is not obvious to all users and can't be a reason for arguing that the order is the expected one. It's sorting on text currently, but it doesn't have to be that way when names can be exclusively icons now. The internal name doesn't even perfectly correspond to the EN translation. But for users playing with another display language the icons being sorted by an English internal name will be completely unpredictable unless they write in the icons as text themselves.

If the icons were sorted in same order as the display language translation, then users could replace the name in a train station with the icon and the stations would stay in the same order, meaning they could scroll to the end of the list to quickly find the sulfur if it was spelled "zzzulfur" in their language, regardless if the name was written or represented by the sulfur icon. That would be an improvement for them.

If the icons were sorted in the same order as the crafting GUI, then that is also a familiar order that helps you quickly scroll to the right position to find the stop named [sulfur icon].

But yes, it would be slower. And it would require dev time. And is it really necessary? I might be convinced either way that the dev time is not worth it for a useless feature, personally I am building self building factories so I don't need a GUI at all mostly. But you can't convince me that the current system is the only one the devs are capable of programming and other better solutions are too hard. You can't convince me that the current order is better for the users, all else being equal. It's objectively inferior for the users that the icons are sorted "randomly".
I see what you mean. You mostly convinced me on this one.

Mostly but not totally, because I see the point of a reliable sorting order, but I think sorting works best when is a consensus on how it should be sorted.
Should the order be "as in the crafting menu" (aka universal), or "as in the current language display name" (aka language specific) ? Can't be both, and if one is chosen, people expecting the other will be disappointed.
Do you think most people expect the "name" sorting, or the "crafting menu" sorting ?
Koub - Please consider English is not my native language.
FuryoftheStars
Smart Inserter
Smart Inserter
Posts: 2768
Joined: Tue Apr 25, 2017 2:01 pm
Contact:

Re: Sort icons by their position in the crafting menu

Post by FuryoftheStars »

Koub wrote: Wed Oct 25, 2023 5:33 pm Do you think most people expect the "name" sorting, or the "crafting menu" sorting ?
Regardless of if anyone expects "name" sorting (I'm sure there are some out there), the same order as in the crafting menu does make more sense. As the example given with science packs, name sorting will put them all over the place instead of clumped together. That, too, and the current internal name that it sorts by doesn't always start with the exact letter/word that someone would expect it to who isn't familiar with them.
My Mods: Classic Factorio Basic Oil Processing | Sulfur Production from Oils | Wood to Oil Processing | Infinite Resources - Normal Yield | Tree Saplings (Redux) | Alien Biomes Tweaked | Restrictions on Artificial Tiles | New Gear Girl & HR Graphics
Sachertorte
Inserter
Inserter
Posts: 25
Joined: Wed Sep 06, 2017 2:53 pm
Contact:

Re: Alphabetise item icons in rich text by inventory order

Post by Sachertorte »

Qon wrote: Wed Oct 25, 2023 4:11 pm It's objectively inferior for the users that the icons are sorted "randomly".
It seems like it should have been so obvious in retrospect, but yes I did initially think the stops were effectively random, as I mentioned in the OP. And that's an excellent point about it being even worse for users not using the English locale. Perhaps that indicates this isn't such a weird suggestion after all :P
Koub wrote: Wed Oct 25, 2023 5:33 pm Should the order be "as in the crafting menu" (aka universal), or "as in the current language display name" (aka language specific) ? Can't be both, and if one is chosen, people expecting the other will be disappointed.
Do you think most people expect the "name" sorting, or the "crafting menu" sorting ?
Definitely the universal option. I think the only person in this thread advocating for alphabetical-by-localised-item-name sorting was ssilk, who I suspect might have also misinterpreted what I was asking for. (a few people have done this, so that's my fault for not being clear enough!)

The sort order per the crafting menu is IMO just intuitively the order that icons are supposed to be in. I don't care that Advanced Circuits come before Electronic Circuits alphabetically, at least in English, and that's not how my brain processes it - red circuits always come after green circuits and that just feels like that's how it should be. Anything else is a cognitive dissonance, at least for me.
Qon
Smart Inserter
Smart Inserter
Posts: 2164
Joined: Thu Mar 17, 2016 6:27 am
Contact:

Re: Sort icons by their position in the crafting menu

Post by Qon »

Koub wrote: Wed Oct 25, 2023 5:33 pm I see what you mean. You mostly convinced me on this one.
Re-read my message until you are convinced then q:

Ok, I'll slot in the final pieces...
Koub wrote: Wed Oct 25, 2023 5:33 pm Mostly but not totally, because I see the point of a reliable sorting order, but I think sorting works best when is a consensus on how it should be sorted.
Should the order be "as in the crafting menu" (aka universal), or "as in the current language display name" (aka language specific) ? Can't be both, and if one is chosen, people expecting the other will be disappointed.
Do you think most people expect the "name" sorting, or the "crafting menu" sorting ?
Currently everyone is disappointed, ~0% of users would choose the current order. Either is better than the current system.

And no, I don't think anyone is going to be "disappointed" that the items aren't sorted on their display language name. It's preferred to the current one, but none of them are asking for the crafting menu to be sorted on name or localized name. The order they appear in crafting menu is the way they usually experience their order, it will be just fall so natural to find them in that order that they will not think of scrolling to where the item would have been if the name was written out. No one actually deeply wishes for their localized names they write in their train stop names that are then converted to icons to stay in the same order. It's just preferable the current random sorting that confuses them. When the order changes because they change text to icons the train stops will just appear in such a natural order that they probably won't notice that the order changed, they will just move on playing the game without noticing that in the past others would encounter random stop listing sorting.

The items have a sort order property, literally called "order", a string property that exists for the items to be sorted on.

It's obvious what the objectively correct answer is. No one will be disappointed. 100% user satisfaction. Only the type of person that complains about a bug fix would argue for a change from the correct answer to anything else.
Image
My mods: Capsule Ammo | HandyHands - Automatic handcrafting | ChunkyChunks - Configurable Gridlines
Some other creations: Combinassembly Language GitHub w instructions and link to run it in your browser | 0~drain Laser
Koub
Global Moderator
Global Moderator
Posts: 7784
Joined: Fri May 30, 2014 8:54 am
Contact:

Re: Sort icons by their position in the crafting menu

Post by Koub »

Qon wrote: Wed Oct 25, 2023 6:49 pm [...]
Okay, okay, I'm sold. Sorting the icons with the same order as in the crafting menu would probably be the best solution.

One of my two favourite xkcd strips BTW :lol:.
Koub - Please consider English is not my native language.
Sachertorte
Inserter
Inserter
Posts: 25
Joined: Wed Sep 06, 2017 2:53 pm
Contact:

Re: Alphabetise item icons in rich text by inventory order

Post by Sachertorte »

I've added an image to the OP with a visual example of what I'm hoping for, to hopefully make it crystal clear to everyone (and any devs who happen to stumble across this post) what this suggestion is about :)
Sachertorte
Inserter
Inserter
Posts: 25
Joined: Wed Sep 06, 2017 2:53 pm
Contact:

Re: Alphabetise item icons in rich text by inventory order

Post by Sachertorte »

Alright, I've gone ahead and made my first mod to implement this as a proof-of-concept.

Mod can be found here: https://mods.factorio.com/mod/ordered-r ... rain-stops
Github: https://github.com/rossjrw/factorio-ord ... rain-stops

This mod adds a pane to the train UI with a list of all stops on that train's surface, ordered as per this thread's suggestion. Example screenshot on the mod page.

Trying to actually use it in a larger world reveals a couple of shortcomings - e.g. fluids are unsorted, duplicate stops aren't condensed, no indication of whether the train can actually reach each stop - but as a first proof-of-concept this is more than sufficient IMO. I'll be using and tweaking it going forward.

I'd still really like to see this behaviour in the base game, as even in its current state I'd personally much rather use this makeshift menu over the current dropdown (at least when I have to sift through a hundred stops). I really do feel that this order is an objective improvement everyone could benefit from.

Thanks to _CodeGreen and Bilka for lending a hand with understanding how GUIs work in Discord.


Example screenshot from the mod page
Mod source code
Last edited by Sachertorte on Tue Oct 31, 2023 11:28 am, edited 1 time in total.
Post Reply

Return to “Ideas and Suggestions”