Tuesday, March 28, 2017

CK2 to EU4 converter - how it works and how to mod it

Pussy by tripleigrek from flickr (CC-SA)

There's very little information about this wonderful thing, so after doing some research I decided to write it all up.

What is a megacampaign

Paradox Grand Strategy games cover very long time, and most people never even "finish" a single game of CK2, or EU4 - but it's possible to go the other extreme and play a "megacampaign" - start in one game, then convert to another, and keep playing. Possibly even chain multiple such games, like CK2 to EU4 to Vic2 to HoI4.

Since Paradox games make it hard to avoid blobbing, you pretty much have to play with mods, severe self-imposed restrictions, switch countries every now and then, or otherwise do silly things or your second/third/fourth campaigns will be pretty boring.

Please don't ironman megacampaigns

I'd generally dislike ironman, but it's even more important not to play ironman for a few reasons:
  • Conversion process is never perfect, so you're very likely to want to tweak some things with console commands or save game editing before and after export.
  • It's bad enough when game bugs out and you need to fix it by console, but when it happens to your campaign you've been playing for literally months, it can be really devastating
  • If any of the games receive updates, you might need to do some fixing. CK2 is notorious for breaking saves any time trait list expands because they couldn't be bothered to include 10kB trait id to trait name mapping table in each save game.
  • Ironman mode uses special save format which is pretty damn hard to "un-ironman" and edit if necessary.
  • Megacampaign is not a meaningful achievement run - with so much time it's inherently going to be pretty easy past first 100 years, other than for self-imposed challenges with which ironman will be of no help.
Or if you really want to, go ahead, just don't say I didn't warned you.

What is the converter

There's been many converter tools which take save game from one game and create a mod for another.

In theory you could convert save game to save game, but converting to a mod is much more flexible, so that's the generally used method. Mod setups starting map, rulers, and whatever else it felt like including.

CK2 to EU4 converter is a builtin feature of Crusader Kings 2. You can only access it if you have converter DLC.

If you want to continue to Vic2 and HoI4, you'll need to use third party tools.

Where are the files

If you want to mod it, or just look at it, you might be surprised. Unlike pretty much other DLC-locked content which is included in base game, just with some flags telling it to turn it off, all converter files are in DLC zip.

Go to your Crusader Kings 2 game folder, find dlc/dlc030.zip, and unpack it somewhere.

If you want to mod it, you can include modified files directly in your mod, in eu4_converter folder, just as if they were in base game.

What converter does

Converter creates EU4 map matching CK2 map, with proper cultures, religions, dynasties, and government types, adding new countries as necessary.

It creates matching rulers with sensibly mapped stats, traits, and heirs.

It reassigns province development and centers of trade.

In limited way it also sets up vassals.

It will convert any game to 1444.11.11 game, no matter at which point you decided to use it.

It will convert your stash of CK2 gold to EU4 gold at 10:1 rate, and your prestige at 50:1 rate.

What converter doesn't do

It ignores any diplomatic relations or wars.

It ignores any family relations, except for dynasty name. So if you're king of England and your son is ruling France, that won't be modeled in any way except giving you same dynasty.

All provinces produce same goods as before (including gold), are in same trade nodes, have same estuaries, and other modifiers - with exception of centers of trade.

It doesn't extrapolate outside map - so even if you converted everyone to Zoroastrian, you'll still need Sunnis in Africa and Indonesia on conversion in any place not included on CK2 map.

All ongoing rebellions are cancelled.

Does converter randomize

The process seems to be completely deterministic.

If you export multiple times without reloading, you'll get same files.

If you do it after reloading, you'll get trivial changes, like order if tags (so things like which duke gets X01 and which gets X02 can flip), but there doesn't seem to be any meaningful randomness.

How active DLCs affect converter

If you have Sunset Invasion DLC active, new world map will have very powerful Aztec and Inca empires, will be much better settled, and will be mostly in High American technology group. Otherwise, it will look pretty much the same as vanilla. This is true even if Aztec invasion never happened.

If you have Sons of Abraham DLC active, heresies will convert to individual religions, otherwise they'll get folded back to their base religions.

