• 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.

CK3 Dev Diary #87: Royal Modding

Hello everyone and welcome to the 87th CK3 Dev Diary!

I’m Matthew, one of the Programmers on the CK3 team, and today I am going to talk to you about a variety of improvements and changes we’ve done to modding for the 1.5 patch which will be accompanying the Royal Court Expansion.

We’ve added a variety of mod support in 1.5 so I’m not gonna cover everything, but I will give a few big ticket items that will let mods do a lot more fun custom things as well a few smaller fun ones. I’ve also attached the output of script_docs on 1.5 at the end so modders curious about the new triggers and effects in game can get a bit of a sneak peek for the release.

The Royal Court​

Of course the Royal Court itself is open to mods, it is all defined in the gfx/court_scene folder though the majority of the complex scene_settings itself is best built using the in-game editor that we are shipping with the court scene. It lets you position and change objects and switch between different settings much faster than trying to edit them all by hand.

Trust me, cause I remember the time whilst the editor was work in progress and doing changes by hand crushed my soul.
The in-game editor tool for the royal court 3d scene

I am not going to go into a huge amount of detail on the royal court modding because it is actually pretty straightforward with the editor, you position things and pick the assets you need for a configuration and then it just puts things there.

One aspect I will go into a bit more info on quickly is the character positioning, because the rest of the positioning is set within the editor but the characters are not positioned individually because of course not every court has the King of England to reference.

Instead the character positions are given a set of valid roles, and you pick a position where someone who has one of those roles may go. For example the two guards you see in the back are two positioned instances of the guard and knight role, which has a variety of rules of who it should pick.

If you have a bodyguard or champion court position appointed for example then it tries to use them as a special guard, but if you do not then it will fallback to picking any of your knights instead. You can also have some more special roles such as if you have a court jester or poet appointed then they can show up in your court too.
The script for the poet court scene role


Characters can not show up in multiple different roles and it is a “greedy” picking of first come first served in who is taken up, but you can write some fairly complex rules to decide who can go where as well as what animations they can choose from!

Same-Sex Marriage​

Coming with 1.5 is support for same-sex marriage, not only just in mods either but as a new game rule alongside the Same-Sex relations game rule so you can use it in un-modded games too. We've updated a variety of AI logic and interactions and content to take that into account when playing.
Same-sex marriage between the Duke of Brittany and his husband

Mods are of course able to implement this into their different worlds without it having to be a game rule, it can be based on different cultures or anything in the game world at all.

This is something that we’re very happy to be able to put into the game and have support in the game rules for unmodded games too, it is something that a lot of the team and community wanted and we are glad it is finally going to be shipped in 1.5.

Scripted Widgets​

CK3 is one of our most moddable games yet, not just in terms of the content that can be added but the system's mods can script. And our new UI system is the most open we’ve had in terms of what custom UIs mods can add and edit, but one issue it had was letting you add brand new things entirely and keeping compatibility nicely.

In 1.5 there is a new system called “scripted widgets”, what they allow for in essence is a mod to define their own brand new windows in the gui files and then add an entry into the gui/scripted_widgets folder with the name of their gui file and the main window.

For example:
gui/test_custom_widget.gui = my_first_cool_test_widget
gui/test_custom_widget.gui = my_second_cool_test_widget

Then with that simple line of script their window will appear in the game in the same way any of the windows we support in code do. Now of course there are some limitations, the windows do not have any special data context like a code one does but it can access anything that is set globally or on the local player character which covers more than enough cases normally.
A scripted widget making a new example window with a testing button

This may not sound hugely impactful, but it means that mods going forward can easily create large systems which can then more easily be compatible with other mods that add systems or if they feel brave enough even with larger Total Conversions if they do not cross over in incompatible design choices.

I am really excited to see the new UIs that mods end up making for their gameplay systems and getting to try a few different mods together. Hopefully their windows have a bit more functionality and effort put into it than my testing one…

Value Breakdowns​

Another bit of UI functionality that mods could not nicely mimic is getting breakdowns of their numbers in the same way we break down a value like your prestige income or how much piety it’s gonna cost to start that war in their own UI.
In 1.5 we’ve added the GetScriptValueBreakdown UI function which lets you specify the name of the script_value you want to break down and the scope context to do it on and it gives you the exact same data as if we’d natively done it from code.

