• We have updated our Community Code of Conduct. Please read through the new rules for the forum that are an integral part of Paradox Interactive’s User Agreement.

CK2 Dev Diary #18: Optimization and modding

Good afternoon. I’m Magne Skjæran, and I’m currently interning as a programmer on Crusader Kings 2. Some might also know me from administrating the Paradox Wikis. My internship is reaching its end, so it was decided that a good way to cap it off would be for me to write a dev diary about two of my favorite topics: optimization and modding.

As you all know, as the game goes on it has a tendency to get slower and slower, mainly due to the gradual increase in the number of characters around. This can be especially annoying for users on weaker computers, but anyone that runs speed 5 is likely to notice.
Beyond that, we’ve got a few points where the game will halt for several seconds. The biggest of these is autosaves, but there’s also a pause at the end of each year, and a smaller pause at the end of each month.

We’ve not only made the effort to reduce these pauses significantly but also to improve the speed of the game generally. This has been hugely successful.
With 2.6, late-game autosaves are in our tests over twice as quick as they used to be, while the year-end lag is now barely more noticeable than the month-end lag, which has also been reduced significantly.
General, daily performance is also significantly faster; the individual days take less time to process.
Overall, in our tests, the game will get 30-50% further in the same period of time. Thus, in the time 10 years would take on speed 5 in 2.5.2, you’ll now most likely get 13-15 years into the game, and with far smaller annoying pauses.

We’ve achieved this through a combination of many different optimizations:
  • Uncompressed saves are now smaller than they used to be, saving compression and write times
  • Saves are now saved in a more efficient manner
  • Almost everything that happened at the end of the year is now distributed across the year instead, so as to avoid the noticeable pause
  • We’ve made improvements to the rendering of the map to speed it up significantly
  • We’ve gone through cases where map modes, names, etc. were being marked as “outdated” on the map and in the UI, and ensured they’re actually only updated when truly in need of update. As an example, previously the occupation overlay would sometimes be marked as needing an update when no occupation status had actually changed, which of course would waste CPU cycles
  • Several computations that used to be single-threaded are now multi-threaded
  • Various improvements to a variety of performance-intensive computations
  • Fewer random characters are generated than previously, and the game more aggressively eliminates unnecessary characters
To illustrate the last point, here’s the number of living characters by year from one of my test games:
vMnckpc.png


I don’t have a similar chart from 2.5, but as a point of comparison, 400 years into an old 769 save we had lying around there were 30 000 living characters, almost twice the number my test save peaked at.

Finally, you don’t just have to take my word for this; here’s a video showing 2.5.2 and 2.6 running side by side:

Now, let’s move on to modding.

I used to mod Crusader Kings 2, being one of the founders of the excellent Historical Immersion Project, so modding is a topic that’s very dear to me.

I know from experience that often modders have to write convoluted workarounds because the information they need isn’t easily available. I’ve therefore spent time both at work and on my free time implementing useful triggers and effects, even in cases where we at PDS have had no immediate need for those triggers. Divine has also spent time implementing a variety of modding features suggested by users, and other members of the team have implemented features that have been needed for Reaper’s Due. A number of bugs that affect modders have also been fixed, and a handful of new console commands added.

All told, our modding changelog is a bit over a hundred items long, and a number of items consist of more than one new trigger or effect.

