Jump to content

[WIP] TweakScale - Development Thread


pellinor

Recommended Posts

I would highly recommend to add 1.875m as default scaleFactor that lies between 1.25m and 2.5m This size time is very usefull when 2.5m is too laarge and 1.25 is too small. There are also several mods that have created parts specificly for this scale. So please add it to the default!

mods that offer 1.875 parts:

[WIP] Socke's Parts - 1.875m Extension

[.25]HGR Command Pods and 1.875m parts(v1.1 Oct 20)

Universal Storage

Edited by FreeThinker
Link to comment
Share on other sites

I would highly recommend to add 1.875m as default scaleFactor that lies between 1.25m and 2.5m

I'm not sure which default you are talking about. The default stack scaletype of the pre-release is set to freescale=true. With its incrementSmall=0.625m setting, the 1.875m scale already is a valid defaultScale for a part. And it is literally one click away from the 1.25m and 2.5m scales.

Edited by pellinor
Link to comment
Share on other sites

1.51 I tried the 1.51 release for a few min. While it would let me decrease the size of the parts I tested, mainly reaction wheels, it would not let me increase the size. I am using RO and a total of 53 mods but with 1.50 it does let me increase the size. Hope this helps, really want 4m reaction wheels with proper force.

Link to comment
Share on other sites

Just fixed the bug AccidentalDisassembly found. It was a typo and showed how easy it is to forget testing those features you don't use yourself.

1.51 I tried the 1.51 release for a few min. While it would let me decrease the size of the parts I tested, mainly reaction wheels, it would not let me increase the size. I am using RO and a total of 53 mods but with 1.50 it does let me increase the size. Hope this helps, really want 4m reaction wheels with proper force.

I took a quick look into realism overhaul and its TweakScale config is a mess of incomplete scaletypes with comments that things no longer work. So there is definitely work to do on that one. For your reaction wheels, a quick MM patch could be

@SCALETYPE[RealismOverhaulStackSolid]:FINAL
{
minScale=0.3
maxScale=10
}

The types I found do not define min and max sizes, so they get some replacement values. In the new version those are defaultScale*4 and defaultScale/2. So for your case the maxScale should be 5m, but maybe the bug I just fixed also influenced this.

PS: this is just a guess, based on very few info.

Edited by pellinor
Link to comment
Share on other sites

I see something in the release note I am interested in.

Something about autoscaling turned off.

I don't know how to fire that feature.

I am using 1.50 right now. Should I download the 1.51 ?

Thank you in advance

Also just a quick note you really should adding KPS AVC support for this.

Link to comment
Share on other sites

I have a problem with this line from ScaleType.cs:

            MaxValue      = Tools.ConfigValue(config, "maxScale",     source.MaxValue);

This is supposed to return the last parameter in case of a problem. It works like this, however when I change the last param to something explicit like 3f, I seem to always get this 3f back (as a result, it overrides the maxScale of all scaletypes).

Anyone with C# has an idea on this? The method is from Tools.cs:


public static T ConfigValue<T>(ConfigNode config, string name, T defaultValue)
{
if (!config.HasValue(name))
{
return defaultValue;
}
string cfgValue = config.GetValue(name);
try
{
var result = ConvertEx.ChangeType<T>(cfgValue);
return result;
}
catch (Exception ex)
{
if (ex is InvalidCastException || ex is FormatException || ex is OverflowException || ex is ArgumentNullException)
{
LogWf("Failed to convert string value \"{0}\" to type {1}", cfgValue, typeof(T).Name);
return defaultValue;
}
throw;
}
}

That's funky. Have you checked the logs? If for whatever reason it's not happy with the type and input it should output 'Failed to convert string value...'.

I'm at work now, so I can't just test the code. My debugging routine has consisted of a ridiculous amount of Logf statements, usually one per line of actual code, to identify exactly which line fails. From there it's just a matter of figuring out why it's that specific line. I see absolutely no good reason for 3f to give different results from source.MaxValue, though - only if the types were different should that happen. I'll see if I can poke at the code later today.

Link to comment
Share on other sites

My custom parts, and most downloaded custom parts will break the game with TweakScale.

When you go to attach a part, suddenly it will break it's attachment nodes (none will be visable, part will be unattachable) if you let go of the part, it acts as though it's attached and moved the whole craft around. You cannot delete the part. you cannot save. You cannot launch. The only method of fixing is force-closing the game.

Should you not apply default scaling to 'unknown' parts like the original scaler? There is no way in hell you should expect people to edit hundreds of parts. In older versions of KSP with scaling, all parts, even custom, worked without any alteration. What happened to those days?

Edited by WAS
Link to comment
Share on other sites

My custom parts, and most downloaded custom parts will break the game with TweakScale.

When you go to attach a part, suddenly it will break it's attachment nodes (none will be visable, part will be unattachable) if you let go of the part, it acts as though it's attached and moved the whole craft around. You cannot delete the part. you cannot save. You cannot launch. The only method of fixing is force-closing the game.

Should you not apply default scaling to 'unknown' parts like the original scaler? There is no way in hell you should expect people to edit hundreds of parts. In older versions of KSP with scaling, all parts, even custom, worked without any alteration. What happened to those days?