For example in my custom widget I’ve made the button tooltip give a breakdown of the cost if I were to increase my crown authority entirely separate from the usually needed button to evaluate that cost in the realms UI.
Example of custom value break downs in custom UIs

We hope this will let mods better explain their own custom values in a more clear way, be that something like your mana in a fantasy mod or custom score for a special event chain.

Events and Localization​

To make life easier for our modders and designers to work with events we’ve added and reworked a few debug buttons in the event window.
Now every event has these five icons in the top right corner.
The 5 debug icons in the event window

In order they let you:
  • Regenerate the event contents, useful if you’ve changed something that cannot hot reload.
  • Toggle the data system globally, this makes most everything in square brackets show exactly what you typed instead of localizing to some output, this is available via the console commands too
  • Copy the event text to your clipboard
  • Shows you the trigger evaluation that had to be true for you to get this event
  • Debug info about the current scope context and how keys used to build the description
We’ve found that having easy access to these makes it a lot simpler to debug events and iterate on content.

Though do be warned that toggling off the data system can give you some truly cursed looking windows since now instead of seeing the number 4 you see the joyous underlying constructs such as this monstrosity of a window:
The character window with the localization data system disabled showing the raw function calls

In a more mechanical improvement we’ve also added a boilerplate reduction for having events on a cooldown, instead of needing to manually check and juggle flags and variables yourself you can now specify a cooldown on the event in days/weeks/months/years as some value and it will automatically handle applying a flag that will clear after that time blocking the event from being fired on a character.

Console Commands​

We have added a variety of new console commands in 1.5 to help make creating and testing mods a bit easier, and instead of explaining them myself I am just gonna cheat and rip their change log entries out!
  • Added console command "bypass_requirements" (alias "bypass") that lets you do decisions, interactions, schemes, laws, and title creation despite the requirements not being met
  • Added console command "instasiege"
  • Added console command "save_every" and startup parameter "-save_every=x". These will make a save every x years, and ensure they do not get overwritten by normal autosaves
  • Added console command AI.try_send_decision
  • Added console command AI.try_send_interaction
  • Added console command Ironman.ToggleIgnore. When ignored, saves will act as if they're not ironman, including that when you hit save it'll result in a non-ironman save. This can be toggled during gameplay
  • Added console command ToggleShowAllKillers
  • Added console command complete_schemes, guaranteed_scheme_success/failure, and guaranteed_scheme_secrecy_success/failure. The success/secrecy ones only affect the player
  • Added console command set_date
  • Added console command show_regions_in_tooltip
  • Added console command toggle_keys_on_map
  • Added console commands "yesmen_instant" (AKA "ymi") and "instant_responses". The yesmen button in the console can now be right-clicked to run "yesmen_instant"
The bypass and save_every commands have been especially helpful in setting up scenarios to test scripts and make sure it works exactly as you had intended in your mods. As are the forcing the AI to try out an interaction instead of waiting for them to do it of their own free will.

Modifiers Everywhere​

In 1.5 we’ve made some improvements to modifiers so if you use an invalid modifier type somewhere it will error and let you know its not going to work.

Which has been very useful as in 1.5 we’ve greatly expanded upon modifier support in buildings, now buildings can not only apply modifiers to you in general but they can also apply specific modifiers based on culture parameters which are applied by traditions. These can be used in the modifiers affecting the character, province, county and duchy_capital_county modifiers.

In addition there is a province_terrain_modifier which can apply a modifier based optionally on: terrain type, being coastal, being by a river, and by culture parameter. So traditions can really matter in your mods and let cultures play in vastly different ways.
The script for various culture tradition based modifiers on buildings

Clock’s a ticking​

Release day is coming soon and we’re very excited to see what mods are going to do with Royal Court, especially with the court scene itself which we hope in the future to see some fantastic 3D scenes especially from fantasy mods.

I’m gonna get back to the last minute release period scramble, thank you for reading and I hope you’re looking forward to Royal Court’s release and the great mods we’re gonna be able to see in the future too!
 