The full list of modding changes in 2.6:
- Added possibility to have major province modifiers
- Causes of death can now be customized
- Execution method can be chosen via a priority system similar to government flavors
- added "health_penalty", "fertility_penalty", "martial_penalty", "intrigue_penalty", "diplomacy_penalty", "stewardship_penalty", "learning_penalty"
- a set of modifiers whose sum for a given stat can never be positive (allows your giving bonuses that only offset maluses instead of bonus that are positive no matter what)​
- Added military_techpoints, economy_techpoints, culture_techpoints as generic modifiers (for province modifiers)
- Added "any_demesne_province" as an effect
- holdings/settlement modifiers can now be hidden
- Added "has_any_symptom" and "symptom=" triggers
- Added "num_of_symptoms" trigger
- Added "spawn_disease" effect which spawns a specific disease in a specific province
- Scope must be a province
- "spawn_disease=disease_name"​
- Added "start_outbreak" which forces an outbreak, but follows the scenarios set up in the disease.txt file
- "start_outbreak=disease_name"
- Scope is not used​
- Added "on_outbreak" OnAction which is called when a new outbreak starts
- scope is the province where the outbreak starts
- token_data is the disease name​
- Added "scenarios" to diseases: they exclude certain regions and determine possible starting provinces
- Added various defines for modifiers to contagiousness of disease when determining the spread. They are only used with The Reaper's Due DLC
- Added yearly "on_province_major_modifier" on_action
- Added "regional_percentage" trigger:
regional_percentage = {
region = andalusia
percentage = 0.5

has_province_flag = aztec_explorers​
}​
- Added hospital_level trigger that tests the hospital level in a province. Province scope
- Added disease_defence trigger that tests the disease defense in a province. Province scope
- Added "has_game_rule" trigger to test the value of a game rule:
has_game_rule = {
name = gender
value = all​
}​
- Added triggers:
any_hospital
num_of_hospitals
num_of_hospitals_diff
has_hospital
hospital_has_any_building
is_hospital_decision_allowed
is_hospital_decision_potential​
- Added Event scope:
hospital_owner​
- Added supported_checksum = yes/no trigger. Added supported_checksums = { ABCD EFGH } field in .mod files. When supported_checksum trigger is used in game it tries to match the current checksum of the game with the entries in all active mods mod-files. The trigger returns true if it finds at least one match.
- Fixed an issue for mods trying to remove localisation from the base game's localisation.
- targeted_decisions, is_targeted_decision_allowed and is_targeted_decision_potential are now considered aliases for targetted_decisions, is_targetted_decision_allowed and is_targetted_decision_potential respectively and are evaluated in the same way.
- Fixed a CTD that could happen for mods that allowed you to play characters with only titular titles.
- scaled_wealth and transfer_scaled_wealth now supports an additional max field to cap the maximum amount of wealth gained/lost.
- Added enatic trait attribute equivalent of the agnatic attribute (which allowed certain traits, eg Sayyid, to always be inherited from the father).
- Added define MERCHANT_REPUBLIC_MAX_PATRICIANS which determines the amount of merchant republic families the game will allow to exist in a merchant republic.
- Added triggers monthly_prestige and monthly_piety.
- Added effects scaled_prestige and scaled_piety.
- It is now possible to script council voting for targeted_decisions.
- The council interface should now support voter minor titles with a grant limit higher than one (1).
- Added set_pentarch_title = <title/none> effect.
- The pentarchy entry in landed titles can now be assigned to a specific religion rather than all religions with autocephaly.
- Using title_prefix in a government definition should no longer default all non-prefix defined title names to the default versions.
- Ambitions are now valid for the ai aggression modifier "aggression".
- add_character_modifier and add_holding_modifier now supports the stacking = yes parameter.
- Added has_holding_modifier = x trigger that returns true of the holding has modifier x.
- Added has_instances_of_character_modifier, has_instances_of_province_modifier, has_instances_of_holding_modifier = { modifier = x amount = y } trigger where y is the amount of current applications of modifier x that the character needs to currently hold for the trigger to return true.
- Added remove_character_modifiers, remove_province_modifiers, remove_holding_modifiers = { modifier = x amount = y } effects that removes y amount of modifier x from the current scope.
- Added on_trade_post_construction_completed, on_fort_construction_completed on_action entries.
- Added on_trade_post_construction_start, on_fort_construction_start on action entries.
- Fixed some issues with on_settlement_construction_start on_action events.
- Added GetHusbandWifeCap, GetHusbandWifeCapOpp, GetMasterMistressCap, GetMasterMistressOpp, GetMasterMistressCapOpp character localisation functions.
- any_character trigger should no longer exclude the ROOT scope in it's evaluation.
- Fixed a possible issue with hidden effects inside scripted effects.
- Added trigger 'leader_traits' (number of)
- Reactivated the on_action 'on_focus_pulse'
- Disease effects are now customizable through script per disease
- Silk Road modifier icon can now be set in the text file
- Added define AUTOMATICALLY_ACCEPTS_COALITION_CALLS to determine if defensive pacts members automatically join at the start of wars
- Converted the Family Focus events to on_action events
- Fixed a bug where the 'end_war' effect would incorrectly invalidate wars
- The 'regent' event target is now properly invalidated if there is no regent
- Added trigger 'any_player'
- Added effect 'any_player'
- Added effect 'random_player'
- Added define WAR_CONTRIBUTION_THEOCRACY_GHW_MULT
- Fixed era bookmarks ignoring their defined text keys. WARNING: This means that your mod's era names are likely now unlocalised
- Fixed buttons F9 through F12 not working as shortcuts
- Fixed a number of triggers functioning identically when set to "= no" as when set to "= yes"
- has_terrain_specialization now takes "yes" and "no" as parameters as well, in addition to "any" and specific terrains
- Added missing localisation for a handful of triggers
- Era screen characters can now be restricted based on dlc by adding 'dlc = "dlc name"' to their entry
- Fixed the time control buttons being inactive in 867.1.1 in mods starting on or before that date
- Opinion modifiers can now be scripted to be stacking (default) or not
- Added a give_birth console command (requires existing pregnancy; use pollinate/cuckoo to impregnate)
- Added on_action 'on_holding_building_start'
- Added has_assigned_minor_title trigger. Usage: "has_assigned_minor_title = title_master_of_the_horse" or "has_assigned_minor_title = { title = title_commander count = 2 }"
- Added has_children and has_living_children triggers
- The "loot" trigger will no longer crash the game if applied to a land unit. It will always return false for land units, but it won't crash
- has_minor_title now also accepts "yes" and "no", to check whether the character holds any minor titles at all
- Can now add and destroying buildings in extra holdings (trade posts, forts & hospitals) with the following effects:
add_to_extra_holding = {
type = hospital
building = leper_colony_1​
}

