ck3-save-updater

gamediff: what a game update changed

When Crusader Kings III updates, a save from the old version can stop loading because something it names is gone or works differently: a trait removed, a title moved, a faith renamed, a game rule option dropped. gamediff compares the two versions’ game files definition by definition and, given a save, says which of the removed or changed definitions that save actually uses. It is meant for writing patches: it tells you where to look.

It reads only. It never changes the game folders or the save, and writes nothing except the file you name with --json.

Using it

ck3update gamediff "old/game" "new/game"
ck3update gamediff "old/game" "new/game" --save "My_Old_Campaign.ck3" --json "update.json"

Each folder is a CK3 install’s game folder (the one holding common, events, history and map_data). To compare two versions you need both installed somewhere, for example a copy of the old game folder kept before updating.

The output lists, for each folder that differs, how many definitions were added, removed and changed, and their names:

common/traits: 1 added, 1 removed, 1 changed
  added   : new_trait
  removed : gone_trait
  changed : brave
...
total: 3 added, 5 removed, 7 changed, in 10 folder(s)
the save names 7 of the removed or changed keys (My_Old_Campaign.ck3):
  traits     removed : gone_trait
  traits     changed : brave
  titles     removed : k_old_kingdom

Up to 30 names are shown per line; --json holds every one. -q leaves only the counts and the save’s lines.

What is compared

Some definitions sit below the top level, so they get groups of their own:

What “the save names” means

With --save, the save’s gamestate is read once and every name in it is collected, quoted or not. Then each removed or changed key of these kinds is looked up in that set:

Kind Groups
traits common/traits
titles common/landed_titles
faiths common/religion/religions (faiths)
religions common/religion/religions
cultures common/culture/cultures
modifiers common/modifiers, common/event_modifiers
buildings common/buildings
game rules common/game_rules and its options

A key counts as used when the save contains it as a name anywhere. This is a pointer, not a proof: a short, common name can appear in a save for another reason. Check each one in the save before writing a patch for it.

What it does not do

The other half: what the game’s own conversion does

gamediff compares the game’s files. It cannot say what the new version does to an old save when it loads one. For that, load a save in the new version, save it again, and score the pair:

python -I -X utf8 scripts/conversion_scorecard.py "Old.ck3" "Old_resaved_in_the_new_version.ck3"

It reads every database in both saves and puts each in one of four classes:

The last line sums it up in one sentence, ready for release notes.

Run a control first: two saves that differ in a few known entries, such as a save and the same save after one ck3update edit. The scorecard must show those entries and nothing else. If it shows more, do not trust the real run.

On 1.20 to 1.21 the game kept 98.6% of a migrated save’s entries and built 20 new sections, among them trade markets and districts. It dropped what the player had built: most buildings, the wonders, construction in progress, activities and some vassal contracts.

The scorecard reads one level into each entry. A holding’s buildings sit deeper, so count those separately.