RimWorld

RimWorld

664 ratings
Better GC: Mothballed and World Pawns
17
5
5
3
4
4
4
2
5
4
4
2
2
   
Award
Favorite
Favorited
Unfavorite
Mod, 1.4, 1.5, 1.6
File Size
Posted
Updated
93.410 KB
May 28, 2023 @ 2:46pm
Jul 15 @ 9:55am
14 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 (1)
9
Aug 17, 2023 @ 9:06am
Rocketman
CrusaderRO
317 Comments
Skeleton Man Aug 22 @ 9:13am 
Ive been meaning to look into this deeper but ive got a similar issue with 30,000 world pawns that refuse to be purged even with the most aggressive cleanup settings. I suspect it might have to do with raider swarm compression but I don’t think so.
KeiChan0215 Aug 21 @ 3:18am 
My 11 pawns died because they got mothballed on a quest lol
willy Aug 18 @ 8:34am 
For some reason my save is only getting rid of around 10 pawns while keeping 2500+ around. Does anyone else have this issue or know what mods might be impacting it? I thought it was maybe the 'grudges' mod but it wasn't. My next guess is possibly the vanilla royalty expanded which adds to the royal family and is deeming them all as important? Any help would be appreciated!
Chunky Aug 17 @ 9:28pm 
Very good mod, but I hope that you'll address the problems posted in the comments. Thank you for your work!
sSs1897 Aug 17 @ 2:53pm 
Same as Stryyyder, can confirm if you enable the quest cleanup stuff it bricks both gravship (will not generate mechhive) and relic
Stryyyder Aug 15 @ 6:54am 
completed subquests shouldn't be automatically deleted. Since quest deletion is on by default, i loaded in to find my progress toward finding my relic and the gravship questline completely reset...
[PR] HavenOnline Aug 14 @ 10:51am 
whats a mothball
WildStargazer Aug 13 @ 12:17pm 
Mod works very well with vanilla game, a must have for me.
Raptor42 Aug 13 @ 9:01am 
I wish you could exempt some pawns from being removed - like colonists' lovers that are off-map and were not part of the colony before. As it stands, it looks like you either get rid of everyone or nothing at all.
Ravayen Aug 11 @ 7:02am 
Nvm 25/25 pages back there was an entire experiment that covered it lol +1 for going back through the comments, should prob put that compatibility in the description.