If you have Conclave DLC, it uses different system to convert government types.

Can I use converter with modded CK2 games

Yes, as long as they don't modify the map significantly.

One notable exception is my Suez Canal mod, which is totally fine to use with converter as it doesn't add or remove provinces. You won't have canal prebuilt in EU4.

What affects ruler attributes and traits

Ruler/heir martial, stewardship, and diplomacy attributes divided by 3 and rounded up are what ends up as their EU4 attributes - capped at 6 of course.

There's some correction for underage rulers, since in CK2 children grow attributes with age, while in EU4 toddlers are born 6/6/6 or 0/0/0 somehow.

This means any attribute at 16 or higher is converted to a 6 - so it might be worth switching focus before conversion, just to get that extra point.

If you're immortal, you'll get immortal trait in EU4. Other traits are based on trait_conversion.txt. For some reason converter will only generate 2 traits, even if ruler reigned long enough to get 3.

Conversion is based mostly on your traits, and secondarily on your attributes. Some good CK2 traits like greedy convert to some bad EU4 traits like greedy. It's mostly nothing to worry about unless you have an immortal ruler.

How is map created

CK2 titles are described by rank and name (like c_jylland is County of Jylland), while EU4 are described by number (like 15 Jylland), and their names are just descriptive and occasionally not unique (like 157 Bihar and 558 Bihar).

It is based on many to many mapping in province_table.csv. Every CK2 title (not just a county!) can map to some number of EU4 provinces.

In simplest case a single title maps to a single title, for example in Iceland CK2 has two counties. So CK2's Vestisland maps to EU4's 370 Reykjavik, while CK2's Austisland maps to EU4's 371 Akureyri.

A title can map to multiple counties - like county of Holstein maps to two provinces - 1775 Holstein and 4141 Ditmarschen. So whoever controls it gets both.

Sometimes multiple CK2 titles map to single EU4 province - like counties of Lyon and Forez both map to 203 Lyonnais. In such case country holding majority gets it, and if someone else held part of it, they'll get a permanent claim on it.

Quite often 2 counties and a duchy map to a province, for example counties of Coruna and Santiago and duchy of Galicia all map to 206 Galicia. If duke holds one of them, he gets 2/3 and gets it.

I haven't investigated what happens in 50%:50% splits, presumably it's based on their order somehow, since conversion is not random.

What affects province development traits

Development seems to be redistributed between provinces based on total value of building in each province.

This means that provinces with more slots will generally get more development, because they'll generally have more buildings in them.

Because development is redistributed and not mapped, games converted early or late will have same overall EU4 development.

Things like technology levels, saved technology points, whose capital is it etc. have no effect on converted development.

Development mapping is separate from province mapping - so one very well developed Jylland could give you 4 30-development EU4 provinces, while 2 very well developed counties of Coruna and Santiago would only give you 1 30-development EU4 province.

What affects centers of trade

Centers of trade are also redistributed, generating approximately but not exactly same number, and generally to high development provinces, but I couldn't figure out exact mapping logic.

It doesn't seem to strongly relate to merchant republics, sometimes two CoTs spawn next to each other. I couldn't figure out how it works.

What affects government type

If you have Conclave, that otherwise purely cosmetic feature describing your government as "Hereditary Despotic Monarchy" is actually used to drive mapping, with government_table.csv determining it.

A few countries - like Papacy, holy orders, and other religious heads - are hardcoded to specific types, also listed in government_table.csv.

Which government flavor you get is determined by common/government_flavor/00_government_flavor.txt, based on your laws, religions etc.

One silly thing about current table is that merchant republics will be converted to merchant, oligarchic, or administrative republics based on their laws, which feels really silly and I'd recommend fixing that in a mod.

What affects cultures

Cultures of characters and provinces are mapped by culture_table.csv.

Every mapping is currently unique, so you can get Horse culture in EU4.

What affects religions

If you have Sons of Abraham, converter uses heresy_table_soa.csv, where every religion maps one to one.

If you don't, it uses religion_table.csv, where heresies are folded back into base religions, including some dubious mappings of unreformed pagans to various EU4 vanilla pagan types.

