The Better GC Mod is meant to improve game performance.
Better GC Mod features
Better GC 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:
- RIMMSqol – some pawns reportedly removed from the cities introduced by mod.
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.
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.