A little while ago, I saw someone post a script in a reddit comment that exported family trees from saves and converted them to GEDCOM, which can be read by most family tree software. Unfortunately it was last updated in 2013. So I took it, updated it to the latest non-beta save version (it may still work with the beta patch, however), rewrote the parser, and added new features to it that I wanted. Since the other authors of the script don't care who changes or shares it, I thought I would post it here in case it was useful for anyone else.
What you need
1. A UNENCRYPTED savefile.
2. Python 2.7, available for Windows and linux (NOT 3.x)
3. The scripts, (just click "Clone or download" and then "Download zip" and you'll get a zipfile with the scripts and the readme)
3. Knowledge of the path to your CK2 install directory, and to your mod directory if you play with mods.
4. A program that can read GEDCOM files. If you don't have one, there's a great free site I used to use for making Sims 2 family trees that also reads GEDCOM, familyecho.com. I've been using that for all of my testing and CK2 family tree purposes as well.
How to run the script
First, open settings.py in your favorite text editor or word processor. At the top there is a section like so:
The lines that begin with # are comments. The rest describe options that you may want to play with. ck2_install_dir is the path to your install directory (I've included here my path on Windows to give you a hint where to find it, and my path on linux in the comment below). mod_dir is the path to your mod directory, although you don't need it if you don't play with any mods. The other options can be either True or False and I've given descriptions of what they are in the comments. (The reason it puts primary titles in the "occupation" field is that you can set family echo to show that field under the names, which suited my needs.)
Next: place your savefile in the same directory as the scripts. In Windows, you can just double-click on ck2_ged.py and tell windows to open it with Python (if you're in linux, I trust you know how to run a python script). It will prompt you for what mods you are using, read the files it needs, then prompt you for your savefile name. At some point it will also ask you how big a tree you want (there are four options). When it finishes, you'll have a <savename>.ged file in the same directory as the script and the save. You can test it by loading it into familyecho.com
Limitations and caveats
- The save takes a little while to read. There is a little ASCII progress bar that at least works in Windows that shows you how fast it is going. The longer the save ran for and the more people the game generated, the longer it will take to read. If you don't want titles generated, turn it off - the script will have to chew through less of your savefile (although the progress bar will be inaccurate).
- Depending on what settings you choose and how fecund your dynasty was, the resulting .ged file can be quite large. I generated a family tree of every single person that ever lived on a 769-1450 game and it was 85 Mb, 77 Mb after removing the loners. In the same game, I generated a family tree of every single Abbasid, and their non-Abbasid spouses, parents, and descendants, and it was 13 Mb. Just the Abbasids and their non-dynastic close family members got it down to 1.6 Mb. Note that family echo only accepts files less than 8 Mb (but it loaded the 1.6 Mb file just fine). The entire tree is probably not a good choice unless you have a program that can handle all that data. I don't know what the numbers look like if your dynasty is so big that e.g. the game crashes when you load the dynasty tree.
- Regnal numbers may be different from in-game regnal numbers if there are inconsistently linked names.
- There seems to be no way to tell if a deceased person held a title as a viceroyalty, so the script just assumes that if the title is currently a viceroyalty it always was. This really only matters to determining dead people's proper rank names.
Anyway, let me know if something is broken. I did a bunch of tests, but there's probably many things I wasn't able to cover.
Bug Reports
Post in the thread. I probably need to see your save file and know what mods you are using.
Changelog
What you need
1. A UNENCRYPTED savefile.
2. Python 2.7, available for Windows and linux (NOT 3.x)
3. The scripts, (just click "Clone or download" and then "Download zip" and you'll get a zipfile with the scripts and the readme)
3. Knowledge of the path to your CK2 install directory, and to your mod directory if you play with mods.
4. A program that can read GEDCOM files. If you don't have one, there's a great free site I used to use for making Sims 2 family trees that also reads GEDCOM, familyecho.com. I've been using that for all of my testing and CK2 family tree purposes as well.
How to run the script
First, open settings.py in your favorite text editor or word processor. At the top there is a section like so:
## User Options ######################################################
# Your CK2 install directory:
ck2_install_dir = r'C:\Program Files (x86)\Steam\steamapps\common\Crusader Kings II'
#ck2_install_dir = r'/home/ruth/.local/share/Steam/steamapps/common/Crusader Kings II'
# Your mod directory where mods get installed:
mod_dir = r'C:\Users\User\Documents\Paradox Interactive\Crusader Kings II\mod'
#mod_dir = r'/home/ruth/.paradoxinteractive/Crusader Kings II/mod'
# Remove characters with no family? (Mainly only has an effect if you generate the entire tree)
cull_loners = True
# Remove otherwise unrelated spouses that produced no children?
cull_childless_spouses = False
# Use real fathers (as opposed to presumed fathers?
real_fathers = False
# Generate primary title in "occupation" field and years of rule in "notes" field?
generate_titles = True
The lines that begin with # are comments. The rest describe options that you may want to play with. ck2_install_dir is the path to your install directory (I've included here my path on Windows to give you a hint where to find it, and my path on linux in the comment below). mod_dir is the path to your mod directory, although you don't need it if you don't play with any mods. The other options can be either True or False and I've given descriptions of what they are in the comments. (The reason it puts primary titles in the "occupation" field is that you can set family echo to show that field under the names, which suited my needs.)
Next: place your savefile in the same directory as the scripts. In Windows, you can just double-click on ck2_ged.py and tell windows to open it with Python (if you're in linux, I trust you know how to run a python script). It will prompt you for what mods you are using, read the files it needs, then prompt you for your savefile name. At some point it will also ask you how big a tree you want (there are four options). When it finishes, you'll have a <savename>.ged file in the same directory as the script and the save. You can test it by loading it into familyecho.com
Limitations and caveats
- The save takes a little while to read. There is a little ASCII progress bar that at least works in Windows that shows you how fast it is going. The longer the save ran for and the more people the game generated, the longer it will take to read. If you don't want titles generated, turn it off - the script will have to chew through less of your savefile (although the progress bar will be inaccurate).
- Depending on what settings you choose and how fecund your dynasty was, the resulting .ged file can be quite large. I generated a family tree of every single person that ever lived on a 769-1450 game and it was 85 Mb, 77 Mb after removing the loners. In the same game, I generated a family tree of every single Abbasid, and their non-Abbasid spouses, parents, and descendants, and it was 13 Mb. Just the Abbasids and their non-dynastic close family members got it down to 1.6 Mb. Note that family echo only accepts files less than 8 Mb (but it loaded the 1.6 Mb file just fine). The entire tree is probably not a good choice unless you have a program that can handle all that data. I don't know what the numbers look like if your dynasty is so big that e.g. the game crashes when you load the dynasty tree.
- Regnal numbers may be different from in-game regnal numbers if there are inconsistently linked names.
- There seems to be no way to tell if a deceased person held a title as a viceroyalty, so the script just assumes that if the title is currently a viceroyalty it always was. This really only matters to determining dead people's proper rank names.
Anyway, let me know if something is broken. I did a bunch of tests, but there's probably many things I wasn't able to cover.
Bug Reports
Post in the thread. I probably need to see your save file and know what mods you are using.
Changelog
Last edited:
- 1