tests/one-offs/thin_population.py writes a copy of a save with fewer characters. It is a diagnostic, not an update rule: the copy is for testing, not for playing. It answers questions like “does this hitch, or this slowdown, get smaller when the save has fewer people?”. It is not part of migrate, and it never changes the save you give it.
python -I tests/one-offs/thin_population.py "Campaign.ck3" "Campaign__no-prunable.ck3" --mode prunable
python -I tests/one-offs/thin_population.py "Campaign.ck3" "Campaign__few-dead.ck3" --mode dead
python -I tests/one-offs/thin_population.py "Campaign.ck3" "Campaign__half-commoners.ck3" --mode living-half --seed 1
With the optional tools add-on, ck3update tools run thin_population "Campaign.ck3" "Campaign__no-prunable.ck3" --mode prunable runs the same script.
prunable: removes every character in characters/dead_prunable, the dead the game itself may forget.dead: removes those, plus every dead_unprunable character that nothing still needs. A dead character is kept when any of these mentions them: a living character (as a parent, a killer, …), a title (a holder in its history), or a house or dynasty (a head, past or present).living-half: removes half of the living characters who play no part. It never removes:
Which half is chosen depends only on --seed: the same seed on the same save removes the same people.
In dead and living-half, a character is also kept when a section of the save mentions them whose references this tool does not know how to remove, such as secrets, schemes or wars. Each run lists how many were kept, and why.
Every reference to them goes too, so the copy has no links to people who are not in it:
character_lookup line;ck3_save_migrator/idschema.py) knows a character id sits loses the reference: an item in a list (children, knights, kills), a key=value line (a dead character’s liege), or a typed reference.The tool prints the counts: characters removed per section, characters kept per reason, records deleted, and references dropped per field. It then runs the lint’s checks on the copy and prints the number of errors, which should be 0.