That's exactly the same issue i had and posted about here http://forum.kerbalspaceprogram.com/threads/110899-WIP-TweakScale-Freescale-Everything?p=1753264&viewfull=1#post1753264

Link to comment
Share on other sites

My custom parts, and most downloaded custom parts will break the game with TweakScale.

When you go to attach a part, suddenly it will break it's attachment nodes (none will be visable, part will be unattachable) if you let go of the part, it acts as though it's attached and moved the whole craft around. You cannot delete the part. you cannot save. You cannot launch. The only method of fixing is force-closing the game.

Should you not apply default scaling to 'unknown' parts like the original scaler? There is no way in hell you should expect people to edit hundreds of parts. In older versions of KSP with scaling, all parts, even custom, worked without any alteration. What happened to those days?

To be fair in "those days" things were simpler but also a lot less awesome.

If you don't mind could you provide a link to the config of the part with the problem and the log when the problem occurs?

Link to comment
Share on other sites

There is no way in hell you should expect people to edit hundreds of parts.

I don't. Show me a replicable bug, otherwise I can't help you. Are you using a custom scaletype?

That's exactly the same issue i had and posted about here

Was this a 1.50 install or one of my dev versions? So far I've only seen (and fixed) this kind of exception spam in the flight scene.

Edited by pellinor
Link to comment
Share on other sites

Something about autoscaling turned off.

I don't know how to fire that feature.

I am using 1.50 right now. Should I download the 1.51 ?

Also just a quick note you really should adding KPS AVC support for this.

The hotkeys for auto- and chain scaling are leftCtrl-L and leftCtrl-K.

Added an avc version file. The latest version identifies itself as 1.50.1. I will switch to 1.51 when i set a github release label and upload to kerbalstuff and curse. Just signed up there and now waiting for Biotronic to add me to the projects.

Link to comment
Share on other sites

I solved the problem myself by editing the config file. After that, I didn't saw the point of my post since my problem was solved

This was missing stuff I wasn't aware of. By all means tell me if there are any issues not mentioned in the OP. I can't find out everything on my own.

EDIT: fixed in latest github commit.

Edited by pellinor
Link to comment
Share on other sites

The hotkeys for auto- and chain scaling are leftCtrl-L and leftCtrl-K.

Added an avc version file. The latest version identifies itself as 1.50.1. I will switch to 1.51 when i set a github release label and upload to kerbalstuff and curse. Just signed up there and now waiting for Biotronic to add me to the projects.

Thank you very much.

I'll try it right away.

Link to comment
Share on other sites

Thanks for replying. I tried the latest version on github with the discrete scaletype fix and it worked allowing me to both increase and decrease the size of parts. Now I have another issue although not sure if its on your end though since it only occurs with TweakableEverything. When it is installed the force on reaction wheels goes negative when you change their size. After resizing nothing aside from deleting the part and replacing it will let it apply any force, despite what the tweakable shows. When I try to edit the force it goes from goes to 6E+12 and others. For now I'll probably just play without TweakableEverything though.

Link to comment
Share on other sites

Thanks for replying. I tried the latest version on github with the discrete scaletype fix and it worked allowing me to both increase and decrease the size of parts. Now I have another issue although not sure if its on your end though since it only occurs with TweakableEverything. When it is installed the force on reaction wheels goes negative when you change their size. After resizing nothing aside from deleting the part and replacing it will let it apply any force, despite what the tweakable shows. When I try to edit the force it goes from goes to 6E+12 and others. For now I'll probably just play without TweakableEverything though.

I don't know what happens if you use tweakScale and TweakableEverything on the same part/module. I would expect bad things if apply it to a TweakScaled variable. You could try telling tweakScale to ignore the value you want tweakableEverything to control. I found the following in the OP of the old thread (but haven't tried anything like that myself yet).

Thanks to NathanKell, 1.44 added support for not doing scaling when a specific module is added to a part. This is useful when TweakScale can do some updates on its own, but should keep its hands off when another module can do better.

TWEAKSCALEEXPONENTS
{
name = MyModule
socksPerMinute = 2
ignore = SockManager
}

This code will scale socksPerMinute by the square of the scale, or if there's a SockManager partmodule on the part, leave it all alone and let the SockManager do its thing.

Link to comment
Share on other sites

I don't know what happens if you use tweakScale and TweakableEverything on the same part/module. I would expect bad things if apply it to a TweakScaled variable. You could try telling tweakScale to ignore the value you want tweakableEverything to control. I found the following in the OP of the old thread (but haven't tried anything like that myself yet).

There was a time when TweakableEverything and TweakScale were mostly in sync and you could very much fiddle with both the scale and the tweakable strength of a reaction wheel, just as an example. I don't think they're particularly "in sync" at the moment, but it's possible (and didn't involve the ignore = stuff, so far as I know). The reaction wheel, when tweaked, would give new min and max values (as it should) to TweakableEverything (or something).

Link to comment
Share on other sites

