Crusader Kings III

Crusader Kings III

評價次數不足
How to save space on your main drive (or; alternate mod location)
由 Alexis 發表
In this guide we will examine a way to move the mod folder in any Paradox game that stores it's files in a certain directory.
This can be used to save space on your main drive, speed up loading times, or make managing your mods easier.
I've used this on CK2, Stellaris, HOI4, EU4, and CK3, on both Linux and Windows.

The guide will be broken down into sections; starting with the exact how-to, followed by the explanation on why we use this exact method, and then finished with acknowledgements and further reading so you can apply this in different ways to other problems.
I really like making game guides so feel free to drop a like so I know it worked, or a comment when you need more information or find better ways of doing it, and check out my other guides I guess.

The reason to use this method over editing .ini files is that it avoids editing .ini files that can be reverted by game updates and it avoids using other hacks such as registry hacks that can also be undone or inadvertently modified by actions like Steam updates or game reinstallations.

A terminal and one line is all it takes really.
   
獎勵
加入最愛
已加入最愛
移除最愛
Methods (Linux, Windows, multiple types)
Brief description
We will create a junction from the default mod storage location to the place where you would like to put your modifications. This will stop mods being stored at;
  • Linux - ~/.local/share/Paradox Interactive/Crusader Kings III/mod
  • Windows - %USERPROFILE%\Documents\Paradox Interactive\Crusader Kings III\mod

Example
I have a folder on an SSD where I put all my Paradox mods for ease of access. It can be on the same storage device as your Paradox game because (for now) they don't use multi-threaded loading.

There's a blog-post I'll fetch later where they talked about it for Stellaris but the results weren't great.

My Junctions point from the default mod location to ../Paradox/{game}/activeMods. Note that for CK3 I switched naming convention to ../unzippedMods to make it easier to differentiate between my mod archive where I keep my compressed mod files and my extracted mods for active use.

So for this I have a Junction from
"C:\Users\fruitTube\Documents\Paradox Interactive\Crusader Kings III\mod"
to
X:\Paradox\CK3\unzippedMods
One last note, you don't need spaces in your URL's (directory names) if they don't have spaces in.

Requirements
Before we begin, let's get some stuff squared away;
  1. The default mod location, but up one level
  2. The desired mod location path
  3. A command-line or terminal window. These features are built into UNIX and are quite old, so you won't need to install anything extra
  4. Close Steam to prevent it from locking your directories whilst you're doing this
  5. Rename the default mod folder to something like "modOLD" so we can copy across any of your Steam or existing mods to the new directory through the link later
You may need to use an elevated terminal. This means "As administrator" or "with Sudo".

Linux
Open a terminal window (Default is Super+T or Win+T), ideally at
~/.local/share/Paradox Interactive/Crusader Kings III
You will use the link function in the terminal
ln "~/.local/share/Paradox Interactive/Crusader Kings III/mod" "{your desired mod storage location}"
Alternatively, try simply
ln mod "{your desired mod storage location}"
Example with my settings
ln "C:\Users\fruitTube\Documents\Paradox Interactive\Crusader Kings III\mod" X:\Paradox\CK3\unzippedMods
If it's successful then when you hit return you won't get an error. To confirm, use your file explorer to open the mod location. If it worked you will find yourself in the directory you created but the file path you used to get there will read
~/.local/share/Paradox Interactive/Crusader Kings III/mod

Windows command line method
Open a command window, there's a lot of ways to do this in Windows 10
  • Tap ⊞ and type "cmd" then hit return
  • Or ⊞+r then type "cmd" and hit return
  • Or right-click the start menu if you haven't told Windows to switch to PowerShell by default
  • Or shift+right click in the folder you want to work in and select "Open Command window here" if you haven't told Windows to switch to PowerShell by default

You should now have a terminal window. To the left should be the directory that you're applying from. It should be the default mod directory.

Now type
mklink /j "C:\Users\{your username}\Documents\Paradox Interactive\Crusader Kings III\mod" "{your desired mod storage location}"
Example with my settings
mklink /j "C:\Users\fruitTube\Documents\Paradox Interactive\Crusader Kings III\mod" X:\Paradox\CK3\unzippedMods

