Jump to content

Help with Developing mods


Clockwork

Recommended Posts

Hello modding community,

I don't know if I'm posting this in the right place, but I would like to start making mods for KSP. I really have no experience modding and the only thing that I've done is scratch in fifth grade, which was 2010, so I basically have no coding/scripting experience whatsoever. I'm really just asking for help getting started, so any tips would be great. Also, if any modding teams want to take on a newbie I would really appreciate it.

Thanks.

Link to comment
Share on other sites

Welcome to the world of modding :)

Because of how open and approachable KSP is, there are two kinds of "modding" for it. One could be called "config" modding, and the other is usually called "plugin" modding.

 

Config modding gets away without writing any code at all - at least, if you don't consider Squad's ConfigNode file format to be a form of code :P The thing about KSP is that it will read any file you provide inside /GameData/ with an ending of .cfg, and if it finds something it can understand inside that file, you'll see the effect ingame. So the only thing you need to start writing KSP mods is, quite literally, a basic text editor. If you simply go into the Squad subfolder under GameData, find an engine, copy the .cfg file there, open it, and change the name field at the very top, you've already modded the game. On next startup the game will say "oh hey, here is a new part", and it will show up in the editor alongside all the other parts. And of course you can change anything you want about this new engine - thrust, cost, tech level, propellant required, anything. All in plain text, no arcane coding tools and knowledge required. You can even point it to use a different model and/or texture, if you have the skill to make models and textures.

Aside from parts, config files also define things like resources, contracts, science values and experiment definitions (down to the text that pops up when you take a temperature reading), and more! So you can do a lot with just this alone.

Your first stop when getting into the world of config modding should be Module Manager. It's a plugin mod, the existence of which is probably singlehandedly responsible for at least half the mods available today. It gives you the ability to write config files that edit other config files at runtime. So instead of going into the Squad folder and making a change there, which would permanently modify the base game files, you instead provide a config file that says "during the startup of the game, overwrite the values loaded from that other config file with these values I provide here". It makes possible so freaking much. Go worship sarbian right now, and then come back to read on.

 

Plugin modding is when you need to do something that the game doesn't already do. RemoteTech is a plugin mod; it provided the functionality of communication relays long before Squad picked up on the idea. In order to pull that off, the behavior had to be custom-written. This is done in C#, with the Unity editor (it's thankfully available for free). So if you want to do plugin modding, you need to learn C# and get familiar with Unity under the hood. In return, you can do pretty much anything you want with a plugin.

If you want to get into this kind of thing, or into modeling and texturing, there are two subforums here that focus on these things. They have guides and stuff, too! :)

 

Finally, there's a link in my signature to a community documentation wiki that includes useful info for both config modding and plugin modding - and if you see something that's undocumented that you know something about, you can just write it straight in there for everyone to see.

Link to comment
Share on other sites

What type of modding are you looking to get into? Parts,plugins,both? If there is something specific you are trying to try, you should mention it since that could help get you the advice and direction you are looking for.

 

Link to comment
Share on other sites

Thanks Streetwind and cxg2827,

I've edited a few .cfg files and made a new resource, then modified the ion engine to run off of that resource, and then tweaked the thrust of the ion engine, I also made all of the basic 1.25m part fuel tanks hold the new fuel, and with the smallest one the craft with the mk 1 command pod and the altered ion engine had 12 km/s of delta v. That was mostly just messing around, but I think that I have a basic idea of what to do.

The mods that I want to make are a space shuttle expansion that adds engines that can lock into a certain range of degrees from the center so that the thrust could point through the center of mass, and then change the range during flight. And the other mod that I wanted to make just added more science experiments, like a botany lab to get science from seeing how plants grew in the gravity and radiation from different parts of the Kerbol system, I'm not sure about the first one, but the second one I'm pretty sure how to do. I don't know how to get .mu files though, so if someone could explain that to me I would definitely appreciate it.

Link to comment
Share on other sites

On 9/5/2016 at 3:09 AM, Clockwork said:

 And the other mod that I wanted to make just added more science experiments, like a botany lab to get science from seeing how plants grew in the gravity and radiation from different parts of the Kerbol system

I don't know why this isn't already a thing. It's so obvious. As far as I know, the LLL greenhouse just gives solar power (?). I'm not sure about MKS.

Link to comment
Share on other sites

Howdy @Clockwork. I don't think there's any plant-centered science mod. All the famous mods I can think of are focused on planets, spaces, energy, telescopes and station parts. Any parts that involve plants are most likely only food-producer components in a life support system. You should really go ahead and make your botany science mod. The community will throw its arms up for you like an army of wacky inflatable arm-flailing tube men. :) 

@Streetwind you are correct. .mu files are the 3D models formatted to be recognized by the Unity engine on which KSP runs. To process them and create animations you need to get the PartTools software.

@SpaceCommanderNemo MKS agro parts only fit into life support systems, and into MKS' overall motif of irl having to micromanage your ships.

 

Link to comment
Share on other sites

19 hours ago, JadeOfMaar said:

@SpaceCommanderNemo MKS agro parts only fit into life support systems, and into MKS' overall motif of irl having to micromanage your ships.

 

heh, I would not call it micromanagement at all  - other than people trying to play pokemon with the parts and overcomplicating things (which it really is not).  That being said, you could always do something with the MPL code to make a greenhouse that gave science over time as you observe the plants.  

Link to comment
Share on other sites

What would I call what?  MKS is many things, but micromanagement of ships is not one of them (unless you really want to).  In my own saves, nine times out of ten, I just drop off a crate of machinery, make sure I have the right parts for closed loop (which you can squeeze into KIS containers and make the whole thing in-situ in one landing), and forget about it.

Link to comment
Share on other sites

On 5/4/2016 at 10:04 PM, ShotgunNinja said:

The easiest way, by far, is to go download SharpDevelop (that also include the c# compiler/assembler).
Then create a new empty project and add the reference assemblies for KSP and Unity:
- Assembly-CSharp
- Assembly-CSharp-firstpass
- KSPUtil
- UnityEngine
- UnityEngine.UI

Then take the default .cs file the project comes with, remove all the content and put this in its place:


using System;
using System.Collections.Generic;
using UnityEngine;


namespace YourStuff {


[KSPAddon(KSPAddon.Startup.MainMenu, true)]
public class MyMod : MonoBehaviour
{
  // keep it alive
  MyMod() { DontDestroyOnLoad(this); }
  
  // called at every simulation step
  public void FixedUpdate()
  {
    print("hello world");
  }
}
  
public class MyPartModule : PartModule
{
  // this is loaded from .cfg
  [KSPField] public float my_value;
  
  // this is an event
  [KSPEvent(guiActive = true, guiName = "Click me!", active = true)]
  public void ClickMe()
  {
    Monobehaviour.print("stop clicking me!");
  }

  // shown on the part tooltip in editor
  public override string GetInfo()
  {
    return "hello world!";
  }
}
  
} // YourStuff

Then, gets yours hands dirty :) Have fun

Link to comment
Share on other sites

  • 1 month later...

I started a topic on this in Add On Development, if you want to follow this. I dunno how to link it in this dicussion, but the topic is called Kerbal Botany Expansion. It is also under the tags kerbalthemartian, plantscience, and modding

Link to comment
Share on other sites

This thread is quite old. Please consider starting a new thread rather than reviving this one.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...