One very notable problem is that all Buddhists will map to EU4 Theravada, completely ignoring your character's traits. Off-map Buddhists in EU4 will have same groups as vanilla.

Another problem for CK2 Buddhists is that your vassals will rarely convert Hindu/Jain provinces as they're in same culture group, but in EU4 they're suddenly in a separate group ever since patch EU4 1.6 - which to be honest still feels like a highly questionable choice.

What affects vassals

Converter doesn't generate PUs, marches, protectorates, or tributaries, but it sometimes generates vassals. There's special logic for HRE.

For non-HRE countries, if you have Conclave, government_table.csv specifies maximum number of vassals generated - between 0 to 2 depending on your laws.

Without Conclave, rules are specified by defines.lua and maximum number of vassals is 4, but it will only happen at zero crown authority.

Generated vassals will often start at very high liberty desire.

For some reasons vassals won't have heirs generated.

How Holy Roman Empire works

One title, chosen by defines.lua (by default e_hre, but you can change it) uses special Holy Roman Empire converter mechanics.

It will turn all your CK2 vassals into independent countries unless you have absolute crown authority (non-Conclave), or its Conclave equivalent.

This also includes your de jure vassals - so even if you're king of Lombardy and Holy Roman Emperor, you'll be left with just your demesne and duke tier title.

Meanwhile even viceroys will keep all their vassals' lands, de jure or not, which feels rather silly overall. I'd recommend destroying all king-level viceroyalties by console if you want to convert HRE.

All lands in your empire, regardless of de jure status, become part of empire, even if they're in Africa or Asia.

You can be HRE as any religion, like Zoroastrian or Jewish. It will generally result in HRE starting at religious peace.

Emperor will have a permanent claim on any province contested between HRE members due to map conversion rules, which I find rather silly, and I'd recommend removing them.

EU4 interface for HRE has very small area for HRE princes, so it's very likely conversion game will just overflow it. Then again, it's not uncommon for the interface to overflow during EU4 campaign if you create a bunch of new princes. It's another example of Paradox games seriously needing bigger interface mods for people with first world monitors.

What affects claims

You'll get permanent claims on any land that's your de jure that you don't own - including land generated by your vassals (but not HRE members).

You'll also get a permanent claim on any land that should be partly yours by map conversion, but which another country got.

There are no regular claims.

How are tags converted

Every CK2 country - independent, generated vassal, or generated HRE member - gets EU4 tag.

It's based on their primary title and nation_table.csv. So for example kingdom of Bulgaria (k_bulgaria) gets tag BUL (Bulgaria).

Converter also has a small number of unique tags like ISR Israel, JOM Jomsvikings etc.

If tag is not listed, a new dynamic tag will be generated like X01, X02 etc., with appropriate names.

Countries with existing tags have same national ideas they'd have in vanilla EU4. For dynamically generated countries, it's based on their cultures etc., just as for existing EU4 minors.

However - if you use cultural names (like Norge, Danmark etc.) these will always convert to dynamic tags. This doesn't affect their idea groups.

What happens if there are duplicate tags

Sometimes two countries map to same tag, like duchy of Perm and kingdom of Perm. One of them will get proper tag PRM, the other will get dynamic tag with same name. In my tests, duchy got the real tag, and it's not clear why.

It's probably good idea to rename them manually in such case.

If you rename a country in CK2, it keeps that new name on conversion.

What affects government rank

It's directly mapped from CK2.

There are rules within EU4 that can change your rank - for example if you're vassal, or non-elector HRE member you'll get reduced to duchy on next monthly tick.

What affects technology groups

Technology groups are based on location of your capital. You'll get Western, Eastern, Muslim, Indian, West African, and East African tech groups based on which group your capital would get it in EU4.

One exception is that nomads always get nomad technology group.

I haven't seen any Anatolian (Ottoman) technology group nations.

Things like your religion, your technology, your primary tag etc. don't seem to have any impact on tech group you'll get - if you're Sunni France with maxed out tech but your capital is in Constantinople you'll get Eastern group.

