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 be kept in the save files.[1] The number of characters 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 monthNDefines.NEngine.HEALTH_IMMUNITY_TO_PRUNING = 7
: if a character has that much health, they won't be prunedNDefines.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.
Health Penalty
All unimportant characters(look above) receive health penalty depending on court size.
Court Size | Health Penalty |
---|---|
0..9 | -1 Health |
10..19 | -1.5 Health |
20..29 | -2 Health |
30+ | -3 Health |
Court size is hardcoded but health penalties are governed by parameter
Fertility Penalty
Reduces the number of children characters can have by one. It affect anyone who does not have a close relative that is landed, as long as there are at least 30 people in the court.
Governed by NDefines.NCharacter.COURT_SIZE_CHILD_PENALTY_THRESHOLD
parameter.
Save compression
这是一篇小作品。你可以通过编辑或修订扩充其内容。 如果可以请尽你所能的去协助完善这篇文章。 |
Script optimizations
这是一篇小作品。你可以通过编辑或修订扩充其内容。 如果可以请尽你所能的去协助完善这篇文章。 |