destroy_in_extra_holding = {
type = hospital
building = leper_colony_1​
}​
- The following effects have been added. They work the same as the equivalent for forts or trade posts:
create_hospital
destroy_hospital
any_hospital​
- Scripted effects in event options will now show the traits and characters they affect
- Added a war_participation trigger. Example: any_war = { war_participation = { who = ROOT score = 0.5 } }
- Added an is_landed_title_allowed trigger, which checks whether a character fulfills the "allow" section of a specific title. Example: is_landed_title_allowed = e_hre or is_landed_title_allowed = ROOT, where ROOT is a title
- Added a "force_host" effect that forcibly changes the host a character. Scope should be the character being moved, target should be the character's new host.
Shouldn't be used lightly
force_host = ROOT​
- Added join_faction, leave_faction and start_faction effects.
- Added faction_exists trigger.
- Added export_to_variable effect.
- Added while effect.
- Title prefix defined in landed_titles.txt should now support localisation variations dependent on the holder of the title.
- Added sound_effect effect.
- It should now be possible to make baronies independent through history editing.
- Added a "character_stats" console command that prints a variety of statistics to the console, such as the # of rulers of each tier, gender breakdown, and total wealth. This also gets written to stats.log
- Added a "dynasty_stats" console command that prints a variety of statistics to the console, such as the # of dynasties, number of single-person dynasties, and number of dynasties with only dead characters. This also gets written to stats.log
- Added a COURT_PRUNE_SIZE define, which defines when the game will try to find unneeded courtiers to kill off. Lowered to 10 from the original 20
- Added a "de_facto_liege_title" trigger, which checks that the defacto liege title of a character or title is the right-hand side. Example: ROOT = { de_facto_liege_title = e_hre }. Both sides can take a character or a title. If a character is provided, their primary title will be used. A defacto_liege_title scope already existed, but this should make some operations easier
- Added an "immortal" trigger, which checks if the character in the current scope is immortal
- Added an "is_incapable" trigger, which checks if the character in the current scope has an incapacitating trait
- Added an "is_pilgrim" trigger, which checks if the character in the current scope has a pilgrim trait
- Added a "same_regnal_name" trigger, which checks if the character in the current scope has the same regnal name as another character, meaning that they'll be considered the same name for the purpose of regnal numbering. Regnal names are currently defined as having the same first first name (E.G., "Gustav" and "Gustav Adolf" are the same regnal name), or the same cultural first first name (E.G., "Alfr_Alf" and "Alf_Alf" are the same regnal name)
- "monthly_income" and "yearly_income" can now be used in a holding scope. Before it could only take a character. Example: "b_constantinople = { yearly_income = 15 }"
- Added a "has_inheritance_blocker" trigger, which checks if the character in the current scope has a trait that blocks inheritance (cannot_inherit = yes)
- Added a "dynastic_prestige" trigger, which checks if the dynasty of the character in the current scope has a prestige of at least the given value. Example: "dynastic_prestige = 100"
- Added a "set_preferred_capital" effect, which sets the preferred capital of the title in the current scope (used for a variety of things, such as the AI to determine where to put their capital). Only works for dynamic titles, as static titles base their capital off of the landed_titles folder
- Added a "lacks_dlc" event pre-trigger. If the DLC is enabled, the event will not be evaluated
- Added a "has_dlc" event pre-trigger. If the DLC is disabled, the event will not be evaluated
- Added a "war" event pre-trigger, which takes "yes" or "no", and checks that the character is/isn't at war
- Added a "is_married" event pre-trigger, which takes "yes" or "no", and checks that the character is/isn't married
- Added a "friends" event pre-trigger, which takes "yes" or "no", and checks that the character does/doesn't have friends
- Added a "rivals" event pre-trigger, which takes "yes" or "no", and checks that the character does/doesn't have rivals
- Added a "has_global_flag" event pre-trigger, which checks that the given global flag has been set
- Added support for an after = { } - effect field in events. It works as a counterpart to immediate and executes after any option is executed.
- Replaced the COALITION_PROVINCE_THREAT_RATIO define with COALITION_SCARY_TROOP_STRENGTH_THREAT_RATIO. It is now actually used by the game
- Decisions now take the pre-triggers "only_rulers", "only_landed", and "only_independent". It is recommended that they be used when possible so as to reduce the time spent by the AI evaluating the decision. Note that the pre-trigger currently only applies to the AI, not to the player
- The "is_occupied" trigger now works in province scope, not just title scope
- The "is_occupied" trigger now works for county-level titles, not just baron-level titles
- "plot_decisions" are now only checked by characters that lead a plot or faction. Previously there was no functional difference between plot decisions and regular decisions
- Added "has_flag" as a quick trigger for province events. It works exactly like the "has_character_flag" quicktrigger, except the scope is the province for the event
- Added on_war_ended_invalid and on_crusade_invalid on_actions, that provide the same scopes as the other on_war_ended and on_crusade on_actions
- Added a CROWN_LAW_CHANGE_TIMER define. If set to 0, rulers will be restricted to MAX_CROWN_LAW_CHANGES. If set to 1, they'll have a CROWN_LAW_CHANGE_MONTHS cooldown
- Added a CROWN_LAW_CHANGE_MONTHS define
- Traits can now be hidden. Adding "hidden = yes" will make it invisible in all parts of the UI (except event options, where they can be hidden using hidden_tooltip)
- Added define "FAR_CRUSADES_WITHOUT_WEIGHT_MODIFIER" as a weight modifier to starting crusades on titles that are not adjacent to territory of our religion and don't have a crusade weight modifier. Default value is 75%