Attachments

  • effects.log
    288,5 KB · Views: 0
  • event_scopes.log
    302 bytes · Views: 0
  • event_targets.log
    22,2 KB · Views: 0
  • modifiers.log
    58,9 KB · Views: 0
  • on_actions.log
    35,7 KB · Views: 0
  • triggers.log
    195,8 KB · Views: 0
  • 104Like
  • 60Love
  • 27
  • 5Haha
  • 5
  • 1
Reactions:
Love the inclusion of same-sex marriage and the thought put into it. Thanks, devs.
 
  • 10
  • 3
  • 2Like
Reactions:
Is it possible to implement an graphic option to turn off Animation specifically for the Court scenes? Sadly I am in a position where my potato pc can render the animations in map mode sufficiently but it will certainly not be capable to render the court scenes.
 
  • 1
  • 1
Reactions:
What is the default setting for this game rule? On, off, or something else?

The default settings for these things (gender equality, sexuality attitudes, etc.) are usually (always?) historical, meaning that a default game will see the vast majority of religions taking a dim view of same-sex relations. According to the screenshot a dev posted, enabling same-sex marriage will disable achievements actually, while keeping the setting default will allow achievements.
 
  • 1
Reactions:
No same-sex pregnancy currently, a lotttt of code and even more script makes very strong assumptions about parentage that would need a bigger pass to integrate it and not just lead to a lot of bug reports. But never say never though, I know folks on the team have looked at it before though hence why we saw it was a bit more of a challenge.

Are you saying it takes a lot of work for one woman to be considered the "real father" by the game or for her to be considered the father by characters in game, or both? I can't speak for everyone else but I really just want the latter as that's what I've read. I was kind of thinking about making a couple of traits one for the female husband and the other for her wives/concubines such that they can't get the fornicator/adulterer traits (nor the events). I don't know if that would work, I'm not that talented. but then that's just the first step.
 
  • 1Like
Reactions:
  • 1
Reactions:

Same-Sex Marriage​

Coming with 1.5 is support for same-sex marriage, not only just in mods either but as a new game rule alongside the Same-Sex relations game rule so you can use it in un-modded games too. We've updated a variety of AI logic and interactions and content to take that into account when playing.
Same-sex marriage between the Duke of Brittany and his husband

Mods are of course able to implement this into their different worlds without it having to be a game rule, it can be based on different cultures or anything in the game world at all.

This is something that we’re very happy to be able to put into the game and have support in the game rules for unmodded games too, it is something that a lot of the team and community wanted and we are glad it is finally going to be shipped in 1.5.
I'm very curious as a modder who will be specifically be adding features for same-sex marriage, how it works with patrilinear and matrilinear marriages (as these determine the dominant partner in the marriage based on sex, for example who moves to whose court, and could be useful for mod specific thing like adopting). Also I can see it there are two main cases to cover, when selecting a marriage and when displaying/implementing the marriage.

When selecting a marriage I'm guessing it would work something along the line of if you have the matrilinear marriages box checked, then for women it show marriages where they will be the dominant partner (whether same-sex or not) and for men marriages where they won't be the dominant partner (and if you have the matrilinear marriages unbox checked it's the opposite).

For displaying/the game remembering who the dominant partner is seems harder to me. Obviously just seeing matrilinear marriage on a marriage between two men or two women doesn't really tell you much (we don't know after the fact who initiated the marriage, which was used to solve the problem above). The one I've thought of it to mark the marriage in a way more useful way is that the older or younger partner is defined to being the dominant partner, but I'm sure there are other ways to resolve this problem. And I'm assuming you already came up with a system, so I'm currious what that is?


Also, I'm really glad to see it is being implemented as a game rule :D Plus really happy to see all the other bits of modding support :D Great job!