If it's successful then when you hit return you won't get an error. To confirm, use your file explorer to open the mod location. If it worked you will find yourself in the directory you created but the file path you used to get there will read
C:\Users\{your username}\Documents\Paradox Interactive\Crusader Kings III\mod

PowerShell method
Pretty much everyone in Windows 10 has PowerShell now, and this my preferred terminal in Windows for now.

All the ways that apply to launching Windows command-line work for this too:
  • Tap ⊞ and type "powershell" then hit return
  • Or ⊞+r then type "powershell" and hit return
  • Or right-click the start menu if you told Windows to switch to PowerShell by default
  • Or shift+right click in the folder you want to work in and select "Open Command window here" if you told Windows to switch to PowerShell by default


You should now have a PowerShell window, now type
New-Item -ItemType Junction -Path "C:\Users\{your username}\Documents\Paradox Interactive\Crusader Kings III\mod" -Target "{your desired mod storage location}"
Example with my settings
New-Item -ItemType Junction -Path "C:\Users\fruitTube\Documents\Paradox Interactive\Crusader Kings III\mod" -Target X:\Paradox\CK3\unzippedMods
If it's successful then when you hit return you won't get an error. To confirm, use your file explorer to open the mod location. If it worked you will find yourself in the directory you created but the file path you used to get there will read
C:\Users\{your username}\Documents\Paradox Interactive\Crusader Kings III\mod
Errors and failures
Where have I messed up that you can learn from?
  1. Made a SymLink instead of a Junction
  2. Forgot quotation marks on directory URLs that had spaces in
  3. Forgot to rename the old mod directory
  4. Forgot to close Steam
  5. Forgot to launch the terminal with elevated priveleges

Junction!
For this method to work we specifically need to use the junction because of the way the game is coded. You will know you accidentally used a soft link instead of a junction when you use the game launcher and see your mods there but they don't load into the game when selected.

Replace your soft link with a hard link, well done so far though!