One of the biggest is likely the addition of game rules, as described in an earlier dev diary.
With game rules, you can add new settings that your users can use to configure your mod. No longer will you need day 1 events or decisions to handle that in a relatively unintuitive and inflexible way, but you can instead have the user configure it in the same way they configure vanilla rules.
Any number of game rules can be added, with any number of possible values. Want to give the option to have a Shattered World scenario for example? Put it in the game rules, and have a hidden startup event do the shattering based on the rule, rather than having the user fire a day 1 decision.
Game rules can be referenced anywhere in script, so they can be used for virtually any purpose where user configuration is relevant.

Finally, I’ve also written a post about things modders can do to make their mods faster. You can read it in the modding sub-forum. I’ve kept it separate so that modders can have a place to ask their questions, and get answers from an inside perspective, separately from this dev diary:
https://forum.paradoxplaza.com/forum/index.php?threads/official-mod-optimization-tips.962056/

That’s all for today. The Reaper’s Due and 2.6 will both be out on the 25th of August, so it won’t be long before you can experience all of these performance and modding improvements for yourself. I hope you’ll all enjoy the improvements made as much as I’ve enjoyed coding them!
 
  • 248
  • 80
  • 2
Reactions:
Unnecessary characters are simply killed off.
Characters are considered unnecessary if none of the following are true:
  • They're a ruler
  • They're imprisoned
  • They've got parents
  • They've got a spouse
  • They've got children
  • They've got a council position
  • They've got a claim
  • They're under age 40