Edit: The only thing that would make me more happy than a game rule is if some level above accepted for crime doctrines, like in my mod, existed in the base game. That way I could reform a faith to have gay marriage without a mod (plus all the flavour that could be added for the other doctrines). But I understand there are a lot of other things to work on before something like this is tackled by the devs (and I can't wait to see what you all have in store for us next).

Edit2: Fixed example scenario
 
Last edited:
  • 5
  • 4
Reactions:
Last edited:
  • 1
Reactions:
Are you saying it takes a lot of work for one woman to be considered the "real father" by the game or for her to be considered the father by characters in game, or both? I can't speak for everyone else but I really just want the latter as that's what I've read. I was kind of thinking about making a couple of traits one for the female husband and the other for her wives/concubines such that they can't get the fornicator/adulterer traits (nor the events). I don't know if that would work, I'm not that talented. but then that's just the first step.
If you play in debug mode, I believe you can use the pregnancy console command to impregnate one female with another—I’ve accidentally self-impregnated a character, so that she was the secret, real father of her own child. Those poor creatures all mysteriously died ;), and I didn’t play around with this...feature, but it might be a ...fruitful area to explore. :)

(Edit: you could probably reveal the secret & use console commands to remove any undesired traits like bastard, fornicator, or adulterer. And you’d have a two-mothers child.)
 
Last edited:
  • 3Haha
  • 1
Reactions:
Edit: The only thing that would make me more happy than a game rule is if some level above accepted for crime doctrines, like in my mod, existed in the base game.

Yeah, this would be really nice since it removes the need for modding, and it would be better in terms of RP, but the fact that they added it as a game rule is already more than what I expected so I'm not going to complain.
 
  • 3
Reactions:
That way I could reform a faith to have gay marriage without a mod
Already possible, because the same-sex marriage game rule applies only to characters whose faith accepts same-sex relations. So if you set your game rules to same-sex marriage enabled, same-sex relations historical, you won't have access to same-sex marriage until you reform your faith to allow it.

You need a mod only if you want both states (same-sex marriage allowed/same-sex relations accepted but not allowed to marry) to exist for different faiths in the same game.
 
  • 4
  • 3
Reactions:
Yeah, this would be really nice since it removes the need for modding, and it would be better in terms of RP, but the fact that they added it as a game rule is already more than what I expected so I'm not going to complain.

100% agree. I thought same-sex marriage was going to be just a modding featur. So it already being in game is way more than I was expecting. I figure something like what I'm doing with my mod won't come until they the devs feel the have the main part of the game covered and start to go more into the realm of supporting alt-history. Which I can totally get behind. There are many features, like trade, that I'd like to see first before alt-history starts getting serious support.

Already possible, because the same-sex marriage game rule applies only to characters whose faith accepts same-sex relations. So if you set your game rules to same-sex marriage enabled, same-sex relations historical, you won't have access to same-sex marriage until you reform your faith to allow it.

You need a mod only if you want both states (same-sex marriage allowed/same-sex relations accepted but not allowed to marry) to exist for different faiths in the same game.
Yeah, I guess my wording wasn't the most precise (edit: and reading comprehension skills either lol, see edit below). Because for say Catholicism you are totally right, But if I play as faith that accepts homosexuality, like Mullwadism, with the game rule on, then that faith starts the game with same-sex marriage (which is something I'm glad is an option). But I then don't have the option to take that accepting faith, as it historically was with no same-sex marriage, and reform it to now have same-sex marriage. This is where having a doctrine level above accepted would be nice, as it would allow your to start in the historical scenario with any faith and move to an alt-history scenario where same-sex marriage happened a lot earlier (or at least more prominently based on what you accept as historical instances of same-sex marriage).

edit: Just realized that you covered this in your closing sentence. So yeah I agree.

But this is a pretty niche scenario, so I'm not complaining that it isn't in the game.
 
Last edited:
  • 2
Reactions:
Already possible, because the same-sex marriage game rule applies only to characters whose faith accepts same-sex relations. So if you set your game rules to same-sex marriage enabled, same-sex relations historical, you won't have access to same-sex marriage until you reform your faith to allow it.

You need a mod only if you want both states (same-sex marriage allowed/same-sex relations accepted but not allowed to marry) to exist for different faiths in the same game.
There are a few faiths that already qualify (quite a bit less than I initially suspected so most of them will have to be reformed to either Accepted same-sex relations, concubinage or both).

These are (assuming their tenets and doctrines are not changed in patch 1.5):

-Adamitism
-Nangchos
-Vajrayana
-Gyur Bön
-Khyarwé Bön
-Bori
-Yoruba
-Kushitism
-Hellenism

