Update: Added timestamps so you can quickly scrub to each relevant part of the video. The video should now be split up into chapters you can easily see. Enjoy!
An EXCELLENT tutorial! Quick, concise, no unnecessary information, no screwing about. Any other UA-camr would've made this a 20 minute video detailing their goldfishes life story interspersed with little nuggets of actually useful information that are hard to pick out from the garbage. I've no intention of making my own plugins, but I've thoroughly enjoyed this tutorial. Thank you, sir!
Thank you! I feel like some parts may go over a lot of heads for those who don't know how to program, but I decided not to explain everything because it just takes too long I think too many YTers try to explain how to code instead of what their code is actually doing (the how to code part has to be done by the viewer, the information doesn't need repeating!) Thanks dude o7
@@Gameslinx I agree with that sentiment. If one doesn't already have the basics of coding down, then this isnt the first video one should be watching. I think you did a masterful job of providing all the relevant information without the over explanation that seems omnipresent in tutorials of this category.
This video is for the people who requested it and hopefully for anyone new who wants to get into plugin / mod development for KSP :) Note: By no means am I any good at this, lol
Really well done. Very clear, concise and to-the-point. Few things that I want to point out though: 1. It's generally good practice to use the 'sealed' keyword on classes that you know aren't going to be inherited further. Especially in the case of custom attributes, this gives some optimizations besides making your code more secure. 2. The 'Update' method and all other built-in MonoBehaviour messages (such as OnValidate, Awake, Start, LateUpdate and FixedUpdate) are called regardless of accessibility. You can also mark it as private and it'll still work. In fact, you can label built-in message methods as 'protected virtual' or 'protected abstract' if you want to override them later, and it'll all work perfectly. 3. You're currently creating a new instance of System.Random every frame, which will result in persistent memory pollution. In fact, the higher your framerate, the faster your memory will fill up. I recommend removing line 20 at 4:43, and instead, directly inside 'RandomPartExplosion', write: private static readonly System.Random rnd = new System.Random(); Readonly is safe here because you aren't going to assign a new instance of System.Random. Static is also safe in this case because all instances of this script will use a random number generator with the same seed, so using 'static' means that the generator instance is shared between instances of 'RandomPartExplosion' instead of Unity having to create a new instance of System.Random every time it creates a new RandomPartExplosion instance. The benefit of using that static keyword is that the System.Random instance is created on game startup, otherwise it is re-created every time you enter the flight scene. It slightly lowers the amount of memory garbage generated by a scene switch whilst also lowering the amount of memory that is to be allocated when entering the flight scene. 4. FlightGlobals might not be ready when Update first runs. So check if it is, and if not, abort the method early because otherwise there is no list of parts to refer to because the vessel isn't ready yet. This saves some NullReferenceExceptions. If you want to be particularly fancy, you can use this initialization to cache your reference to the active vessel, like so: private Vessel activeVessel = null; void Update() { if (activeVessel == null) { if (!FlightGlobals.ready) return; activeVessel = FlightGlobals.ActiveVessel; } } Creating this localized pointer also increases performance a bit. 5. (key == true) and (key) are actually not identical. The former also includes a call to the boolean == operator without producing any different results. The latter option is simpler and saves a few CPU instructions. The compiler _might_ catch it, but it's probably best to play it safe. 6. Don't forget to update Properties/AssemblyInfo.cs. KSP defines the 'KSPAssembly' attribute for this file. It makes it easier to detect and catalog KSP mod dll's by the game. Especially when combined with the other attribute, 'KSPAssemblyDependency'. KSPAssemblyDependency refers to the values of KSPAssembly to determine which dll's are dependencies of another dll, and so whether to skip loading a certain dll because its dependencies are missing, or whether to postpone loading a certain dll until its dependencies have been loaded. 7. I need to update KS3P.
Sup my dude. New sub, long time software engineer. Had I known it was this simple, I'd be doing this several years ago. Just wanted to say thanks, you inspired this dev to start modding.
Thanks for making this! As a moderately experienced programmer, all I needed was a way into modding KSP. This plugin itself could even has use on my channel, where I make KSP cinematics. Keep this great content coming, I like your videos.
I had no idea it was possible mod ksp using C#, that's awesome man ! I would really love to see more tutorials on other aspects like showing message boxes etc.
@Not A offical gamer I've been using unity for 3+ years and have medicore C# experiece. I just didnt know it was possible to mod the game with C# using premade libraries :)
I've been looking for a good intro to creating KSP plugins and this helped a great deal just to know where to start from and let google take it from there. Thanks a bunch for making this and look forward to seeing what else you put out on the subject!
@Linx MORE PLEASE! lots, your one of the few making videos after the KSP v1.5 unity engine update! I'm @aazard on ksp forums, I make the humanStuff mod, a big part of that is teaching new users to start with head and suit textures and then skyboxes, finishing on making DLL's and such (I used your video to make my 1st DLL to add custom DSS load screens outside of typical user interaction. YOUR AWESOME, I can make object classes/dll's now!
You gave us too much power... Unlimited POWER.... (Hmm, how about mod, that every 10s replaces your random part, to random part from part list. Probably impossibile, but lets try)
I know I'm a bit late and you might not see this, but if you do, do you mind explaining how to add in an animated model and put it in as a part (landing legs and robotics) please?
how do I make a plug-in where there is a window with simple controls to change the kerbals camera position to move around in iva mod and also interact with hatches switches toggles etc computers
is there any where to do this on linux? edit: i got it to work with monodevelop but when i attempt to run the plugin it lags really bad. could there be any particular reason why?
ik its been 8 months but visual mods usually aren't actual plugins, they're usually just configs for other mods such as Distant Object, Environmental Visual Enhancements, Scatter, Parallax, etc.
@@Gameslinx kinda but its still better than all i found most other tutorial i find are 11y and 6y old and you have to use VS 2022 like what addon or workload i have to add ? i didn't know so i checked all box 40gb of stuff and i did use 4.8 since it refused to use the 4.7.2 but i gave up trying to update that mod from that guy FullAutoStrut he has a infinite windows offset when you open the windows but since i can't make the github version to work i can't fix it and its not like i know what i am doing lol i'll have better luck making the whole mod from nothing with chatgpt
@@Gameslinx thanks for the tutorial but can i make a suggestion? slow it down a bit... you went through it at like mach 20 with your hair on fire.. i had a hard time keeping up. lol On a side note: do we not need PartTools anymore? I see you referencing the KSP methods, but you didnt tell us if we needed to add PartTools for it? I assume its because you had it already installed from your previous explosion build if it does need to be used.
Speedy tutorials are better than slow ones - cut to the chase, no bullshit, and it's much nicer to follow. You could play back at 50% speed or pause the video at any point! PartTools is for part modding I'm fairly sure. You use it in Unity when dealing with parts. I have never had to use it before
Yup. Im terrified of 8 hour long python tutorials. Its best when its as straight and fast as possible but also with enough explanations like demonstrated here.
Update: Added timestamps so you can quickly scrub to each relevant part of the video. The video should now be split up into chapters you can easily see. Enjoy!
As someone who knows the basics of coding but not how to set up dependencies with outside programs, this was incredibly helpful.
Johiah plays games I know a bit of java, but that’s it.
1000% agreed! we need more, I'm adding them all to my wiki page for my mod (off forum so it cant "wipe")
An EXCELLENT tutorial! Quick, concise, no unnecessary information, no screwing about. Any other UA-camr would've made this a 20 minute video detailing their goldfishes life story interspersed with little nuggets of actually useful information that are hard to pick out from the garbage. I've no intention of making my own plugins, but I've thoroughly enjoyed this tutorial. Thank you, sir!
Thank you! I feel like some parts may go over a lot of heads for those who don't know how to program, but I decided not to explain everything because it just takes too long
I think too many YTers try to explain how to code instead of what their code is actually doing (the how to code part has to be done by the viewer, the information doesn't need repeating!)
Thanks dude o7
@@Gameslinx I agree with that sentiment. If one doesn't already have the basics of coding down, then this isnt the first video one should be watching. I think you did a masterful job of providing all the relevant information without the over explanation that seems omnipresent in tutorials of this category.
This video is for the people who requested it and hopefully for anyone new who wants to get into plugin / mod development for KSP :)
Note: By no means am I any good at this, lol
@Linx how do I make a orbital decay plugin where the orbit change a certain time
are you kidding?! you're one of the best ones out there! Parallax is amazing
think about how many mods you just enabled the creation of
thank you my man
This could actually be really useful for cinematics for when a ship explodes during reentry or an attack or something
FINALLY A TUTORIAL FOR KSP PLUGINS
Really well done. Very clear, concise and to-the-point. Few things that I want to point out though:
1. It's generally good practice to use the 'sealed' keyword on classes that you know aren't going to be inherited further. Especially in the case of custom attributes, this gives some optimizations besides making your code more secure.
2. The 'Update' method and all other built-in MonoBehaviour messages (such as OnValidate, Awake, Start, LateUpdate and FixedUpdate) are called regardless of accessibility. You can also mark it as private and it'll still work. In fact, you can label built-in message methods as 'protected virtual' or 'protected abstract' if you want to override them later, and it'll all work perfectly.
3. You're currently creating a new instance of System.Random every frame, which will result in persistent memory pollution. In fact, the higher your framerate, the faster your memory will fill up. I recommend removing line 20 at 4:43, and instead, directly inside 'RandomPartExplosion', write:
private static readonly System.Random rnd = new System.Random();
Readonly is safe here because you aren't going to assign a new instance of System.Random. Static is also safe in this case because all instances of this script will use a random number generator with the same seed, so using 'static' means that the generator instance is shared between instances of 'RandomPartExplosion' instead of Unity having to create a new instance of System.Random every time it creates a new RandomPartExplosion instance.
The benefit of using that static keyword is that the System.Random instance is created on game startup, otherwise it is re-created every time you enter the flight scene. It slightly lowers the amount of memory garbage generated by a scene switch whilst also lowering the amount of memory that is to be allocated when entering the flight scene.
4. FlightGlobals might not be ready when Update first runs. So check if it is, and if not, abort the method early because otherwise there is no list of parts to refer to because the vessel isn't ready yet. This saves some NullReferenceExceptions. If you want to be particularly fancy, you can use this initialization to cache your reference to the active vessel, like so:
private Vessel activeVessel = null;
void Update()
{
if (activeVessel == null)
{
if (!FlightGlobals.ready)
return;
activeVessel = FlightGlobals.ActiveVessel;
}
}
Creating this localized pointer also increases performance a bit.
5. (key == true) and (key) are actually not identical. The former also includes a call to the boolean == operator without producing any different results. The latter option is simpler and saves a few CPU instructions. The compiler _might_ catch it, but it's probably best to play it safe.
6. Don't forget to update Properties/AssemblyInfo.cs. KSP defines the 'KSPAssembly' attribute for this file. It makes it easier to detect and catalog KSP mod dll's by the game. Especially when combined with the other attribute, 'KSPAssemblyDependency'. KSPAssemblyDependency refers to the values of KSPAssembly to determine which dll's are dependencies of another dll, and so whether to skip loading a certain dll because its dependencies are missing, or whether to postpone loading a certain dll until its dependencies have been loaded.
7. I need to update KS3P.
Oh damn he actually made it
Sup my dude. New sub, long time software engineer. Had I known it was this simple, I'd be doing this several years ago.
Just wanted to say thanks, you inspired this dev to start modding.
Thanks for making this! As a moderately experienced programmer, all I needed was a way into modding KSP. This plugin itself could even has use on my channel, where I make KSP cinematics. Keep this great content coming, I like your videos.
This was amazingly helpful. I am just wrapping up a c# class, and this might be what will get me into mod making for ksp.
I had no idea it was possible mod ksp using C#, that's awesome man ! I would really love to see more tutorials on other aspects like showing message boxes etc.
@Not A offical gamer I've been using unity for 3+ years and have medicore C# experiece. I just didnt know it was possible to mod the game with C# using premade libraries :)
I've been looking for a good intro to creating KSP plugins and this helped a great deal just to know where to start from and let google take it from there. Thanks a bunch for making this and look forward to seeing what else you put out on the subject!
I would love to see some more videos on this.I always wanted to mod some games and KSP seems to be very accesable
This is a really helpful guide to getting started, thank you so much for sharing!
@Linx MORE PLEASE! lots, your one of the few making videos after the KSP v1.5 unity engine update! I'm @aazard on ksp forums, I make the humanStuff mod, a big part of that is teaching new users to start with head and suit textures and then skyboxes, finishing on making DLL's and such (I used your video to make my 1st DLL to add custom DSS load screens outside of typical user interaction.
YOUR AWESOME, I can make object classes/dll's now!
Underrated channel
Thanks man, great tutorial, concise and precise
Very helpful! Thanks for this.
I dont know anything about coding but i think im gonna come back here when i know how to code
Thank you. This is really informative.
“Your first step is to open visual studio”
*closes tab*
Thank you for this.
You are amazing Jesse_spaceman on Twitch.... it's the conoization Ship that goes to Rhode 😃😃😃😃
Thanks for this
Amazing! Thank you!
Are you gonna make a new planet making tutorial? Just wanna know lol
Can u make a tutoriell with kopernicus...
plz try to make a mod that make any said craft hover in place in atmosphere no matter the height above ground
Please make a video on how to recompile source code of outdated mods.
You gave us too much power...
Unlimited POWER....
(Hmm, how about mod, that every 10s replaces your random part, to random part from part list. Probably impossibile, but lets try)
I've thought about it, I might try it but there could be a whole bunch of problems if the part doesn't actually have nodes to connect to, too big, etc
@@Gameslinx Those don't sound like problems, they sound like extra fun occurrences.
Noice. Shouldnt be TOO hard to learn
Please make a tutorial on making part mods!
Could you do a tutorial how to place objects with a mod on planets i wanted to make a cool mod but cant find any help?
i understood... maybe... the first 1:30? yeah, that sounds about right
I can't open the create new project menu, I can't find it anywhere
I know I'm a bit late and you might not see this, but if you do, do you mind explaining how to add in an animated model and put it in as a part (landing legs and robotics) please?
rly useful lol
"How to make mods in KSP"
"It's complicated. The End"
Does this type of program is needed for planet building?
If so can you do a planet making tutorial?
This doesn't apply to planet modding - You don't need to code for that
@@Gameslinx Wha-
how do I make a plug-in where there is a window with simple controls to change the kerbals camera position to move around in iva mod and also interact with hatches switches toggles etc computers
it worked but can you do a same video but how to make a visual mod, like the EVE or prallax, btw i have subscribed
no respond :(
is there any where to do this on linux?
edit:
i got it to work with monodevelop but when i attempt to run the plugin it lags really bad. could there be any particular reason why?
Could you make a tutorial for part modding?
I don't do part modding, so it's a no from me!
1:50-ish, im trying to make a visual mod, i dont know what to put in "startup."
ik its been 8 months but visual mods usually aren't actual plugins, they're usually just configs for other mods such as Distant Object, Environmental Visual Enhancements, Scatter, Parallax, etc.
Hey bro can you make mod for tweaking engine thrust
is there any documentations?
Libraries? ahhh yes.... enslaved code
is there a documentation with all the methods and classes?
The only documentation I could find is this: forum.kerbalspaceprogram.com/index.php?/topic/161054-official-api-documentation-ksp-191/
@@Gameslinx Thanks.
I dont see class library
im trying to download it but I don't know what to choose for workloads
Do you mean Visual Studio?
If so you need the C#/Visual Basic and maybe the Unity (but I think the dependencies are enougth)
Thonk
Are u a game dev ?
why the needed stuff are outdated HUHHH
This isn't outdated, and still holds up now. Make sure you're using .NET 4.8 if Visual Studio mentions anything else
@@Gameslinx
kinda but its still better than all i found
most other tutorial i find are 11y and 6y old
and you have to use VS 2022
like what addon or workload i have to add ? i didn't know so i checked all box 40gb of stuff
and i did use 4.8 since it refused to use the 4.7.2
but i gave up trying to update that mod from that guy
FullAutoStrut
he has a infinite windows offset when you open the windows
but since i can't make the github version to work i can't fix it
and its not like i know what i am doing lol
i'll have better luck making the whole mod from nothing with chatgpt
oh no he did the if var == tru :/
I hate visual studio...
There should be designed tools to do mods.
Recently I got over 9000 errors while trying to compile Juce.
Thanks! Very fast talking omg lol
I still didnt understand a word you said
At least I wasn't speaking Minecraft enchanting table like some of the other tutorials out there haha
@@Gameslinx thanks for the tutorial but can i make a suggestion? slow it down a bit... you went through it at like mach 20 with your hair on fire.. i had a hard time keeping up. lol
On a side note: do we not need PartTools anymore? I see you referencing the KSP methods, but you didnt tell us if we needed to add PartTools for it? I assume its because you had it already installed from your previous explosion build if it does need to be used.
Speedy tutorials are better than slow ones - cut to the chase, no bullshit, and it's much nicer to follow. You could play back at 50% speed or pause the video at any point!
PartTools is for part modding I'm fairly sure. You use it in Unity when dealing with parts. I have never had to use it before
@@astralnomad Then just pause from time to time.And if the video is so short its not so bad to watch it again
Yup. Im terrified of 8 hour long python tutorials. Its best when its as straight and fast as possible but also with enough explanations like demonstrated here.
I Want To Make A Rocket Part In KSP, Not this useless plugin!
I don't see class library