How large a court has to be for it to be checked for such characters can be modded in defines.lua. It is set to 10 in 2.6.

Is this for the player's court as well, or just for AI?

Overall, I'm a little concerned that it's going to nerf my "find old single ladies to marry after I have my heir" strategy but in general I like it...
 
Will the Black Death only effect Europe or can it show up in the middle east and India as well?

Why should the Black Death be Limited to Europe? You know the Black Death was coming from the Middle East?
 
  • 5
Reactions:
Does that include dead parents? Because I'm very fond of finding distant heirs to great dynasties, who may be considered "unnecessary" under all of the other criteria and restoring them to power. The only thing that would save them is having (dead) parents.
Yes, it includes dead parents (and children. Not 100% sure about spouses).

Is this for the player's court as well, or just for AI?

Overall, I'm a little concerned that it's going to nerf my "find old single ladies to marry after I have my heir" strategy but in general I like it...
Only AI courts.
 
  • 10
  • 4
Reactions:
Fewer random characters are generated than previously, and the game more aggressively eliminates unnecessary characters
How is it generating fewer random characters? Less event characters?

The biggest thing was that AI independent rulers were updating their list of threatening characters. Spreading it out over the year instead should have little to no gameplay effect, but avoids the annoying pause it caused.
Will they still update it only once a year? And how is it determined when they update it? Every anniversary of ascending the throne?

Unnecessary characters are simply killed off.
Characters are considered unnecessary if none of the following are true:
  • They're a ruler
  • They're imprisoned
  • They've got parents
  • They've got a spouse
  • They've got children
  • They've got a council position
  • They've got a claim
  • They're under age 40
How large a court has to be for it to be checked for such characters can be modded in defines.lua. It is set to 10 in 2.6.
What if you are the grandson of a ruler, but your parents (who are heirs) aren't landed and you are over 40?
What it does is simply set the max number of children someone can have 1 lower. It is only applied if the court is larger than the limit (30), and the character is unlanded and has no landed parents. Essentially this means they're limited to a single child.
So does that mean that unlanded characters without landed parents are limited at two children unless the cap is reached? Also what if they have a landed grandparent?
Big tip to anyone who wants to improve the running of their game; keep your dynasty small. You don't have to marry off every single second cousin, twice removed.
So much this. I have plenty a time pretty much ruined my game by getting my dynasty to contain 4000 members and the game slowing to an utter crawl.

