What's new

KSP programming environment best practices

AlexRuger

rewgs
Been getting pretty deep into KSP as of late and I thought it might be nice to share our workflow best practices and tips.

A few of mine to start:

Working with SublimeKSP of course.
Putting functions and macros in a separate file (say, "library.ksp") and importing it to other files as needed.
Each project gets its own GitHub repo. A .gitignore file excludes the samples and other large files like Resources/pictures.
Still manually compiling -> deleting the text in Kontakt -> pasting the result of the compile -> clicking Apply, but would love to find a way to streamline that process.

Anyone else?
 
Still manually compiling -> deleting the text in Kontakt -> pasting the result of the compile -> clicking Apply, but would love to find a way to streamline that process.

Anyone else?
Add this line at the top of your on init
{ #pragma save_compiled_source script.txt }

This will save your script as a text file in the same folder as the ksp file you're working from.
Then in the instrument, load script from location and navigate to that txt file.

Now all you need to do is compile in Sublime, then hit the refresh button in Kontakt to re-read the script.

I keep my ksp files in the 'resources > scripts' folder of the instrument I'm building to keep it all together and make it quicker/easier to create and update the resource container files.
 
Last edited:
KSP files are better found outside of Resources folder, especially if using git for version control. Then your source code is at root level practically, you don't have to done two extra folders just to get to it...
 
Add this line at the top of your on init
{ #pragma save_compiled_source script.txt }

This will save your script as a text file in the same folder as the ksp file you're working from.
Then in the instrument, load script from location and navigate to that txt file.

Now all you need to do is compile in Sublime, then hit the refresh button in Kontakt to re-read the script.

I keep my ksp files in the 'resources > scripts' folder of the instrument I'm building to keep it all together and make it quicker/easier to create and update the resource container files.
Strange. I was working exactly this way (script folder is in the same directory, link the .txt file to Kontakt, etc) minus the #pragma directive. I've tried that line every which way and it simply doesn't work.

The line is the first line in my on init callback. The name of the txt file is correct (changed yours from script.txt to Main.txt, which is what Kontakt is looking for). Compiling doesn't seem to overwrite the Main.txt file I already had there, so I deleted it and compiled again, expected Kontakt to generate it, and...nope, nothing.

Tried maybe putting it before the on init callback, tried clicking Apply instead of the ! at the top right, etc...nope, this line is doing nothing.

What am I missing here?
 
KSP files are better found outside of Resources folder, especially if using git for version control. Then your source code is at root level practically, you don't have to done two extra folders just to get to it...
What's your folder(s) structure(s) look like when working on a new project?
 
No of course! Gotta track the NKI and Resources folder absolutely. Samples folder is ignored, so are some other stuff like ZIP and PSD files etc. All other folders are tracked.
 
Each project gets its own GitHub repo. A .gitignore file excludes the samples and other large files like Resources/pictures.
Hello, sorry for the intrusion. Noob here. What is the GitHub repo and how is it used?
Thank you
 
Top Bottom