I finally put the v1.51 label on the current state of the mod, and started a dev branch on github. The master branch will be seen by KSP-AVC, and updated whenever a stable state is reached. The dev branch will contain the latest changes, and might contain bees. I'll open a new thread in addon releases soon. Not sure yet I we shall keep this thread for development plans and modding discussion.

- - - Updated - - -

There was a time when TweakableEverything and TweakScale were mostly in sync

I have no idea yet about the parts of the code that do the actual scaling of values. So this is something I (or someone else) should look into, but it probably won't happen soon.

Link to comment
Share on other sites

Something funny going on in 1.51. What happened:

1. In SPH, makin' a spaceplane.

2. Tried to attach a particular part (a repurposed part from some radom mod I have converted into a USI/Regolith resource converter smelter). They do have TweakScale modules in them, written correctly.

3. When attempting to attach it to the nose of the plane - because why not? - attach nodes disappear from the part, part shades red (like unattached parts do), then the node on the smelter that "attempted" to attach to the plane disappears. The part's other stack node remains visible.

4. Discarding the part stops the logspam.

5. If you don't immediately discard the part and click on something else instead, like the spaceplane, in this case, you'll pick up both the spaceplane AND the smelter part, which is now hanging in mid-air wherever your cursor left it, and you can't set any of it back down in the editor - have to discard the lot.

6. Error did not happen with 1.50, at least.

7. Other parts with the REgolith resource converter module do not exhibit this behavior... there goes that theory.

Log: https://dl.dropboxusercontent.com/u/59567837/output_logTweakScaleFeb252015.txt

Here is the part's config:


//Original model and texturing done by zzz


PART {


name = CompactSmelter375
module = Part
author = AccidentalDisassembly


mesh = bigtank.mu
rescaleFactor = 1.5


node_stack_top = 0.0, 0.7231, 0.0, 0.0, 1.0, 0.0, 2
node_stack_bottom = 0.0, -0.315, 0.0, 0.0, 1.0, 0.0, 2


TechRequired = spaceExploration
entryCost = 12500
cost = 16800
category = Utility
subcategory = 0
title = Compact Smelter - 3.75m
manufacturer = DAA Aerospace
description = A flatter, more compact smelter with slightly lower efficiency.


attachRules = 1,0,1,1,0


mass = 24
dragModelType = default
maximum_drag = 0.2
minimum_drag = 0.2
angularDrag = 2
crashTolerance = 12
maxTemp = 2900
breakingForce = 150
breakingTorque = 150
fuelCrossFeed = True




MODULE
{
name = ModuleAnimateGeneric
animationName = e10
startEventGUIName = Navigation Lights
endEventGUIName = Navigation Lights
}


MODULE
{
ConverterName = Smelt Ore
name = REGO_ModuleResourceConverter
StartActionName = Start Ore->Metal
StopActionName = Stop Ore->Metal
RecipeInputs = ElectricCharge,15.0,Ore,0.12
RecipeOutputs = Metal,0.09,False
}
MODULE
{
ConverterName = Reprocess Scrap Metal
name = REGO_ModuleResourceConverter
StartActionName = Start ScrapMetal->Metal
StopActionName = Stop ScrapMetal->Metal
RecipeInputs = ElectricCharge,7.5,ScrapMetal,0.1
RecipeOutputs = Metal,0.008,False
}


RESOURCE
{
name = Metal
amount = 0
maxAmount = 600
}


RESOURCE
{
name = Ore
amount = 0
maxAmount = 800
}


RESOURCE
{
name = ScrapMetal
amount = 0
maxAmount = 250
}


MODULE
{
name = TweakScale
type = stack
defaultScale = 3.75
}


}

Edited by AccidentalDisassembly
Link to comment
Share on other sites

I don't. Show me a replicable bug, otherwise I can't help you. Are you using a custom scaletype?

Was this a 1.50 install or one of my dev versions? So far I've only seen (and fixed) this kind of exception spam in the flight scene.

It happens with both 1.50 and the latest dev versions, unfortunately. ;.;

Link to comment
Share on other sites

I had a similar problem before with another set of parts, to find the cause you'll have to do much reloading and addon disabling.

http://forum.kerbalspaceprogram.com/threads/100026-Infernal-Robotics-REWORK-extendatrons-problem

Tweakable everything sounds like a reasonable culprit for me too, gonna go try removing/modifying that to see what happens!

Link to comment
Share on other sites

That's exactly the same issue i had and posted about here

I have a suspicion that those hotkey objects conflict with something in other mods (like in the regolith/kas bug). The Latest dev version 1.51.1 properly checks them for nullrefs before use.

Please test if this fixes the bug (as I could not reproduce it).

Edited by pellinor
Link to comment
Share on other sites

I currently don't use Tweakscale, as I am in the middle of an almost all stock save. Only info mods allowed, and Proc fairings, but that's besides the point. I am finishing up a mod i made months ago in prep to release it tonight. I originally did not include Tweakscale support, but it is a part that should really have it. So am I correct in understanding that i need only add the tweak scale module, with proper variables, and if the user does have tweak scale installed, it will be called, and if they don't the game should just ignore the module?

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...