Page 1 of 8 123 ... LastLast
Results 1 to 10 of 79

Thread: [0.24] Tweakable Parameters ( V4 Released 17 March 2014 )

  1. #1

    Lightbulb [0.24] Tweakable Parameters ( V4 Released 17 March 2014 )

    I'm happy to share this newly-written plugin with you.
    This plugin will allow you to tweak parameters you want of parts in Editor mode and these tweaks will be saved into the .craft file, which means you can have different settings in different crafts and no need to copy&paste part folders just because you want to tweak some parameters of them.

    Tips for V4:
    1. You should download Sarbian's Module Manager plugin. This plugin provides the capability to add certain part module into all parts. Once you installed that plugin correctly, all parts in your game will have tweakable parameter capability.
    2. You can now pick parts in ActionGroup mode and press "P" key, too.
    3. FloatCurveEditor allows you to adjust engine Isp curves, solar panel power output curves, etc. in editor mode.

    Download Links:

    Source code is on Git: https://github.com/HoneyFox/TweakableParam/

    New Version (v4) released!
    screenshot:


    Usage:
    See README.txt in package for details.

    Normally you don't need to read the following guide.

    Brief process of manually adding tweakable parameters:
    1. Edit part.cfg of parts you want to add tweakable-parameter capability.
    2. Add ModuleTweakableParam modules into the part.cfg. For each parameter you want to tweak, one module is needed.
    2. Now we have two ways to add tweakable capability:
    1) Old fashion, still compatible.

    Examples:

    1> This will allow you to adjust RCS thrust power in Editor mode, so you can easily drive heavy ships without the need to install more RCS pods.
    Code:
    MODULE
    {
    	name = ModuleTweakableParam
    	targetField = Module(ModuleRCS).thrusterPower
    	setOnlyOnLaunchPad = false
    	minValue = 0.1
    	maxValue = 5.0
    	stepValue = 0.1
    }
    2> This will allow you to adjust fuel amount of a fuel tank. You can then set up whether you need an empty tank or a full tank or even a half-fueled tank.
    Note that the setOnlyOnLaunchPad = true, this avoid refuel cheat when you resume the flight.
    Actually for resources it's better to force setting the switch on, but finally I leave that to you to decide

    (The following data are for a Rockomax Jumbo-64 Fuel Tank)
    Code:
    MODULE
    {
    	name = ModuleTweakableParam
    	targetField = Resource(LiquidFuel).amount
    	minValue = 0
    	maxValue = 2880
    	stepValue = 90
    	setOnlyOnLaunchPad = true
    }
    
    MODULE
    {
    	name = ModuleTweakableParam
    	targetField = Resource(Oxidizer).amount
    	minValue = 0
    	maxValue = 3520
    	stepValue = 110
    	setOnlyOnLaunchPad = true
    }

    2) New multi-set support.
    This feature allow you to pick parameters in runtime instead of in part.cfg editing.
    What you only need to add is:
    Code:
    MODULE
    {
    	name = ModuleTweakableParam
    	useMultipleParameterLogic = true
    }
    You can still assign parameters manually.
    Example:
    Code:
    tweakableParamModulesData = <Module(ModuleRCS).thrusterPower,,0.0,5.0,0.1,0>,<Resource(MonoPropellant).amount,,0.0,100.0,10.0,1>,<mass,,2.0,4.0,0.1,0>,
    The format is: for each parameter, you need a <...>, separated by commas. Inside <...>, the values are in this order: targetField, tweakedValue, minValue, maxValue, stepValue, setOnlyOnLaunchPad. Note that the tweakedValue field is blanked, this means you will leave it to the game, and the game will fill it with the part's original value for it.

    3. Launch the game and get into the VAB/SPH, and pick up the parts you have added the module.
    For the part that has enabled the new multiple parameter logic:
    4. Select the part by left clicking it, then press P key to bring up the Select Parameter window.
    5. Select the parameter you want to add tweakable capability, remember to enter the values before you click the Add button. The toggle on the left side of the Add button is for "setOnlyOnLaunchPad" option.
    6. You can now tweak the values in the GUI popped up.
    7. Save the craft and all these tweaks will be saved also.
    Last edited by HoneyFox; 20th July 2014 at 02:44. Reason: Tested in 0.24

  2. #2
    Sr. Spacecraft Engineer
    Join Date
    Sep 2012
    Location
    The VAB
    Posts
    433
    One thing for this, you may want to supply any parts that need to be edited in the download as it may be confusing for people and/or put them off of the mod, however the initial idea looks promising

  3. #3
    Mad (social) scientist Mihara's Avatar
    Join Date
    Apr 2013
    Location
    Moscow, Russia
    Posts
    1,454
    Ooh, finally a clean solution to the launch-empty-fuel-tank problem. Much thanks.

  4. #4
    What a fantastic, clean, elegant idea. Just what I've been wanting, and I kept making unnecessary duplicate parts.

  5. #5
    Rocket Scientist Blinkin's Avatar
    Join Date
    Aug 2011
    Location
    The Netherlands (EU)
    Posts
    858
    Great and smooth implementation. Thanks!

  6. #6
    Mad (social) scientist Mihara's Avatar
    Join Date
    Apr 2013
    Location
    Moscow, Russia
    Posts
    1,454
    A suggestion. It has been noted above that you might want to include parts that are likely to be tweaked. While your plugin obviously has much wider applications, adjustable fuel tanks are what most people will want it for first, but with the wide variety of stock and non-stock tanks people use or generate with Part Generator, this might not be feasible. I have a better idea:

    A companion application, 'tweak installer', that will parse config files, search for cases where a tweak may reasonably be applied -- i.e. resource amounts, or the thrust value on RCS, whichever else you or anyone else can think of, and patch the config files if not patched already, letting the user select which parts to patch and which tweaks to apply to each.

    I'd make one, but mine would be a console Python script, not very suitable for wide distribution.

  7. #7
    Quote Originally Posted by Mihara View Post
    A suggestion. It has been noted above that you might want to include parts that are likely to be tweaked. While your plugin obviously has much wider applications, adjustable fuel tanks are what most people will want it for first, but with the wide variety of stock and non-stock tanks people use or generate with Part Generator, this might not be feasible. I have a better idea:

    A companion application, 'tweak installer', that will parse config files, search for cases where a tweak may reasonably be applied -- i.e. resource amounts, or the thrust value on RCS, whichever else you or anyone else can think of, and patch the config files if not patched already, letting the user select which parts to patch and which tweaks to apply to each.

    I'd make one, but mine would be a console Python script, not very suitable for wide distribution.
    Yeah, I had similar thought these days because it's quite tiring to add lots of tweak modules into all these stock/non-stock parts.

    The application should be like this:
    [DREAM]
    The user needs to choose the part.cfg first.

    Use .NET Reflection again to obtain all public numeric properties of the part & its part modules. so that users can choose which property they want to tweak. (I'm not responsible for any result of trying to tweak something that should only be changed in game logic)
    A small disadvantage of this is that, for part / part modules written by other modders, it's not easy to acquire their plugin dll files to obtain their classes and properties of them. (Maybe a scan inside KSP/Plugins folder and dynamically load these assemblies? I'm not familiar with that :-| )

    For resources, the program will first parse all resources available in the part.cfg file and list them out on the GUI, then a single click to insert a tweak module for the selected resource into the part.cfg. For convenience, an additional button can be provided to add modules for all resources found in the part.

    All tweak modules that will be applied onto the part.cfg will be listed and users can delete some of them.

    And finally a button "Apply tweak modules" so that all these tweak modules will be finally written into the part.cfg.
    [/DREAM]

    Well, it's just a primitive thought on the tool. I don't know when will I start writing this tool though.



    Edit:

    I got another thought, an in-game version will be good. it could acquire all other plugins' class members...
    If I can acquire the part that the user has selected in the editor mode, and with a small GUI for user to pick the properties of that part (& of its part modules), then save the tweaks into a file inside KSP/PluginData/ folder, I can then write another small tool to read that file in KSP/PluginData/ folder and apply all the changes onto actual part.cfg files...

    Hmm... that also sounds complex... anyway...
    Last edited by HoneyFox; 7th May 2013 at 06:22.

  8. #8
    Mad (social) scientist Mihara's Avatar
    Join Date
    Apr 2013
    Location
    Moscow, Russia
    Posts
    1,454
    That sounds like way overkill.

    1. Ask user for the install folder of KSP.
    2. Present a database of of applicable tweaks with checkboxes whether to apply each. Each database entry provides it's own regular expressions for figuring out whether a tweak is applicable to a part, and what regular expression to apply to the file to change it.
    3. Go grab them part files. Go through each part file in order, going through the list of enabled tweaks in order.
    4. If the tweak is enabled, and applicable and the file is not marked (by a comment line in the beginning) that it has been patched, patch it.


    The moment anyone releases a sufficiently popular mod that makes a certain tweak desirable, add it's respective regular expressions into the database and release a new version. There's no call to really be universal, and certainly no need to go deep into .NET.

  9. #9
    Quote Originally Posted by Mihara View Post
    That sounds like way overkill.

    1. Ask user for the install folder of KSP.
    2. Present a database of of applicable tweaks with checkboxes whether to apply each. Each database entry provides it's own regular expressions for figuring out whether a tweak is applicable to a part, and what regular expression to apply to the file to change it.
    3. Go grab them part files. Go through each part file in order, going through the list of enabled tweaks in order.
    4. If the tweak is enabled, and applicable and the file is not marked (by a comment line in the beginning) that it has been patched, patch it.


    The moment anyone releases a sufficiently popular mod that makes a certain tweak desirable, add it's respective regular expressions into the database and release a new version. There's no call to really be universal, and certainly no need to go deep into .NET.
    XD Yeah, my ideas are kind of over kill.
    Using a database to save useful properties of parts and all kinds of part modules (including popular 3rd-party ones) seems good, but... how to sync that when something changes.

    Only thing I'm wondering is how to populate the database? By releasing new version seems quite... weird.
    Your idea really sounds like a community project instead of a personal one...

  10. #10
    Mad (social) scientist Mihara's Avatar
    Join Date
    Apr 2013
    Location
    Moscow, Russia
    Posts
    1,454
    Make it download that "database" (for lack of a better word, with me it would just be a text file, no need for anything more complex than that, since it's to store pairs of regular expressions) off a public location (even Dropbox will do, but Github is all the vogue these days and your project is on Github already) with each start if you don't want to release updates.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •