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

Toa Kraka

Dislikes you
67 Badges
Dec 25, 2011
1.818
1.239
  • Crusader Kings II
  • Europa Universalis III
  • Europa Universalis IV
  • Victoria 2
  • Teleglitch: Die More Edition
Duchy Crusades code summary.png

In addition to this, an on_startup event absorbs the de jure Kingdom of Jerusalem into the de jure Kingdom of Syria at the start of the campaign.
Problems with vanilla (and many mods):
- A crusade for Andalusia can (and, with some regularity, does) conquer as many as 11 duchies' worth of land. That's almost three times as many duchies as a crusade for Jerusalem (4 duchies) can conquer.
- The Kingdom of Jerusalem shouldn't be on the de jure map before at least 1100 (and possibly shouldn't be on the de jure map at all!). Wikipedia seems to indicate that (1) Godfrey of Bouillon was merely the Duke of Jerusalem before his successor Baldwin created a custom kingdom for himself, and (2) the area was considered part of a "Kingdom of Syria"-type entity under both the ERE and the Caliphate. However, vanilla CK2 (and many mods) can't portray this historical reality because the crusade CB works from de jure kingdoms and such a gigantic Kingdom of Syria doesn't match the land taken in the First Crusade. This leads to a further problem:
- Vanilla (and many mods) must artificially prevent the Kingdom of Jerusalem from being created by non-Christian characters (literally allow = { religion_group = christian }--ugh--in the landed_titles file) and from being assimilated out of existence by non-Christian kingdoms (assimilate = no, ibid.).

Solution: Define the crusade CB from duchies rather than from a kingdom. In this proof of concept, the crusade CB takes a target duchy and every adjacent duchy. (All holy sites of the attacker's religion must be conquered before crusades for duchies that do not contain holy sites of the attacker's religion can be declared. A targeted duchy that does not contain a holy site must be adjacent to a realm that shares the attacker's religion.)
If anybody else has done this already, I can't find that other person's implementation in a cursory search of the forum.

A mod that is compatible with vanilla 2.7.2 (not 2.8, and not with any other mod that edits common/cb_types) is attached to this post. See also the attached savefile, which should demonstrate the successful CB's effects within a year of loading. (The King of Scotland wins a crusade against the King of Egypt--not for the Kingdom of Jerusalem (which doesn't exist on the de jure map), but for the Duchy of Jerusalem. The Sunni counts of Ascalon and Beersheb, rather than losing their titles, are liberated from Shia control to become vassals of the Catholic victor. The Count of Beersheb must have his revolt against the Shia Duke of Ascalon invalidated first. Neither the Sunni Kingdom of Mesopotamia nor the Orthodox ERE loses its counties in the area.)

Some problems still remain with this approach.
- The illustrious @zijistark mentioned some months ago that using a de jure CB target that doesn't match the de facto conquest can cause problems with AI behavior.
- There remains some unevenness in the amount of land that can be conquered. A crusade for Kent or Galicia is worth at most 3 duchies, while a crusade for Cordoba or Cologne is worth at most 7 duchies. As noted above, such discrepancies could in theory be fixed, but I'm inclined to think that the benefit of increased consistency in size would be outweighed by the detriment of reduced consistency in shape (e.g., in a crusade for Cordoba that's limited to a total of four duchies (to match a crusade for Jerusalem), which three adjacent duchies out of the full complement of six will be taken?). In any event, the current implementation still seems better than the vanilla version.
- This implementation still fails to represent the non-Jerusalem conquests of the First Crusade. This discrepancy definitely could be fixed (as far as returning a swathe of Anatolia to the ERE and taking Antioch and Tripoli, at least, though this idea still leaves out Edessa): (1) trace the shortest path of counties from the attacker's capital, through realms of friendly and neutral religions, to the target duchy; (2) on that path, take land with the same rules described in the screenshot presented above to determine who gets the duchies, counties, and baronies (except Step 2h gives the titles, not to the most-participating crusader, but to a random crusader who hasn't already received any land in the crusade), on a duchy-by-duchy basis), but I don't at the moment want to take the time to figure out the details.
- The obvious next step is to extend similar mechanics to other kingdom-based CBs (Mongol conquest, Seljuk invasion, Shia caliphate, etc.). They might conquer duchies in a radius of 2 or even 3, rather than just 1.

See the screenshot presented at the top of this post for a summary of the code. Feel free to use this code and/or idea in your own mod (with credit).
 

Attachments

  • Duchy Crusades savefile.zip
    6,8 MB · Views: 9
  • Duchy Crusades original.zip
    30,1 KB · Views: 8
Last edited:
- This implementation still fails to represent the non-Jerusalem conquests of the First Crusade. This discrepancy definitely could be fixed (as far as returning a swathe of Anatolia to the ERE and taking Antioch and Tripoli, at least, though this idea still leaves out Edessa): (1) trace the shortest path of counties from the attacker's capital, through realms of friendly and neutral religions, to the target duchy; (2) on that path, take land with the same rules described in the screenshot presented above to determine who gets the duchies, counties, and baronies (except Step 2h gives the titles, not to the most-participating crusader, but to a random crusader who hasn't already received any land in the crusade), on a duchy-by-duchy basis), but I don't at the moment want to take the time to figure out the details.
I now have taken the time to figure out the details (more or less).