Because for say Catholicism you are totally right, But if I play as faith that accepts homosexuality, like Mullwadism, with the game rule on, then that faith starts the game with same-sex marriage (which is something I'm glad is an option). But I then don't have the option to take that accepting faith, as it historically was with no same-sex marriage, and reform it to now have same-sex marriage.

While you are right that it has Accepted Same-sex Relations, you still need Concubinage for it. I'm aware may feel odd but I guess you can RP it as only after reformation when you include concubinage that same sex marriages were allowed or something.
 
While you are right that it has Accepted Same-sex Relations, you still need Concubinage for it (which I'm aware may feel odd but I guess you can RP it as only after reformation when you include concubinage same sex marriages were allowed or something).
I think the wording of the game rule is a bit ambiguous, but I took the "and whose cultures practice concubinage" to be a qualifier on the concubinage part of the previous clause, not the marriage part. Especially since they mention in the next sentence that to enable it for everyone you just need to make same-sex relations accepted in every faith, but that wouldn't be true if concubinage was also required.

Also gating it behind concubinage seems weird design choice as polygamy can easily get around the problem of an heir too. But even monogamous faiths can use seduction or just letting your titles pass to your siblings are valid option for a ruler with a same-sex spouse (or you can hope to get the adoption court event they showed off previously). So I'd be surprised if Paradox did that and then also failed to mention it in their main post announcing the feature.
 
  • 3
Reactions:
Just realized something. I recall discussion on the After the End CK3 Discord, about how they intended to implement gay marriage. Their idea was to divide "accepted" into "tolerated" and "accepted". The thought was that the former would work like vanilla CK3, providing no maluses to people in homosexual relationships but also not permitting gay marriages, with only the latter actively allowing gay marriage. The former would be for the more tolerant, live-and-let-live post-apocalyptic pagans, while the latter would be for hippie/new age descendants like the Gaians. And of course, moving from "criminal" to "tolerated" would be cheaper than "criminal" to outright "accepted", which makes sense. I'm wondering if they'll still be able to implement that level of granularity.
 
  • 3Like
  • 3
Reactions:
I think the wording of the game rule is a bit ambiguous, but I took the "and whose cultures practice concubinage" to be a qualifier on the concubinage part of the previous clause, not the marriage part. Especially since they mention in the next sentence that to enable it for everyone you just need to make same-sex relations accepted in every faith, but that wouldn't be true if concubinage was also required.

Also gating it behind concubinage seems weird design choice as polygamy can easily get around the problem of an heir too. But even monogamous faiths can use seduction or just letting your titles pass to your siblings are valid option for a ruler with a same-sex spouse (or you can hope to get the adoption court event they showed off previously). So I'd be surprised if Paradox did that and then also failed to mention it in their main post announcing the feature.
Now that you mentioned it, it does seem a bit odd. I had a look at the culture ethos and traditions and saw nothing related to concubinage, so I guess they still mean the faith concubinage marriage type?

No clue about the enable for everyone part however...
 
  • 1
Reactions:
Just realized something. I recall discussion on the After the End CK3 Discord, about how they intended to implement gay marriage. Their idea was to divide "accepted" into "tolerated" and "accepted". The thought was that the former would work like vanilla CK3, providing no maluses to people in homosexual relationships but also not permitting gay marriages, with only the latter actively allowing gay marriage. The former would be for the more tolerant, live-and-let-live post-apocalyptic pagans, while the latter would be for hippie/new age descendants like the Gaians. And of course, moving from "criminal" to "tolerated" would be cheaper than "criminal" to outright "accepted", which makes sense. I'm wondering if they'll still be able to implement that level of granularity.
It's definitely implementable, I have done so in my mod, Celebrate Crimes (though I renamed the base game doctrine level of "accepted" to "allowed" and the more tolerant level above that I called "celebrated"). For mods, 1.5 will just allows same-sex marriage, rather than just same-sex concubines, to be implementable now however the modder chooses.

edit: clarity
 
Last edited:
  • 2
  • 1Like
  • 1Love
  • 1
Reactions:
Now that you mentioned it, it does seem a bit odd. I had a look at the culture ethos and traditions and saw nothing related to concubinage, so I guess they still mean the faith concubinage marriage type?

No clue about the enable for everyone part however...
Yeah, I don't know what to really make about the culture part of the quote.