|
|
Line 1: |
Line 1: |
| [[Category:Getting started]] | | [[Category:Getting started]] |
| This page provides information on how to set up a development environment for Kerbal Space Program 2 modding.
| | There are three main types of projects that you will be creating most of the time: |
|
| |
|
| ==Prerequisites==
| | * '''Unity project''' - used to add objects such as parts or planets into the game. |
| This guide assumes you have the following prerequisites satisfied:
| | * '''.NET project''' - mostly composed of C# code, useful for example for various small QoL and gameplay enhancements or fixes, etc. |
| | * '''Mixed project''' - a combination of the previous two, used for example if you want to create parts with custom modules, or when making a gameplay tool with a UI. |
|
| |
|
| # That you own a copy of Kerbal Space Program 2
| | To set up a standalone Unity project, see [[Setting up Unity]]. |
| # That you have the .NET 6 SDK or newer installed
| |
| # That you have an IDE such as Rider or Visual Studio 2022, or some other way to compile C# code into a DLL
| |
| ==Template Setup==
| |
| This is the first step in setting up a development environment, depending on which IDE/method of compilation you are using it has to be done in a few different ways.
| |
|
| |
|
| ===Visual Studio or no IDE===
| | For the .NET and mixed project types, you can use the [https://github.com/SpaceWarpDev/SpaceWarp.Template SpaceWarp.Template]. Further instructions are provided on the repository's homepage. |
| First install the template using the following command in the command line:
| |
| dotnet new install SpaceWarp.Template
| |
| ====Visual Studio====
| |
| If you are then using Visual Studio to develop the mods, the next steps are as follows:
| |
| # Open Visual Studio
| |
| # ''Create a new project''
| |
| # Search for "SpaceWarp" in the search bar at the top, then select it and click ''Next''
| |
| # Fill out your project name and click ''Next''
| |
| # Fill out the fields on the following page. You can find more information about the parameters by hovering over the corresponding "i" icons
| |
| # Click on ''Create'' and your project will be made.
| |
| ====No IDE====
| |
| If you aren't using Visual Studio, use the following command but replace all the parameters with the ones to describe your mod
| |
| dotnet new spacewarpmod -n MyAwesomeModName -G my_awesome_mod_name -A "munix" -B "com.github.munix.my_awesome_mod_name" -M "My Awesome Mod Name" -D "This is the description of my awesome mod." -S "https://github.com/munix/MyAwesomeModName" -V "1.0.0"
| |
| {| class="wikitable" style="margin:auto"
| |
| |+ Parameters (Bold entries are required)
| |
| |-
| |
| ! Parameter !! Console Argument !! Short Argument !! Description !! Default Value
| |
| |-
| |
| | Project name || --name || -n || The name of your project in PascalCase || <code><current directory name></code>
| |
| |-
| |
| | TargetFramework || --TargetFramework || -T || .NET version to target, default value is set for KSP 2 || <code>.netstandard2.0</code>
| |
| |-
| |
| | UnityVersion || --UnityVersion || -U || Unity version to target, default value is set for KSP 2 || <code>2020.3.33</code>
| |
| |-
| |
| | '''GUID''' || --GUID || -G || Your mod's ID which serves as the folder and .dll name of your built mod, used by SpaceWarp || -
| |
| |-
| |
| | '''Author''' || --Author || -A || The name(s) of the mod's author(s) || -
| |
| |-
| |
| | '''BepinexName''' || --BepinexName || -B || Your mod's ID in domain syntax, for example: com.github.author.modname, used by BepInEx || -
| |
| |-
| |
| | '''ModName''' || --ModName || -M || The name of your mod || -
| |
| |-
| |
| | Description || --Description || -D || A short description of your mod || <code>""</code> ''(empty)''
| |
| |-
| |
| | Source || --Source || -S || The repository or download location of the mod's source code || <code>""</code> ''(empty)''
| |
| |-
| |
| | Check Version || --CheckVersion || -C || URL to up-to-date swinfo.json for version checking (for example: https://raw.githubusercontent.com/author/mod/main/swinfo.json) || <code>""</code> ''(empty)''
| |
| |-
| |
| | Version || --Version || -V || The mod's initial version || <code>1.0.0</code>
| |
| |}
| |
| ===Rider===
| |
| For Rider the steps are as follows:
| |
| # Download the latest release of [https://github.com/arthomnix/KerbalDev/releases KerbalDev]
| |
| # In Rider, install the plugin by going to the Settings -> Plugins, and click the gear icon to install the zip file as a plugin from disk
| |
| # Now create a new solution via the new SpaceWarp Mod template, and fill out every parameter except Description/Source/Check Version
| |
| ==Post Template Instantiation==
| |
| After you have instantiated the template, the next steps are to copy KSP2's DLL to the project, this is done by copying <code><KSP2 Root>/KSP2_x64_Data/Managed/Assembly-CSharp.dll</code> into the <code><project root>/external_dlls/</code> folder.
| |
| | |
| Now you should be set up with an example project and can get started on your mod.
| |