From the Alexiad start (1081-04-01), here's what happens if (after I temporarily edit the CB to allow human-controlled characters to declare crusades at any time, for the purpose of testing) the HREmperor declares a crusade for Jerusalem and the King of Persia surrenders on the next day.
blah.gif
From start to finish:
- The crusaders set out from the HRE's capital duchy, Thuringia.
- They march peacefully through Franconia, Bavaria, Austria, Pecs, Temes, Wallachia, Karvuna, and Thrace. (Even though no conquest occurs, a province modifier makes the crusade path visible to the player.)
- They liberate Nikaea and Anatolia for the ERE.
- They march peacefully through Cilicia.
- They liberate the Miaphysite Duke of Antioch and Edessa from Sunni vassalage and give him the rest of the Duchy of Antioch (but not the rest of the Duchy of Edessa, since they aren't marching through that duchy).
- A random landless Catholic adult gets the Duchy of Tripoli. (This normally would be a random landless Catholic with the Crusader trait who is leading an army, but nobody matches those criteria in this short, artificial war. The counts of Tripoli and Baalbek are Shia and Druze, respectively, not Sunni, so they keep their titles.)
- The HREmperor gets the title and land of the Duchy of Jerusalem and the land of all surrounding duchies.
 

Attachments

  • Duchy Crusades current.zip
    211,2 KB · Views: 11
As I'm not all that familiar, how often does the AI actually follow a walking path to get to the crusades (which looks to be important for representing the first crusade independent polities, in your second post)?

Also, what parameters did you set on whether duchies go to ERE?
 
[H]ow often does the AI actually follow a walking path to get to the crusades (which looks to be important for representing the first crusade independent polities, in your second post)?
I haven't done the testing to determine that.

In any event, even if the AI always just sails directly to Jerusalem, the intervening enemies should have enough time to join the war, march to Jerusalem themselves, and indirectly defend their land against capture without the CB's being too unfairly biased against them, I think.
Also, what parameters did you set on whether duchies go to ERE?
There are separate priority lists for the duchies around the crusade target and for the duchies on the crusade path.

For the duchies around the crusade target:
1/2/3. Whoever holds the target duchy (or its de jure kingdom or empire) and belongs to the attacking religion
4/5/6. best_crusade_claimant for the target duchy (or its de jure kingdom or empire) (I haven't verified that best_crusade_claimant actually works in this manner.)
7. most_participating_crusader

For the duchies on the crusade path:
1/2/3. Whoever holds the duchy (or its de jure kingdom or empire) and belongs to the attacking religion or to a non-hostile religion in the attacking religion's religious group (e.g., Orthodox vs. Catholic)
4. Random landless crusader who belongs to the attacking religion (preferably commanding an army)
5. Random landless adult who belongs to the attacking religion
(Those last two are placeholders and will be improved.)
 
I haven't done the testing to determine that.

In any event, even if the AI always just sails directly to Jerusalem, the intervening enemies should have enough time to join the war, march to Jerusalem themselves, and indirectly defend their land against capture without the CB's being too unfairly biased against them, I think.

Oh, I was actually mainly just thinking from a standpoint of would the AI be capable of getting the independent duchies to form/lands back to de jure holder) or would they primarily just end up getting Jerusalem - if they only directly sail. I haven't played around enough in the Crusade Era to know how the AI typically arrives.

There are separate priority lists for the duchies around the crusade target and for the duchies on the crusade path.

For the duchies around the crusade target:
1/2/3. Whoever holds the target duchy (or its de jure kingdom or empire) and belongs to the attacking religion
4/5/6. best_crusade_claimant for the target duchy (or its de jure kingdom or empire) (I haven't verified that best_crusade_claimant actually works in this manner.)
7. most_participating_crusader

For the duchies on the crusade path:
1/2/3. Whoever holds the duchy (or its de jure kingdom or empire) and belongs to the attacking religion or to a non-hostile religion in the attacking religion's religious group (e.g., Orthodox vs. Catholic)
4. Random landless crusader who belongs to the attacking religion (preferably commanding an army)
5. Random landless adult who belongs to the attacking religion
(Those last two are placeholders and will be improved.)

Ah thanks for that. Does sound like a most interesting idea and a neat way to model the crusades.
 
Oh, I was actually mainly just thinking from a standpoint of would the AI be capable of getting the independent duchies to form/lands back to de jure holder) or would they primarily just end up getting Jerusalem - if they only directly sail.
The duchies labeled by on_success_title as "crusade path" constitute the shortest path* from the attacker's capital to the target duchy, and have no relation to the path that the attacking armies actually traverse.

*"Shortest" on a duchy-by-duchy basis, which isn't necessarily the same as "shortest on a province-by-province basis". If multiple paths are tied for the title of "shortest", one is chosen randomly.