And we've shortened the names for a lot of common tokens. E.G., instead of "birth_name" we now save "bn".
I don't like that; it seems to make the save files harder to read. And as it only effects save time and not running time it is a thing I am sad seeing optimised since after all you don't save too often.
 
  • 4
  • 2
Reactions:
Is it too late to add them in? If I've made a 39 year old one of my commanders, I would prefer not to know that the character will be auto-reaped upon the next check after his (or her) birthday.

Edit:
Would it be possible for the list of auto-kill conditions to be made moddable?
Put him in prison. Tell him it's for his own good.
;)
 
  • 2
  • 2
Reactions:
Do these courtiers just vanish or do they die of 'natural' causes? Cuz I remember keeping my eye on one specifically and she just vanished. I think it might've been the Joan of Arc lady actually.
 
  • 2
Reactions:
What if you are the grandson of a ruler, but your parents (who are heirs) aren't landed and you are over 40?

A good point perhaps. But unless he is a church fellow why would that man not be married or with a child. Especially if the ruler is a player angling for the grandson to inherit.

I don't like that; it seems to make the save files harder to read. And as it only effects save time and not running time it is a thing I am sad seeing optimised since after all you don't save too often.

Although I do believe they said there would be increased options as to what interval saves take place, we do so save often. It's automatic in ironman mode and the saves were to slow, optimization was needed in the save.

We have gotten used to it, but it is my opinion that the slow save is a turnoff to more than a few people.

And I recognize that the ability to read save files is valued to some users, but that is a minority of users.

Sorry but optimization of saves was needed and should certainly come before readability of the save file.
 
  • 9
  • 1
Reactions:
Unnecessary characters are simply killed off.
Characters are considered unnecessary if none of the following are true:
  • They're a ruler
  • They're imprisoned
  • They've got parents
  • They've got a spouse
  • They've got children
  • They've got a council position
  • They've got a claim
  • They're under age 40

If you have a random courtier/commander/person who you want to keep alive, marrying them off should prevent them from being purged as since married characters are not considered unnecessary, Correct?
 
How is it generating fewer random characters? Less event characters?
Characters get a court generated for them if they're new, and a few other situations. The # generated is now generally lower. We were generating more wife candidates for Muslims than needed for example.

Will they still update it only once a year? And how is it determined when they update it? Every anniversary of ascending the throne?
Generally they update it once a year, but more often if it has been marked as outdated for whatever reason.
The offset is based on character ID.
What if you are the grandson of a ruler, but your parents (who are heirs) aren't landed and you are over 40?
Then you've got parents, and thus aren't unnecessary.
So does that mean that unlanded characters without landed parents are limited at two children unless the cap is reached? Also what if they have a landed grandparent?
Yes.
It'll consider your grandparents if they're still alive.
I don't like that; it seems to make the save files harder to read. And as it only effects save time and not running time it is a thing I am sad seeing optimised since after all you don't save too often.
A ton of people have yearly autosaves.
 
  • 6
  • 3
Reactions:
A good point perhaps. But unless he is a church fellow why would that man not be married or with a child. Especially if the ruler is a player angling for the grandson to inherit.
Very good point; had forgotten that a spouse or a child made you immune from the cull.



Though I wonder if unlanded, distant members of your dynasty can fall for this cull if unmarried and childless.

Although I do believe they said there would be increased options as to what interval saves take place, we do so save often. It's automatic in ironman mode and the saves were to slow, optimization was needed in the save.

We have gotten used to it, but it is my opinion that the slow save is a turnoff to more than a few people.

And I recognize that the ability to read save files is valued to some users, but that is a minority of users.

