Court AI ​





Controling the Court AI [ 1.2.8 ] ​ The "Court AI" serves the player by performing at background all of the repetitive court affairs and tasks, such as appointing council positions, giving tasks to councillors, promoting commanders, giving honorary titles, employing a court physician, selecting child education focuses and assigning appropriate guardians for them. All while taking into consideration the characters' actual skills, opinions, ranks, relative power and other improtant priorities that are relevant to the player's realm and dynasty.

PLEASE READ, THIS IS IMPORTANT !!! (new since 1.2.7 )

Court AI offers an extensive control over its features letting the player to enable or disable any of its components during ingame using the right-click menu on your primary title's COA (the flag). By default when a game starts or when you change primary title the Court AI is disabled, you have to enable it first. Look for " Enable Court AI " and then take a look at which features you would like to enable or disable after enabling the Court AI within the same menu of your priamry title.



Spoiler: Court AI Menu

You may also enable or disable the Court AI to give tasks to councillors for each position in the council. Right-click over the councillor and search for "Councillor AI: ON/OFF" to switch the Court AI on giving tasks to that particular position at your council. Note that this works regardless of the councillor appointment switch. [ 1.2.8 ]



Note that you'll also have to disable several in-game messages like "Councillor Lost" since the Court AI is replacing councillors very often while it is searching for better candidates on the fly.​ (new sinceCourt AI offers an extensive control over its features letting the player to enable or disable any of its components during ingame using the right-click menu on your primary title's COA (the flag). By default when a game starts or when you change primary title the Court AI is disabled, you have to enable it first. Look for "" and then take a look at which features you would like to enable or disable after enabling the Court AI within the same menu of your priamry title.You may also enable or disable the Court AI to give tasks to councillors for each position in the council. Right-click over the councillor and search for "Councillor AI: ON/OFF" to switch the Court AI on giving tasks to that particular position at your council. Note that this works regardless of the councillor appointment switch. [Note that you'll also have to disable several in-game messages like "Councillor Lost" since the Court AI is replacing councillors very often while it is searching for better candidates on the fly.​

If you desire to modify some of the requirements for guardians or councillors you also may change this in "common/scripted_triggers", it's pretty much mostly macroed there. I know this opening post is quite long, but please read this to understand what and why the Court AI does for you, before you rely on it. Thank you.​



What the Court AI does ​

Councillor appointments : Chancellor, Marshal, Steward, Spymaster, Chaplain, and Advisors [ 1.2.5 ]* Councillor tasks . most of the jobs, with many priorities taken into consideration. Commander promotions . purely meritocratic. Honorary/minor titles grant to appropriate characters. All cultures, religions and governments [ 1.2.5 ]* Children's education : Early and late focuses, + appropriate guardian assignments. Character interactions : such as "Stop Backing Plot" and "Demand Gavelkind". [ 1.2.6 , 1.2.7 ]

Councillor Appointments ​

By default appoints any appropriate character if the position is empty and if it finds an actual appropriate character. If another character is already in charge, it will make a careful decision whether or not it is worth firing the current councillor out for the optional candidate. This takes into consideration the following: Actual skill, Rank, Relative power (both, the player and the candidate), Opinion aka trust (for risky positions like chancellors and spymasters). The Court AI might even choose a slightly degrading candidate over the current one if the candidate is a threat to the realm's stability, or if their opinion is very high which implies on greater trustworthiness for touchy positions like spymaster or chancellor. Nonetheless, the Court AI is quite meritocratic, and might consider less skilled candidates under very strict conditions which make the "fair" compromise between meritocratic characters versus the self-righteous powerful noble characters (the aristocratic characters). When the player interrupts and fires the current councilor, the AI will try to find a better choice yet a different candidate again, if it will find one, it will put the new candidate in charge.​

Councillor Tasks ​

Chancellor

Top priority: Improve relations with top 10 vassals [ 1.2.8 ]* whose opinion of the player is lower than 50.

Default task: Improve relations with the religion head/ the pope to utilize papal mechanics such as excommunication, immediate divorces, title claims, invasions, crusades and as well protecting the player from being the target of such mechanics by opponents through maintaining good relations with the pope.

​

Marshal

While at war: Train troops at the player's capital. Tribal and nomad marshals will train troops even at peace.

Default task of a feudal marshal is to research military tech at the player's capital.

​

Steward

The default task of a feudal steward is to research economy tech at the player's capital. The steward will collect taxes (aka squeeze farmers) under the following situations: If the player is at war, if the player is trying to build a war-chest or amass wealth or if the player is having a minus cash (in actual debt). For a tribal steward - there is no default task, since a tribal steward cannot collect taxes nor research tech, then the Court AI puts an idle steward in the council and leaves the job action for the player to decide on.​

Spymaster

The default - and the only - task of the spymaster, for now, is to discover plots, the spymaster will be scheming plots at the player's capital.​

Chaplain

Top priority: Convert heretic and infidel provinces to match the player's faith.

Secondary priority: Improve relations with the religion head until reaches opinion of at least 50. [ 1.2.5 ]*

Default task: Research cultural tech at the player's capital. Tribal chaplains have no default task.​

Honorary/Minor Titles [ 1.2.5 ] ​

All relevant and available honorary titles at your realm according to your religion, culture and government type will be granted automatically to appropriate characters, whose opinions of you are ranging between 10 to 50 by default. With exception for commander titles where only the characters with the best military skills always take position. Note that commanders that are leading troops at the moment will not be appointented by the AI, to avoid situations when a leading commander is removed from a unit during operation or battle.

​

Children's Education ​

The Court AI will automatically choose childhood and education focuses as well as guardians for kids based on several parameters and priorities according to the realm's structure, government type, succession type and other parameters. Note that if you're playing as a child character, the Court AI will not choose focuses or a guardian for you at all. Also note that for the current moment the Court AI doesn't appoint guardians if they become inappropriate or malicious with time.​

Heritage : Foreign kids at your court, except close relatives, genius, quick, strong, fair or inbred kids.

Faith : Heretic or infidel kids at your court, and the only option for the helpless inbred kids...

Duty : Potential heirs for decentralized realms and gifted kids (quick, genius), chances become higher if having many non-baron vassals, or succession type is feudal elective or tanistary. Slow or imbecile kids are excluded from this focus.

Thrift : Potential heirs for highly centralized realms. And for slow kids, since this type of education can remove the slow trait entirely or reduce imbecile to only slow.

Struggle : Potential heirs to lower rank players, occupied realms (by foreign conquerors or tyrants) also optimal choice for kids growing in primitive tribal and nomad realms or physically strong kids.

Humility : Secondary gavelkind successors, to reduce their chance rebelling and increase their chance to gain the content, humble and kind traits.

Pride : Never, this focus in CKII is absolutely useless.

Otherwise default choice: 30% Duty, 30% Thrift, 40% Humility.

​

Diplomatic : Affectionate, Conscientious, Indolent NOT : Willful, Fussy, Haughty.

Martial : Rowdy, Willful. NOT : Idolizer, Timid.

Stewardship : Conscientious, Fussy, Curious, Brooding. NOT : Indolent, Haughty, Playful, Rowdy.

Intrigue : Playful, Brooding, Fussy. NOT : Affectionate, Rowdy.

Learning : Default fallback.



Guardians are supposed to match the child's early education focus attribute, f.ex for struggle focus he gets a martial guardian and so on, but he might switch to intrigue education later, the same guardian stays however. Guardians most not have the lowest level of education of said attribute, which means "misguided warrior" cannot be a guardian at all. Characters with the following traits cannot be guardians: Arbitrary, Gluttonous, Slothful, Cruel. All guardians most have at least rating of 10 in their primary attribute.​

Exploits "Demand Gavelkind" Decision [ 1.2.6 ] ​





The Court AI will use this targeted decision towards vassals if:

The player is using one of the two most decentralized demesne laws (vassal limit +10 OR vassal limit +5 and demesne size +1) Vassal have at least two demesne size. Vassal have at least two sons. The player either implemented "Late administration" law and vassal ain't a rival (to avoid refusal) OR vassal owes a favor to the player - by this case he cannot refuse at all so opinion and administration type don't matter. Please note that from time to time you might recieve events where vassals might ask for money or favor in return, make your decision carefully, this event fires when the Court AI asks the vassal to implement the Gavelkind succession as it sees it optimal for the laws the realm is using.

​ With the release of Reaper's Due a new targeted decision has appeared towards direct vassals that allows the player to demand vassals to implement Gavelkind succession law so their power will be split among the sons and possibly decentralize and split grand dukes to create a more fractured realm without too powerful vassals, allowing you to maintain a healthy decentralized realm without any over growing vassals in the long term.The Court AI will use this targeted decision towards vassals if:Please note that from time to time you might recieve events where vassals might ask for money or favor in return, make your decision carefully, this event fires when the Court AI asks the vassal to implement the Gavelkind succession as it sees it optimal for the laws the realm is using.

Exploits "Stop Backing Plot" Interaction [ 1.2.8 ] ​



Court AI will discourage below-duke-level plot backers by demanding them to stop backing any plots known to the player, this works regardless of the spymaster's similar task to automatically end plotters. This will not end the plot however, and leave the plot leader almost alone for a possible future arrest in the hands of the player. This feature is still beta (since 1.2.7 ) and wasn't tested very well and might be buggy.​



Known Issues ​



You have to consider these gameplay issues with Court AI before you use it, I couldn't confront those issues at the moment because PDX doesn't offer any conditions or indications to deal with these game mechanics through a script.

Ignores cuncil laws to do with councillor appointments and approvals. Ignores the time cooldown for councillor appointments and job/task changes. You have to consider these gameplay issues with Court AI before you use it, I couldn't confront those issues at the moment because PDX doesn't offer any conditions or indications to deal with these game mechanics through a script.

Future Implementations ​

Automatic viceroyal title succession to the best local count when a viceroy duke dies, this mostly relevant to the Byzantine Empire and realms that have many viceroyal dukes where every few minutes one of them dies. I've already mentioned there is no script command to grant a viceroy title in this thread, I hope PDX or anyone would give this any attention so I could implement this feature sometime in the near future. I tried also to fake a viceroyal status (you can see it in the source code actually) tested it few times but it has a lot of side-effects and other issues with the viceroy ruler itself. Persecution of criminals, traitors and plotters. Automatic imprisonment of backstabbers, known murderers and other outrageous cases. (While taking into consideration the chance they may escape) Improving the guardianship with kids that have changed their primary attribute to something else or dealing with guardians that turned untrustworthy, malicious, spoiling or simply incompetent.

DOWNLOAD v1.2.8

The file is attached to this post.

​

Version changes log & what's new - Current version: 1.2.8

Spoiler: v1.2.8 - Update - 12 September 2016 Fixes :

Fixed the Chancellor's improve relations task to work as intended. Restricted the Court AI from demanding characters that are higher than count level to leave plots. New improvements :

Extended the in-game control over the Court AI for councillor tasks. (more details in the main post) Spoiler: v1.2.7 - Update - 9 September 2016 Fixes :

Fixed a bug with the missionary task where the chaplain fails to find heretic/infidel provinces. Fixed a minor bug to do with child education where the Court AI tries to educate imprisoned kids. New improvements :

Introduced a new control menu for the Court AI and over its features, now located within the primary title's interaction menu that opens on mouse right-click. BETA: Introduced to the Court AI the "Stop Backing Plot" interaction. The Court AI will now try to discourage all plot backers that are 99% likely to accept, and leaving the plot leader alone in the plot for a future arrest. Spoiler: v1.2.6 - Update - 8 September 2016 Fixes :

Fixed a minor bug to do with commander appointments. Removed the old unused minor-title grant event from the unreleased v1.1 update. New improvements :

The AI will now exploit the "Demand Gavelkind Succession" targeted decision towards appropriate vassals under certain laws, please see further details in the main post. Spoiler: v1.2.5 - Major update - 5 September 2016 Fixes :

Fixed several serious bugs to do with commander appointments and promotions. Fixed an issue when a commander is appointed while operating with troops (or at battle). New improvements :

Totally redesigned the minor-title grant AI, better performance, shorter and more readable. Introduced to the AI the available minor titles of the following groups: Byzantine Muslim Merchant Republics Germanic/Norse pagan Mongol Zoroastrian Generic Pagan Nomadic Indian The court chaplain will try now to improve relations with the religion head (mainly the pope) while opinion is lower than 50 as a secondary priority, if there are no infidel or heretic provinces around to convert. The AI will now appoint advisors for empires and kingdoms mainly based on relative power and opinion factors between the player and the candidates. Spoiler: v1.1 - Never released This update was never released, it contained a full overhaul of the minor-title grant events being merged into one massive 600 lines long event that contained all of the available minor titles in the game. The event was working as intended, however later in v1.2.5 this event was again rewritten and redesigned from scratch, making it the 2nd time overhaul of the minor title granting system which was released with the v1.2.5 update and is now the primary event the AI is using. As of v1.2.5 the old v1.1 minor-titles event is still seen in the source code while it is disabled and never being used by the Court AI. This event will be finally removed entirely from Court AI in the next following update after v1.2.5. Spoiler: v1.0 - Initial release - 4 September 2016 The initial release of Court AI occurred at 4th September of 2016. The Initial version of Court AI was first time being worked on and tested since around middle of August of 2016.

Early education choices:Late education choices: If matching the following childhood traits: