Difference between revisions of "Optimization"

From Crusader Kings II Wiki
Jump to navigation Jump to search
m (Updating categorization, replaced: {{Version|Monks and Mystics}} → {{version|2.7}})
Line 1: Line 1:
{{Version|Monks and Mystics}}'''Optimization''' is a set of mechanisms and techniques that ensures that the game performance remains acceptable after hundred years.
+
{{version|2.7}}'''Optimization''' is a set of mechanisms and techniques that ensures that the game performance remains acceptable after hundred years.
  
The game performance mainly depends on the number of living characters, on whom events need to be processed, and that need to kept in the save files<ref>[[forum:962057]]</ref>.
+
The game performance mainly depends on the number of living characters, on whom events need to be processed, and that need to kept in the save files.<ref>[[forum:962057]]</ref>
 
The number of character is itself closely tied to the number of provinces.
 
The number of character is itself closely tied to the number of provinces.
 
But it is worth noting that courts are only generated for characters above baron level (except for patricians), so adding more barons has considerably less of an effect on performance than adding more counts.
 
But it is worth noting that courts are only generated for characters above baron level (except for patricians), so adding more barons has considerably less of an effect on performance than adding more counts.
Line 50: Line 50:
 
Note that another trigger of pruning is the inheritance of a title: rather than moving all characters of the old court of the title to the court of the new holder, some characters are pruned.
 
Note that another trigger of pruning is the inheritance of a title: rather than moving all characters of the old court of the title to the court of the new holder, some characters are pruned.
  
Due to a different behavior<ref>https://forum.paradoxplaza.com/forum/index.php?threads/2-7-1-ovsf-immortals-pruned-as-unimportant.1009237/</ref>, these characters die of <code>death_natural</code> reason and some of the checks above (immortal, ...) are bypassed.
+
Due to a different behavior,<ref>https://forum.paradoxplaza.com/forum/index.php?threads/2-7-1-ovsf-immortals-pruned-as-unimportant.1009237/</ref> these characters die of <code>death_natural</code> reason and some of the checks above (immortal, ...) are bypassed.
  
 
==Save compression==
 
==Save compression==

Revision as of 11:25, 5 November 2017

Optimization is a set of mechanisms and techniques that ensures that the game performance remains acceptable after hundred years.

The game performance mainly depends on the number of living characters, on whom events need to be processed, and that need to kept in the save files.[1] The number of character is itself closely tied to the number of provinces. But it is worth noting that courts are only generated for characters above baron level (except for patricians), so adding more barons has considerably less of an effect on performance than adding more counts.

Pruning

Pruning is the removal of unimportant characters, so that the number of courtiers remains reasonable and game performance acceptable due to events & decisions processed on courtiers.

It balances out the random character generation used to populate courts, since characters may not die naturally as fast as new ones get generated.

Pruned characters are killed with death reason death_vanished, aka "vanished without a trace".

Pruning is controlled by:

  • NDefines.NEngine.COURT_PRUNE_SIZE = 10: courts larger than this will be checked for pruning each month
  • NDefines.NEngine.HEALTH_IMMUNITY_TO_PRUNING = 7: if a character has that much health, they won't be pruned
  • NDefines.NEngine.PRUNE_MINIMAL_AGE = 40
  • Courtiers who have minor titles, friends, lovers, consorts or rivals are excluded
  • Immortal characters are excluded
  • Characters marked as special interest by the player are excluded.

There's also a related scripted trigger used in some mass disease events:

is_unimportant_trigger = {
	NOR = {
		is_married = yes
		is_landed = yes
		has_job_title = yes
		has_minor_title = yes
		AND = {
			NOT = { dynasty = none }
			num_of_dynasty_members = 2
		}
		any_lover = { ai = no }
		any_close_relative = { ai = no }
		any_friend = { ai = no }
		any_rival = { ai = no }
		any_consort = { ai = no }
		num_of_claims = 1
		has_character_flag = eternal_life_mystic
		trait = horse
		has_character_modifier = in_seclusion
		immortal = yes
	}
}

Note that another trigger of pruning is the inheritance of a title: rather than moving all characters of the old court of the title to the court of the new holder, some characters are pruned.

Due to a different behavior,[2] these characters die of death_natural reason and some of the checks above (immortal, ...) are bypassed.

Save compression


Script optimizations


References