Getting Started With Patch Manager
Setting Up Your KSP2 Installation
Before doing anything with Patch Manager, Patch Manager must first be installed into KSP2, the recommended way to do this is using CKAN, but manual installation is still possible.
If you already have CKAN installed and set up you can skip to step 7
Download and install CKAN from its GitHub Releases page
Open CKAN
At the top of the window select
File
->Manage Game Instances
Then select
New game instance
->Add instance to CKAN
Then browse for the
KSP2_x64.exe
file of your KSP2 installation and select thatIf the game instance doesn't automatically get selected, follow the previous steps up to step 4 and select the instance
Search for "PatchManager" in the search bar
Check the
Installed
checkboxPress the
Apply Changes
button at the top, and let CKAN do the rest
If you already have SpaceWarp and UITK set up, you can skip to step 5
Download UITKForKSP2 from Spacedock
Extract the contents of the downloaded zip file for UITK For KSP2 into the root directory of your KSP2 Installation
Download SpaceWarp+BepInEX from Spacedock
Extract the contents of the downloaded zip file for SpaceWarp+BepInEx into the root directory of your KSP2 installation
Download PatchManager from Spacedock
Extract the contents of the downloaded zip file for PatchManager into the root directory of your KSP2 installation
Help
- Root Directory
The root directory of your KSP2 installation is the folder that contains
KSP2_x64.exe
Setting Up the Settings for Patch Manager inside KSP2
Once you have installed Patch Manager and all the necessary prerequisites for it, since you are going to be doing development while having it installed, you will want to enable the Always Invalidate Cache Option
from within the game.
To do this:
Launch KSP 2
Press
Settings
once you get to the main menuPress
Mods
Scroll down until you see
Patch Manager
Toggle
Always Invalidate Cache
toYes
Close KSP 2
Setting Up a Modding Environment to Develop Patch Manager Patches
(Optional) Installing Visual Studio Code and the Patch Manager Language Extension for it
A very useful tool when it comes to writing Patch Manager patches is the Patch Manager syntax highlighting extension for visual studio code. This should definitely be a part of your environment if you are using VSCode or want to use VSCode.
First, if you don't already have VSCode, then you can download and install it here.
Then, once you have VSCode, you can add the Syntax Highlighting extension by searching "Patcher Language Server" and installing the one by "Sinon".
Setting up Your Mod
First off, decide here what you want your mod is going to do:
A) is it only going to add patches?
B) is it going to add patches and new parts?
C) is it going to add patches and code?
D) is it going to do all of the above?
E) Do you just want to do a single patch
Depending on your answer to the prior question, there are multiple ways to set up your modding environment
Setting up a patch only mod is quite simple, you only need to create a mod folder with a certain structure, and fill in the values of one file
Folder Structure
swinfo.json setup
The aforementioned swinfo.json
file in that above file structure has to be formatted a certain way
If you want to write it manually, you can follow the SpaceWarp documentation
When you copy this though, the following fields need to be changed
- mod_id
This is the ID of your mod, it's usually your mod name but CamelCase and with an optional prefix of your username in CamelCase to the front with a
.
- author
This is your (user)name or the (user)names of the people working on the project
- name
This is quite self-explanatory, it is the name of your mod
- description
This is a short description of what your mod does to the game
- source
If you are hosting your mods source code on GitHub or something, this field should point there, otherwise this field should be deleted
- version
This is the version of your mod, change this when you change anything about your mod, should follow semantic versioning rules
After you have set this up, anything referring to your mod folder in the future refers to the top level folder you made
For a patch + parts mod, first you need to set up unity according to the wiki, and follow the instructions at the end about building a full mod from unity
After you have done that, there should be a plugin_template
folder within unity, if there isn't, then make one, this is your "mod folder" from now on
Under your mod folder you should create 2 more folders patches
and libraries
as a sub-folder of patches
to store your patch files and patch libraries
After all that is done, you have set up your environment
For a patch + code mod, first you should set up a VS/Rider project using the SpaceWarp Template
After you have done that, there should be a plugin_template
folder inside the generated project, this is your "mod folder" from now on
After all that is done, you have set up your environment
For a patch + code parts mod, first you should set up a VS/Rider project using the SpaceWarp Template
After you have done that, there should be a plugin_template
folder inside the generated project, this is your "mod folder" from now on
After all that is done, you now need to set up unity according to the wiki, and follow the instructions at the end about copying assets (or addressables) only
Now you have set up your environment
For a single patch, you can just drop a .patch
file into BepInEx/plugins
or GameData/mods
, or any subfolder thereof
You are now ready to start writing patches with Patch Manager
Other Information
Though the documentation above states an absolute folder structure of patches
with a libraries
sub-folder, this is not strictly necessary, Patch Manager will go over every .patch
file in a mod folder, so if you want to organize your patches another way, you are able to do so, this is just our recommendation.