Difference between revisions of "Plugins"

From Kerbal Space Program Wiki
Jump to: navigation, search
m (N3X15 moved page Part Modules to Plugins: Fixing terminology so we don't have 20 different meanings, and it also clashes with some of Mike's new stuff.)
(Creating Plugins: Template::Yes and Template::No already contain a sytle. Adding one here results in raw css/html being output by the browser)
 
(20 intermediate revisions by 14 users not shown)
Line 1: Line 1:
Starting with KSP 0.14, the game supports custom part behaviors called [[Modules]]. Defining custom behaviors allows you to create totally new kinds of parts, such as flight control computers, new types of fuel supply chains, etc. You can then add these to the game in the form of plugins. These DLLs can be loaded on any platform that can run KSP.
+
'''Plugins''' are user-made [[addons]] which add to or change the behavior of KSP. They consist of one or more [[w:Dynamic-link_library|DLL]] files written in the [[w:C_Sharp_(programming_language)|C# programming language]]. Plugins allow changing how the game itself works, anything from showing new information windows to making a hovercraft part, or even new planets. Plugin support was added to KSP in version 0.14, and is available on all operating systems.
  
'''READ THE [http://kerbalspaceprogram.com/forum/index.php?topic=8088.0 POSTING GUIDELINES] BEFORE PUBLISHING YOUR PLUGIN'''
+
== Using Plugins ==
  
== Using Part Module Plugins ==
+
To use a Part Module Plugin, just drop the .dll file into KSP/GameData/ or a new sub folder inside it. To stop using a plugin, just delete it or move it outside the KSP/GameData/ folder.
  
To use a Part Module Plugin, just drop the DLL into KSP/Plugins. If the folder doesn't exist, you can create it.
+
Alternatively, if there is no specific .dll for the plugin, or if there is but any given installation instructions tell you otherwise, a good rule of thumb is to find the relevant folder within the plugin's GameData folder, and put that into KSP's GameData folder. If there are multiple folders at that level with names that approximate other plugins, it will generally do good to install them too as they are probably either dependencies of or enhancements for the plugin.  
  
== Creating Part Modules ==
+
What it is generally not recommended to do is install the plugin's GameData folder (or folders on a similar level) into that of KSP, as this may confuse the root directory and some or all of the features of the mod will be depleted.
  
First, decide which IDE you will use.  Visual Studio or the associated Express Edition works the best on Windows.  The others also work on additional platforms, like Mac or Linux.
+
== Creating Plugins ==
  
 +
Plugins can be written in any text editor and compiled with a standalone compiler, but the easiest way to start coding is to use an [[w:Integrated Development Environment|Integrated Development Environment]] or IDE for short. An IDE is a program that helps you to write code (in our case the language C#). Listed here are some of the most popular options.
 +
 +
{| class="wikitable"
 +
! IDE !! License !! Windows !! Mac !! Linux
 +
|-
 +
| [https://www.visualstudio.com/en-us/downloads/download-visual-studio-vs.aspx Visual Studio]
 +
| Freemium<sup>[1]</sup>
 +
| {{Yes}}
 +
| {{No}}
 +
| {{No}}
 +
|-
 +
| [http://www.monodevelop.com/download/ MonoDevelop (aka Xamarin Studio)]
 +
| LGPLv2 / MIT (Free)
 +
| {{Yes}}
 +
| {{Yes}}
 +
| {{Yes}}
 +
|-
 +
| [http://www.icsharpcode.net/OpenSource/SD/Download/ SharpDevelop]
 +
| Open-source (Free)
 +
| {{Yes}}
 +
| {{No}}
 +
| {{No}}
 +
|-
 +
| [https://www.jetbrains.com/dotnet/promo/unity/ JetBrains Rider]
 +
| Commercial/Some open-source
 +
| {{Yes}}
 +
| {{Yes}}
 +
| {{Yes}}
 +
|-
 +
 +
|}
 +
<sup>[1]</sup> Free without restrictions for individual users, larger teams have to pay to use multiple licences
 +
 +
== Getting Started ==
 +
 +
See the below links for setting up your chosen IDE for building KSP plugins. Once you're ready to build, try [[Tutorial:Creating your first module|creating your first module]].
 
* [[Setting up Visual Studio]]
 
* [[Setting up Visual Studio]]
 
* [[Setting up MonoDevelop]]
 
* [[Setting up MonoDevelop]]
 
* [[Setting up SharpDevelop]]
 
* [[Setting up SharpDevelop]]
* [[Setting up Nant]]
 
  
Now, you can get started.
+
== See Also ==
  
* [[Creating your first module]]
+
* [[Community API Documentation]]
 +
* [[Tutorial:Creating your first module|Creating your first module]]
 
* [[Module Tips and Tricks]]
 
* [[Module Tips and Tricks]]
* [[:Category:Part Modules|List of stock Part Modules.]]
+
* [[CFG File Documentation#Part Modules|List of stock Part Modules.]]
 
* [[Module code examples]]
 
* [[Module code examples]]
* [[Community API Documentation]]
+
* [http://forum.kerbalspaceprogram.com/threads/56053-Example-plugin-projects-to-help-you-get-started Example plugin projects]
 +
* [https://www.youtube.com/watch?v=ilWZjYx7brE cybutek's .20+ quick start video guides]
 +
* [http://forum.kerbalspaceprogram.com/index.php?/forum/29-plugin-development-help-and-support/ KSP Forum Plugin Development Support section]
  
 
[[Category:Modding]]
 
[[Category:Modding]]

Latest revision as of 14:53, 15 November 2020

Plugins are user-made addons which add to or change the behavior of KSP. They consist of one or more DLL files written in the C# programming language. Plugins allow changing how the game itself works, anything from showing new information windows to making a hovercraft part, or even new planets. Plugin support was added to KSP in version 0.14, and is available on all operating systems.

Using Plugins

To use a Part Module Plugin, just drop the .dll file into KSP/GameData/ or a new sub folder inside it. To stop using a plugin, just delete it or move it outside the KSP/GameData/ folder.

Alternatively, if there is no specific .dll for the plugin, or if there is but any given installation instructions tell you otherwise, a good rule of thumb is to find the relevant folder within the plugin's GameData folder, and put that into KSP's GameData folder. If there are multiple folders at that level with names that approximate other plugins, it will generally do good to install them too as they are probably either dependencies of or enhancements for the plugin.

What it is generally not recommended to do is install the plugin's GameData folder (or folders on a similar level) into that of KSP, as this may confuse the root directory and some or all of the features of the mod will be depleted.

Creating Plugins

Plugins can be written in any text editor and compiled with a standalone compiler, but the easiest way to start coding is to use an Integrated Development Environment or IDE for short. An IDE is a program that helps you to write code (in our case the language C#). Listed here are some of the most popular options.

IDE License Windows Mac Linux
Visual Studio Freemium[1] Yes No No
MonoDevelop (aka Xamarin Studio) LGPLv2 / MIT (Free) Yes Yes Yes
SharpDevelop Open-source (Free) Yes No No
JetBrains Rider Commercial/Some open-source Yes Yes Yes

[1] Free without restrictions for individual users, larger teams have to pay to use multiple licences

Getting Started

See the below links for setting up your chosen IDE for building KSP plugins. Once you're ready to build, try creating your first module.

See Also