KSP Improvement Suggestions

Options
GDD
GDD Member Posts: 11 Member
edited April 2 in Scripting Workshop

Here is a small list of very useful features that I wish were available in KSP to save some code writing:


● The ability to pass variables to functions like this:

function myFunction($var1, %var2, …)
  declare $myFunctionVar1 := $var1
  declare %myFunctionVar2 := %var2
  …
end function


● The ability to use local scope variables inside functions like this:

function myFunction()
  declare myLocalVar1 := 1
  declare myLocalVar2 := 2
  …
end function


● Support load and save structured data in JSON files (.nkj) with the ability to read content in the structure (parents vs child objects):

declare @myJsonFileContent
  @myJsonFileContent := load('myJsonFile.nkj')
  $knob1Value := @myJsonFileContent['parameters']['knob1Value']

  OR

  $knob1Value := @myJsonFileContent.parameters.knob1Value
  …
end function


● Support for multi dimensional arrays:

declare %presets[10, 8]


Which ones are yours?


NOTE: THIS POST REPLACE THIS ONE WITH BAD CODE FORMATTING. PLEASE DELETE THE POST HERE UNDER:

https://community.native-instruments.com/discussion/28358/ksp-improvement-suggestions

Comments

  • Gablux
    Gablux Member Posts: 81 Member
    Options

    I'm sorry to say but none of these are going to be implemented.

    Passing variables to functions would be really handy, but since it is doable already with manual management of variables, nothing will be done there. You can though have some transpiler help using SublimeKSP for this:

    SublimeKSP also manages local scope variables for you.

    I personally don't like it for some reasons so I also manage this manually.


    The JSON thing is... not completely off the table, but the notation you proposed might be.

    I am not saying these things out of any special knowledge I have from inside NI, but from a number of conversations I had with their people.

  • GDD
    GDD Member Posts: 11 Member
    Options

    Thanks @Gablux for commenting,

    SublimeKSP seems really great at first sight. After looking at the repo and the doc quickly, there are a couple of powerful features that retains my attention right from the start:

    1. Multidimensional Arrays
    2. Structs
    3. Functions with properties
    4. Macros
    5. Import

    As a Visual Studio Code user, I would give it a try for sure if it was available as a VS Extension with automatic compilation run after each update (save) on the code. Meanwhile, I'll keep it in my backlog of things to experiment for sure.

    Thanks again for this great suggestion!

  • Gablux
    Gablux Member Posts: 81 Member
    Options

    Yeah I feel you, I use vs code on other non ksp things

    for Sublime KSP I use sublime and it is fine, works really well. I recommend.

    Staying in vanilla KSP will drive you crazy

  • GDD
    GDD Member Posts: 11 Member
    Options

    Yeah I admit I need to produce a good bunch of code for simple things and I also need to be careful with variable names to avoid collisions between function calls, especially when they're using the same global variable for looping with while loops, for instance.

    Apart that, it's not that bad since I started working with KSP 1 month ago only and now that I got the big picture I started to built my first instrument which, in short, contains 6 layers (user's sample), each with it's own loops, arpeggiator and settings such as ADSR and FILTERS, Compressor, etc. So far, so good. The CPU is still around 5% when playing a chord of ten notes on the six layers all together.

    Right now, I'm trying to add a granular synth for each layer. I admit, it's a bit challenging but I'm almost done with it. Now I need to handle the envelope release because the Kontakt envelope handler doesn't follow the current playing direction (forward/reverse). It's sad by the way that KSP doesn't provide any parameter to change the reverse parameter on the source. That would have saved me a good bunch of code.

    I'm going to try SublimeKSP once I've finished my own experimentation with KSP.

    Kontakt is an awesome engine by the way. Handling all these samples, notes and parameters live with such a low footprint on the CPU, it's impressive.

    See You!

  • Gablux
    Gablux Member Posts: 81 Member
    Options

    it is the power of C/C++

  • GDD
    GDD Member Posts: 11 Member
    Options

    C++ is the best choice for this kind of app. It is very close to the hardware and provide a great framework with classes and objects. A long time ago I built an internet browser for Windows using MFC.

Back To Top