RimWorld

RimWorld

590 ratings
Better GC: Mothballed and World Pawns
17
5
5
3
4
4
2
4
4
4
2
2
2
   
Award
Favorite
Favorited
Unfavorite
Mod, 1.4, 1.5
File Size
Posted
Updated
73.938 KB
28 May, 2023 @ 2:46pm
14 May @ 7:20pm
13 Change Notes ( view )

Subscribe to download
Better GC: Mothballed and World Pawns

Description
The mod is meant to improve game performance.

The BGC mod does the following:
  • better pawn mothballing (XML patch)
  • reduces the number of world pawns that the game keeps forever through garbage collection (C# patch)
  • pawn garbage collection is customizable

For the improved mothballing, it patches some of the core/biotech hediffs, as well as the following:
  • Expanded Prosthetics and Organ Engineering
  • Diseases Overhauled
Let me know about other mods that may need a patch.

It makes little to no impact on new games (since the world's not bloated yet), but rather intended for the games that ran for a while.

Reported possible incompatibilities/special cases:
  • RIMMSqol - some pawns were reportedly removed from the cities introduced by the RIMMSqol mod. Version 1.4.0.6 of the BGC mod added "more gentle pawn cleanup" option, and when the option is on, the pawns are reportedly kept. So please use that option when playing with RIMMSqol or other mods creating long-term non-vanilla map objects storing pawns.
  • Performance Fish - PF mod description claims incompatibility, but I had reports from players claiming the two mods work just fine. The possible incompatibility seems to be related to the fact that the PF has its own Garbage Collection tweaks and settings which will be ignored by this mod. Of course, the best way to proceed is to make a backup before trying.


FAQ:
1. What's the difference between this mod and No Reasons To Avoid Mothballing?
  • This mod patches hediffs by adding allowMothballIfLowPriorityWorldPawn property, while the other mod adds alwaysAllowMothball property. The latter method is more aggressive, so you will end up with fewer ticking pawns, but with a higher risk of mothballing an important pawn that was not supposed to be mothballed.
  • On top of the 2 different properties that were added, the list of patched mods is different.
  • Most importantly, this mod removes old references to non-existing pawns


Please read before installing the mod for the details, technical or otherwise.

TLDR:
1. More pawns mothballed due to allowMothballIfLowPriorityWorldPawn tag (xml patch)
2. Better pawn cleanup by GC for those pawns that were not seen for over 1 year (runs on save load).

I've been running a colony for 7 years, and my performance eroded from 600-700 TPS to 100-120 TPS, while the savefile expanded from 25M to 80M.
I started debugging and discovered that my save file had almost 2000 pawns that were not processed by the garbage collector, and, on top of it, 200+ of those pawns were "active", so each of them "ticked".

The reason for the 200+ active pawns that were not mothballed was diseases.
The game code prevents pawn mothballing if the pawn has hediffs unless the hediff has allowMothballIfLowPriorityWorldPawn tag.
The main culprit (for my case) was the DiseasesOverhauled mod (that added a bunch of hediffs without the tag), and GeneticDrugNeed hediff added by Biotech expansion.
So the mod does just that: it patches some hediff by adding allowMothballIfLowPriorityWorldPawn tag to them.
As a result my number of ticking pawns went down from 200+ to 80+.

The second thing was bloated world pawns storage.
Pawns never get discarded if they have relations to other pawns or appear in logs somewhere.
So after you've got a bunch of big raids, you're bound to get some pawns with relations. They will be kept, probably forever.
To remedy that I added a patch that runs when the world is loaded from the save.
The patch checks if the pawn could be garbage collected (meaning, it's not an "important" pawn, e.g. not a faction leader, kidnapped, caravan member, reserved for a quest, has a corpse present on the map, etc),
then it checks that the pawn was a "WorldPawn" (meaning it was not seen by a player) for over a year (5 years if the pawn belongs to your faction), and then the patch clears pawn relations and the log entries the pawn appears in.
Then, the mod triggers a pawn mothballing and garbage collection process, so you don't have to wait until the game runs it on its own (toggleable).

In my case, it brought down the number of world pawns from 2000 to under 1000.

All in all, my savefile size went down from 80M to 58M, and my TPS went up from 100-120 to 250-270 TPS.
YMMV, depending on how many pawns you've got in your save file and whether you use Diseases Overhauled mod.

It's still in beta, though I have 150+ mods and it seems to run fine.
Please let me know if there are other common diseases that have to be patched.

Since some mods may handle pawns in unexpected ways, please make sure to make a backup copy of your save file before trying this mod.

[ko-fi.com]
Popular Discussions View All (2)
9
17 Aug, 2023 @ 9:06am
Rocketman
CrusaderRO
0
5 Jun @ 5:00pm
Compatibility request
st.rusik
286 Comments
Szilreo 12 Jul @ 5:13am 
1.6 plz,we need this
Felnel 11 Jul @ 3:24pm 
This mod will go to 1.6?
水晶哥牌音响 11 Jul @ 10:02am 
1.6 please
Tree 11 Jul @ 7:33am 
please update this mod. It is crucial. :steamhappy:
Chromium 11 Jul @ 6:00am 
I love it when you load up the save it gives you a report, gives the feeling that the game is released from a little preassure every time, I love it. We need this in 1.6 hope you are alright and you can upgrade it. :darkangel:
Monbland 2 Jul @ 5:24pm 
1.6 UPDATE PLEASE!
Stryyyder 22 Jun @ 6:16pm 
do ex-colony pawns that get diplomatically married off to another colony via the 'romance on the rim' mod get mothballed? i have a tendency of accepting in random pawns and immediately marrying them off for faction relations, and am only now realizing that might be messing my game lol
WildStargazer 15 Jun @ 10:24am 
Mod options are not working on 1.6, empty window.
WildStargazer 14 Jun @ 5:14am 
Seems to be working on 1.6
John Smith 12 Jun @ 12:27pm 
Is this being fixed in 1.6?