Save game compatibility

From Crusader Kings II Wiki
Jump to navigation Jump to search

Save game compatibility is the ability to load a save file created with version N of vanilla and a mod with the version N+1 of vanilla or that mod, and continue playing without issues.

Keeping save compatibility[edit | edit source]

Generally entities cannot be removed or renamed (except if doing some save conversion):

  • Removing a culture would result in characters with that culture in the save file getting noculture culture upon loading the save.

In addition you need to be careful about:

  • Adding any traits, since they are not stored by their name in the saves, but the numeric index in which they were loaded at the time. So if a trait is added in vanilla at the last index, it will show up for characters that had the trait with first index in the mod - and all traits will be wrong by 1 index.
  • Adding a new title set to be inactive at game start through a history file (active = no), as it will remain active when loading from a save file.
  • Changing the potentials of buildings: building from the save will still be present in the holding when potential doesn't match, but would not appear on the building list.
  • Adding new laws: the "default" law will not get determined when loading from a save, so player may not be able to select any law in that group depending on how the conditions are written.

When new counties are added on the map, and loading a save with missing title holder, a random nearby ruler should get the title. However vanilla map extensions have been known to break save compatibility in the past.

Automatic save conversion[edit | edit source]

As of patch 2.7.1, a new folder common/save_conversion/ allows to apply automatic migration of some entity names when loading a save.

The syntax is:

<entity_type> = {
	<old_name> = <new_name>

The supported entities are:

  • Religions:
religions = {
	bektashi = hurufi
  • Societies:
societies = {
	secret_religious_society_buddhism = secret_religious_society_buddhist
	secret_religious_society_hinduism = secret_religious_society_hindu

Manual save conversion[edit | edit source]

For some changes, it is possible to create an on_startup event that does some conversion via scripting:

  • changing a modifier or flag into another one, or removing them.
  • removing traits, ...

Compared to the automatic save conversion, it requires old entity definitions to still be present in the mod (even if not used in the new version), in order to be usable via scripting.