Rest of the world gets their predefined groups. If you play with Sunset Invasion New World will be mostly High American technology group, which is strongest group in game - like Western except with better units.

All this doesn't matter much since institution system got added.

How national ideas work in EU4

In normal EU4 game each national ideas have associated trigger, so to get English ideas you need to start as ENG England or GBR Great Britain; to get Rajput ideas you need to be Rajput or Malvi culture and non-Muslim etc.

If no ideas match, you get generic National Ideas, which tend to be awful. By now very few countries in EU4 get National Ideas.

What affects national ideas in converted games

Converter adds some new national ideas with new triggers, for example Karlings, Israel, or Jomsvikings get some new ideas.

Converter also disables a lot of idea groups from EU4, and changes trigger rules for others.

For example to get English ideas you no longer need specific tag, you need to be English or Anglo-Saxon culture kingdom or empire with at least 10 provinces (after conversion) and at least 5 coastal provinces. Simply being kingdom of England or ENG tag does not suffice.

You can check these rules in common/ideas/*.txt in generated mod, which comes from copy/common/ideas/*.txt and sunset_invasion/common/ideas/*.txt.

What about nations matching no rules

Because these rules tend to be very restrictive, most countries get no ideas - they'll show as having generic "National Ideas" when you start new EU4 game.

That's not however what happens - they all get some random set of custom ideas, similar to what you could do with EU4 nation designer. CK2 converter changes weights for these custom ideas to better work with generated countries.

Whenever you start new campaign, EU4 will randomly select new set of ideas, so there's no way to predict them.

You can check their weights in common/custom_ideas/*.txt in generated mod, which comes from copy/common/custom_ideas/*.txt.

Are any buildings generated

The only buildings generated are basic forts, and I can't see any pattern to them.

Known Bugs

As of CK2 2.8 Jade Dragon, converter got updated to support EU4 1.23 Cradle of Civilization. There are still some unsolved problems.

With Sunset Invasion, some new world provinces have 0 base production. These are:
  • 367 The Azores - uncolonized
  • 368 Madeira - uncolonized
  • 852 Mexico - Aztec gold
  • 2626 Tullucan - Aztec gold
  • 2628 Tepeacac - Aztec grain
As two of five bugged provinces are Aztec goldmines, this effectively makes them far weaker than they were supposed to be.

Occasionally province's controller won't have a core on it for no clear reason.

There's a bunch of province visibility glitches depending on tech group, like seeing Iceland but not waters around it. These generally don't cause any serious gameplay problems.

Playing with any combinations of versions other than supported ones (and hotfixes) will invariably cause additional issues. Usually there are minor, like any newly added provinces having wrong setup  - either uncolonized, or controlled by whoever controlled them in 1444 vanilla EU4 start.

Using converter with map mods

If you're willing to mod province_table.csv, you can have map mods on both ends, but that's significant project, especially without proper tools.

Then again, the kind of people who play megacampaigns are probably excactly the kind of people who would put that effort.

If mod you're using changes map only somewhat, you can always try converting and then clean up a bit manually.

Advanced conversion

You can get a lot from the converter:
  • during CK2 campaign, play with converter in mind - so if you want some cultures, religions, HRE, etc. just setup things accordingly
  • when campaign ends, just grab console and do any cleanup you want, removing bordergore, setting laws appropriately (to spawn or not spawn vassals) etc.
  • run the converter
  • cleanup converter files - doing things like removing silly claims, moving CoTs to more sensible places, giving everybody traits you feel they deserve, fixing Buddhists to match type you want etc.
  • start new game
  • possibly cleanup map some more before starting to play
It's up to you how much of it you really want.

Writing your own converter

Converter doesn't do anything magical - the most complex part is province_table.csv. So based on just that file and save game it wouldn't be that hard to just create your own converter, customized whichever way you need.

Are there any third party converters?

The only one I'm aware of doesn't work with current version of the game, so no.

It's not terribly hard to write one (especially if you reuse province table), but then the real work of keeping it updated begins.

Summary

And that's all I discovered about the converter. If you have any corrections, questions, or feedback, please comment and I'll update this post.