Sorry but optimization of saves was needed and should certainly come before readability of the save file.
Hadn't thought about how ironman saves often, since I never use ironman myself and hence just had the yearly save.
Though I disagree with it being needed, since even the few times I tried ironman it didn't see that annoying. But YMMV obviously and people have different thresholds of toleration.
Still sad about the readability though, since often you can actually fix game breaking bugs through save editing---even corrupted saves can be fixed!
 
  • 4
  • 1
Reactions:
Then you've got parents, and thus aren't unnecessary.
Ah; thought it only made you immune if your parents were landed. So even unlanded parents are enough? But if unlanded they need to be alive?

Yes.
It'll consider your grandparents if they're still alive.
What if the grandparents are dead?
And will distant dynasty members be culled if their branch is unlanded?
A ton of people have yearly autosaves.
Which doesn't come around too often.
 
  • 3
Reactions:
Take a wild guess at what event that was.


The biggest thing was that AI independent rulers were updating their list of threatening characters. Spreading it out over the year instead should have little to no gameplay effect, but avoids the annoying pause it caused.


Unnecessary characters are simply killed off.
Characters are considered unnecessary if none of the following are true:
  • They're a ruler
  • They're imprisoned
  • They've got parents
  • They've got a spouse
  • They've got children
  • They've got a council position
  • They've got a claim
  • They're under age 40
How large a court has to be for it to be checked for such characters can be modded in defines.lua. It is set to 10 in 2.6.
Regarding the kill-off mechanic:

1)
How large a court has to be for it to be checked for such characters can be modded in defines.lua. It is set to 10 in 2.6.

How would i identify that line in defines ?
It's not in it already, right ?

2)
- How long has the character to exist, unitl the killing happens ?

Please let it be more than a few months.
I also wonder if the AI has actually short enough circles to choose the characters before they are killed.

3)
- Commanders really should be added to the list.
The AI has already problems with assigning commanders at all and properly.
Just like commanders shouldn't be killed on succession in my humble opinion.


Thanks for all the other optimisations.
I'm just getting a bit worried when performance increases happen by doing cuts in the actual game or even feature/mechanic cuts.
Thanks again.
 
Last edited:
  • 1
Reactions:
Several computations that used to be single-threaded are now multi-threaded
It was Time - Thanks ! ...

I've stopped the Time in the Video ...
20 Seconds (V2.5.2) vs. 38 Seconds (V2.6.1) for the first Year ...
Good so Far !
 
  • They've got parents
  • They've got a spouse
  • They've got children
Does being a lover or a concubine count for this? Also, do parents or children need to be alive for the protections to work?

(Also, would it be possible for you to edit your posts to mark them as dev posts? Not quite sure how that works on your end, but it would be really handy to be able to bring up your posts with the "Show all dev posts" button.)
 
  • 2
Reactions:
Thanks so much for your hard work!! This must be the most important and best update yet, as these optimisations have been sorely needed for a long time now. Let's hope they continue to spend a large part of time in carrying out optimisation work in the last few months before CK2 is finished.
 
  • 4
Reactions:
Unnecessary characters are simply killed off.
Characters are considered unnecessary if none of the following are true:
  • They're a ruler
  • They're imprisoned
  • They've got parents
  • They've got a spouse
  • They've got children
  • They've got a council position
  • They've got a claim
  • They're under age 40
How large a court has to be for it to be checked for such characters can be modded in defines.lua. It is set to 10 in 2.6.

At what size the fertility modifier can also be modded.
What it does is simply set the max number of children someone can have 1 lower. It is only applied if the court is larger than the limit (30), and the character is unlanded and has no landed parents. Essentially this means they're limited to a single child.

Is this an event that one can mod? For those of us who already have MODs with such events since years back, it would be sad if those conditions listed there are the only ones. There is much many more special cases to consider where you might want to keep someone alive.
 
  • 2
Reactions:
In one of the diaries depopulation is mentioned. Is it possible for modders to have other non-disease-related events cause depopulation?

Sure, ultimately it's just a province modifier, and there's a scripted effect to handle removing prosperity at the same time.
 
  • 10
Reactions: