Patch Manager Help

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

  1. Download and install CKAN from its GitHub Releases page

  2. Open CKAN

  3. At the top of the window select File->Manage Game Instances

  4. Then select New game instance->Add instance to CKAN

  5. Then browse for the KSP2_x64.exe file of your KSP2 installation and select that

  6. If the game instance doesn't automatically get selected, follow the previous steps up to step 4 and select the instance

  7. Search for "PatchManager" in the search bar

  8. Check the Installed checkbox

  9. Press 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

  1. Download UITKForKSP2 from Spacedock

  2. Extract the contents of the downloaded zip file for UITK For KSP2 into the root directory of your KSP2 Installation

  3. Download SpaceWarp+BepInEX from Spacedock

  4. Extract the contents of the downloaded zip file for SpaceWarp+BepInEx into the root directory of your KSP2 installation

  5. Download PatchManager from Spacedock

  6. 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:

  1. Launch KSP 2

  2. Press Settings once you get to the main menu

  3. Press Mods

  4. Scroll down until you see Patch Manager

  5. Toggle Always Invalidate Cache to Yes

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

ModFolder/ swinfo.json patches/ libraries/ configs/

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

{ "spec": "2.0", "mod_id": "YourModId", "author": "You", "name": "Your Mod", "description": "Does something", "source": "your/source/link", "version": "1.0.0", "ksp2_version": { "min": "0.1.5", "max": "*" }, "dependencies": [ { "id": "com.github.x606.spacewarp", "version": { "min": "1.5.0", "max": "*" } }, { "id": "PatchManager", "version": { "min": "0.4.0", "max": "*" } } ] }

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.

Last modified: 26 April 2024