Importance of quotation marks
Spaces in command-line entries mean that the last thing we input is finished and we are moving onto the next thing now. So the space in "Crusader Kings" would mean that if we typed that in without them when doing "mklink" we would be saying:
Make a link, it's going to be a Junction, start it from C:\Users\You\Documents\Paradox\Crusader, "kings" (What is "kings? "kings" isn't part of mklink⁈), "III" (What is this nonsense? "III" doesn't mean anything), X:\Paradox\Mods\crusaderKings3\modDirectory.
Mklink would stop at "kings" and "III" because they aren't directories it can make a junction to, so it would error out before getting to your desired mod location of "X:\Paradox\Mods\crusaderKings3\modDirectory"

When you get an error try with quotation marks, or even use them by default.


Rename old mod directory
If a directory (folder) exists with that name then the SymLink, Junction, and Hardlink cannot take that name. You can create a shortcut with that name but Windows by default hides that a shortcut is a .lnk file (Link file), so a shortcut to the new mod directory to Windows would look like "mod.lnk" not "mod".
Some programs like Grand Theft Auto 3: Vice City are programmed to deal with that and can parse[en.wikipedia.org] that there is a .lnk file and understand that it should play what the .lnk is pointing to not try to play the .lnk file as music, for example.

Read the friendly manual and rename the old directory before linking there.


Close Steam
Programs have hooks[en.wikipedia.org] to grab resources. If Steam is updating the mod directory it might hook the files inside it which will rightfully prevent you from renaming the directory to the temporary name.

RTFM; Close Steam to prevent this from happening.


Why Admin?
This trick uses some pretty low-level methods to modify your operating system. You're telling your OS to pretend that a location on your PC is actually in two or more places at once. The reason we're doing it so low is because of the way that Paradox games access their mod directories in conjunction with Steam, if they used a higher-level way to access their mods we could probably just use a shortcut.

An easy one to forget. Always try to do as little as possible on your computer as Admin! Well done so far!
Explanation
Why does it have to be this way?

Paradox has hard-coded it's games to find it's modifications in these directories. These versions of their games find and iterate the mods as a program looks for a specific file-type. One way we can see the difference is when you accidentally create a soft-link instead of a junction.

When you accidentally create a soft-link you will see that Paradox Launcher correctly itemises the mods in your substitute mod directory, but after you've selected them in your given profile they will not be loaded by the game. This is because the Launcher is redirected by a SymLink or soft-link because it uses high-level methods to enumerate[en.wikipedia.org] the mods which is easily affected by shortcuts and the such, whereas the game executable uses much more rigid methods and so isn't easily fooled by a clearly-labelled pointer.

The Junction or hard-link erases many differences such as meta-data that would give away that this is not the actual location, the Operating System has a key there that says "When anything comes here, fetch the data from somewhere else and present it as if nothing was amiss" instead of a flag that would say "Hello friendly program, what you're looking for is not here-" your Paradox game stopped listening at this point "-If you wish to find what you seek, you should quest over here!"

This means that many programs can't tell the difference between a Junction and an actual directory. Though Linux and Windows should both be able to tell the end-user (you) that it is a shortcut because it knows (taps nose).

If we use registry entries, these can be incorrectly identified as attempts to hack the game. Or it can be that Steam or Paradox periodically repair registry entries (this is a good thing), or that they might change one small part of a registry entry when a patch arrives (this can be a really bad thing). Also if you reinstall Steam or your Paradox game, you will lose all your registry modifications.

If we adjust the .ini files this can invalidate your Ironman/Achievement mode because now it's not the same digital fingerprint, and they can also be reverted by patch updates; particularly when they add or remove a line from the .ini.
Further reading
Closing
What did you think of this guide? I've used it with every Paradox game on Linux and Windows in order to make managing my mods easier.

Do you think I should copy-paste this guide into CK2, Stellaris, EU4, and HOI4 or should I put pointer guides in those for other Steam users to bring you all here?

Do you have any suggestions or changes, drop them in the comments!

Thanks all and give a thumbs up if you liked it and a star if you start using it so you don't forget in future! Cheers!
14 則留言
Nilserrich 10 月 16 日 下午 1:00 
I just can't get it to work. The mods do not load, as described in the description as an error. Unfortunately, I'm not sure what I've done wrong.

I have tried both the console and Powershell for Windows. Is this still usable?
Seamus McAndrews 8 月 15 日 下午 8:24 
Lemme know when you come up with a solution. I'm sadly rather useless when it comes to this coding crap.
Alexis  [作者] 8 月 15 日 下午 3:41 
Sweet, I'll look into it but I'm primarily Linux now so don't have this problem so it might take a few weeks
Seamus McAndrews 8 月 12 日 下午 10:05 
I used your Powershell Junction method.
Alexis  [作者] 8 月 10 日 下午 3:33 
Which command are you using? mklink or new-item? What type of link are you creating? Hard, Soft, Junction, Symbolic?
Seamus McAndrews 8 月 8 日 下午 3:51 
EU4. And the funny part is, it isn't even deleting the symlink! It's still there! It's just installing ANOTHER mod folder.
Alexis  [作者] 8 月 8 日 下午 3:26 
So it's deleting the symlink? Is this CK3?
Seamus McAndrews 8 月 8 日 上午 11:04 
Yes, it does genuinely link the empty new mod folder to the one in my other drive. However, as soon as I start up the game with its stupid-ass launcher, it immediately force-reloads all my mods and forcibly reinstalls a new mod folder in my same damn C: Drive.
Alexis  [作者] 8 月 6 日 下午 1:09 
I can see how I need to add the final product to the mod guide so you know what it looks like.
Can you confirm that in the ParadoxLauncher directory of your user's home folder, under the game you're adjusting, that you do end up with a symlink replacing the mod folder?
Seamus McAndrews 8 月 5 日 下午 8:49 
This isn't working for me. I followed your instructions to the letter and Paracucks keeps forcibly making a new mod folder in the same stupid spot in my C: Drive every time I open the game.