RimSort / RimSort

RimSort is an open source mod manager for the video game RimWorld. There is support for Linux, Mac, and Windows, built from the ground up to be a reliable, community-managed alternative to RimPy Mod Manager.
GNU General Public License v3.0
272 stars 33 forks source link

Alphabetical Sorting Ignores Certain Rules #326

Open Drexl opened 5 months ago

Drexl commented 5 months ago

Describe the bug Multiplayer mod (and probably others) does not sort as expected when Hugslib is present in the load order. Sorting for multiplayer is catastrophic because it's about.xml is seemingly ignored. Some other mods in a 200+ mod order also got thrown in really weird places, but probably nothing that would cause issues. However, everything gets sorted differently when hugslib gets removed, and is back to the order I generally expect to see, and similar to what I was used to with RimPy.

To Reproduce Steps to reproduce the behavior:

  1. Use the following load order: Bug.zip https://rentry.co/pnrm4xt4 (alternative to above if you prefer)
  2. Sort
  3. Notice that Multiplayer remains above core game files, although about.xml places it below them.
  4. Remove Hugslib
  5. Sort
  6. Notice that Multiplayer sorts as expected.

Expected behavior At a minimum, for about.xml sorting rules to be respected, but preferably to see other weird sorting behavior resolved (see additional context)

Screenshots image image

Please complete the following information:

Additional context Issue occurs with our without community database. Using the RimPy database also makes no difference. Switching to Topological sorting method (alpha is default) does improve things in the sense that multiplayer gets placed below the core files listed in it's about.xml, however mods are still sorted wildly differently based on the presence of Hugslib, and only look "normal" when Hugslib is absent.

In this context "normal" just means the order I'm used to seeing from RimPy. RimSort and RimPy sort very similarly when Hugslib isn't present in the order, but for whatever reason it's inclusion throws it off so much it makes me nervous other issues beyond just ignoring about.xml might be happening.

hk21702 commented 3 months ago

@Drexl Apologies for the late response. What sort mode are you using? If you are using alphabetical, have you tried topological?

Edit: Based on the provided logs, I think you are using alphabetical. Can you try using topological and then report back?

Drexl commented 3 months ago

@hk21702 I did try both. A brief summary of the results can be found a the bottom of my original post. If there is something specific you'd like me to try though let me know. ^_^

LionelColaso commented 3 months ago

Does this issue still exist regardless of sorting algorithm even on latest Edge Build

Drexl commented 3 months ago

I just tried on 1.0.9-edge38+cb5861b and the issue persists exactly as in the original post. Topological sorting also behaves in the same atypical manner described in the original post until hugslib is removed. @LionelColaso

hk21702 commented 3 months ago

@Drexl So I tried it myself with your load order, albeit without anomaly. I can confirm that the issue arises when using alphabetical, but when using topological it seems to be okay. image The rules are all respected. I'm not entirely sure what you mean by "atypical". Do you mind giving a screenshot of what you would consider to be "normal"?

If all of the given rules are respected, then assuming that the rules are complete, the other incidental load order shouldn't matter. If there is an issue in game even if all the rules are respected, that means a rule is missing. In that case, you can add that rule yourself by adding it to your user rules through the rules editor, and reporting it to the community rules database.

Topological will produce results that are a bit different from RimPy because how they do the sorting is different, but as long as the rules are satisfied, its not 'incorrect'. There are cases where rules that should have been added fly under the radar because RimPy's method just happened to sort the mod in a certain way, but those cases are an issue of incomplete rules.

Using the RimPy database also makes no difference.

RimSort doesn't use the RimPy database if you're talking about the SteamWorkshop mod. The format that the .json that mod comes with may be compatible with RimSort if you extract the file itself and place it in the correct spot or set the community database setting to point to it (I haven't tested it myself).

Drexl commented 3 months ago

@hk21702 I'm glad to hear you're able to reproduce the issue with alpha sorting. When I refer to topological sorting being "atypical" here is what I mean:

With topological sorting and HugsLib in the order: image

Topological sorting and no Hugslisb: image

Why are even the core expansions getting broken up? Now, maybe it's fine. I've not gone through my 200+ mod list manually to make sure every rule is getting followed and no issues occur. Perhaps topological sorting results in no issues at all, but this anomaly is uncomfortable at the very least and I suspect would give most novice modders pause. I'm inclined to not trust it when one mod wildly alters my load order like that, even a major library like hugslib. Perhaps that's a fear founded on ignorance, and those more experienced with RimWorld's data structure would see no issue with it, but most users will be ignorant.

Although... most users will also not change from the default alpha sorting either so.... 🤷. As long as it's gets fixed with alpha sorting I guess it doesn't matter much.

hk21702 commented 3 months ago

I think I can be confident in saying that no defined rules are broken. The results that you are seeing is due to how topological sorting works in how it achieves a valid ordering. Given a set of rules there are many different possible valid ordering. RimSort considers any ordering where the rules are satisfied to be valid.

Technically, there is nothing wrong going on. It does look a little weird but that's just incidental. There may be in game issues that arise because people tend to stick to alphabetical/rimpy and rules that should have been defined just fly under the radar because alphabetical just happened to create a solution that by sheer coincidence avoids the issue.

I'd you want to force RimSort topological to sort such that everything is expected when no rules are technically broken, I recommended you define your own user rules in the rules editor.

hk21702 commented 3 months ago

On the more technical side as to why just including hugslib is doing this, there are a lot of rules involving hugslibs. This means lots of relationships. What topological sort does to ensure these rules are followed is by making topological levels. Each level consists of a group of mods that don't have any relation within itself but do have a relationship with other topological levels. When more relations are defined naturally more topological levels are defined. RimSort to make things look better, not only sorts these topological levels, but also sorts the mods within each level alphabetically. Thus, when there are lots of small levels, you may see slightly weird looking but fully valid results.

Limfjorden commented 5 days ago

@hk21702 So should we not consider this issue resolved, and close it?

hk21702 commented 5 days ago

Technically, Alphabetical is still broken in the sense that some rules are being ignored. Using topological is preferred and seems to work fine, but I'd keep this open until alphabetical actually gets fixed.