The limits of Rimworld

Started by PartyCowboy, August 09, 2019, 05:38:02 AM

Previous topic - Next topic

PartyCowboy

Hi, I've been working on a mod lately to lock every item in Rimworld behind a tech for a true "start with nothing' start. I've finished the Core module (basically it only does the base game) but of course I play with about 130 mods. All those mods add various stuff as well, and for the sake of immersion and completeness, I made separate patch-mods for groups of mods, based on the content that they add (so a patch-mod for apparel mods, one for building mods etc.). Of course, I created and tested a mod and its patch individually.

Now, the thing is, two days ago I finished my little project and tried loading the whole batch in one go. The result of that was Rimworld showing me those three little dots it shows you when it is loading something for more than a couple of hours. And believe me, I had it running all night, just to see if it would do something. But alas, it wouldn't even go to the main menu!

I had no idea what the issue could be, so I downloaded the mod StartupImpact to see what was going on, and tested each patch mod individually again. And afterwards I tested multiple groups. I found out that the total patch time is not the sum of its parts; its way more! Yet, it only refuses to load the main menu when I have all my mods loaded, five of the seven patch mods active and add one of two: the building mods patch or the industry mods patch (or both, but that's obvious I think)

Discouraged, I did not know what was going on. In hopes of more info I downloaded the mod BetterLoading, which shows you the various sections of loading that Rimworld does. And what happened was somewhat within my expectations, but still a bit disheartening: it is the fourth loading beam that goes full, and then progress stops; Rimworld is waiting for patches to be applied.

Glad that my theory was correct, although still not closer to the heart of the problem, I came up with a new theory: it could be a hardware issue, because I'm playing on a mac-mini from late 2012, which is somewhat old. To test this latest theory of mine I installed Steam and Rimworld and all the mods on the other mac, which is from late 2015, and started it up with the working bits (so no building or industry patch mod). It started in about 40% of the time it took my mac-mini (50 s total with 30 s for mods instead of 120 s total with 70 s for mods), so that was great news! Excited, I tested it with the whole list of mods and added the Industry mods patch mod, only to have my hopes dashed: Rimworld stopped at the fourth beam once again.

So my question and plea to you, the wonderful modding community of Rimworld, is the following:
Do those of you who are more experienced in modding have any idea what is going on? Because I do not...

Thank you.



The list of mods I'm using can be found here

LWM

I wonder if you would do a little test for my curiosity:

https://github.com/lilwhitemouse/RimWorld-PatchSpeedTest/

If you would run that after most of your mods have been loaded (before it starts to break hard).

The 4th stage where it's stopping at is the patching stage?

PartyCowboy

Okay, I'll do that test. And yes, it loads the fourth bar and then it just hangs there, only cmd + Q would get me out of it.

PartyCowboy

Okay, so test with the /Defs/etc clocked in at 00:01:50.14
The Defs/etc clocked in at 00:01:50.97

I do have one question though: in your README you said as the fourth point that */etc was only a 10% difference. Is that difference an acceleration or a deceleration? Because currently I'm using */etc as xpath, and now I'm wondering if maybe that's the problem...
Thanks!

LWM

You definitely don't want to use */Defs/whatever as an xpath unless you have a very good reason.  But it looks like you're not seeing a whole lot of difference in the times, one way or another.  /Defs/whaever is the best way to write an xpath, but I don't think you need to worry about that right now.

I do wonder if there's some sort of circular resolution going on somehow in the code.

How good are your Harmony skillz?


PartyCowboy

Yeah, I think so too, because when I load just one of the breaking modules without all the working modules, the sixth bar, where it says how many defs its creating from patched defs, increases from 8556 with all the mods and just the Core module, to 57083 with all the mods, the Core module and the breaking module.

But at the moment my Harmony skills are nonexistent. I'd love to learn though, I currently have the time for it.

What (preferably free) programs would I need to work with Harmony that work on mac? And are there any tutorials to get started? I'll look into it myself, but perhaps you have some tips?

Thanks!

LWM

Start reading on the "setting up a framework" on http://rimworldwiki.com/

PartyCowboy

Okay, that's done. I followed all the steps using Visual Studio. Only took some time, because VS Mac's layout is a tad different than the one they used for the tutorial, but I made it work as it should. What's next doc?

LWM

Okay.  This is ...not subtle.  But:

https://gist.github.com/lilwhitemouse/5e41882ee870df6dc31d4af5625a7849

If you give me a day or two, I'll get it posted on GitHub as a full mod, but if you want to see what's going on with the patching...Pop that file into a C# project and put the assembly into a proper mod structure and it should create a file on your desktop when RimWorld starts up.

Then you get to look at the logs....which is a lot of fun, right?  But you're looking for loops, for repeated lines, for the same thing getting called over and over.

That might not show what's going on, but...it might.

--LWM

PartyCowboy

Thank! I'll try that!

Edit: I put the file in a C# project and put the assembly in a mod folder, but it throws an error, saying that I'm missing an assembly for the System.Xml type or namespace. What did I miss? I put in the references to 0Harmony, Assembly-CSharp and UnityEngine assemblies...

Razuhl

Just fix your xpath on the insert statements. You are not matching a specific research project by omitting the def name, you are matching every project which means your new research project gets added once for every other research project.

For example if you add that building mod to a vanilla game with the supported floors mod it shows two errors in the console that occur 75 times. 75 is the number of vanilla research projects. And you have two faulty insert operations in the floor patches.

PartyCowboy

Razuhl, I'll immediately test that, after dinner. I have a fairly large hunch that you are right and that the answer was just in front of me, for all that time...

LWM

Quote from: PartyCowboy on August 11, 2019, 08:29:08 AM
Thank! I'll try that!

Edit: I put the file in a C# project and put the assembly in a mod folder, but it throws an error, saying that I'm missing an assembly for the System.Xml type or namespace. What did I miss? I put in the references to 0Harmony, Assembly-CSharp and UnityEngine assemblies...

Aaaah, well that's stupid and annoying.  Just remove the line involving System.Xml at the very top.  It may very well show you have some Patch that's getting applied over and over and over again - that could do it?

PartyCowboy

It's aliveeee!!!! It works!

Lilwhitemouse, I thank you for your valiant efforts in helping me figure this problem out and your patience in getting me started on C#. I shall give you a big digital hug.
Razuhl, I thank you for providing the answer to this issue that has plagued me for some time and shall give you the most giant of digital hugs!

I thank you for all the efforts and the help you have provided me with during this second modding adventure of mine. Thank you lilwhitemouse and Razuhl.