Jump to content

Softer docking magnetism


Bobe

Recommended Posts

Is there an add-on that reduces or eliminates the attraction of docking ports? The sudden acceleration can often produce some hazardous motions, especially on stations. Some docking ports aren't even able to link at that speed and they just end up bouncing through each other for a while until a safe relative speed is met.

If I'm approaching a docking port at 0.1 m/s, I want the speed at docking to be no greater than 0.1 m/s. If anything, the magnetism should be reversed such that the relative velocity decreases as relative distance approaches zero.

Link to comment
Share on other sites

Tweakable Everything lets you tweak the magnet strength per part yourself, but I don't think it lets you make it repulsive.

That's perfect, though I would prefer to be able to edit them in flight as well.

For simplicity's sake, is there a way to create a simple plugin that just reduces the magnet force of all docking ports to say 10% of base value? Similarly I wanted to be able to tone down reaction torque by a similar value. I just thought it would be easier to apply a standard reduction across all parts rather than having to micro-manage each part.

Link to comment
Share on other sites

this should do the trick; needs ModuleManager

copy/paste this into a text file and change extension to *.cfg; place in GameData, it should set all parts with ModuleDockingNode to 10% of specified acquireForce and Torque

@PART[*]:HAS[@MODULE[ModuleDockingNode]]:FINAL
{

[INDENT]@MODULE[ModuleDockingNode]
{
[INDENT]%acquireForce = 0.1
%acquireTorque = 0.1[/INDENT]


}[/INDENT]
}

delete the cfg from GameData to unapply or if it doesn't work.

Edited by nli2work
Link to comment
Share on other sites

this should do the trick; needs ModuleManager

copy/paste this into a text file and change extension to *.cfg; place in GameData, it should set all parts with ModuleDockingNode to 10% of specified acquireForce and Torque

@PART[*]:HAS[@MODULE[ModuleDockingNode]:Final
{

[INDENT]@MODULE[ModuleDockingNode]
{
[INDENT]%acquireForce *= 0.1
%acquireTorque *= 0.1[/INDENT]


}[/INDENT]
}

delete the cfg from GameData to unapply or if it doesn't work.

Module Manager detected an error in the file. Does it matter where it's stored within GameData, or is it just a syntax error? Should there be a second closing square bracket in the first line?

Link to comment
Share on other sites

It may be because if there's no definition, then there's nothing to multiply.

You might need to do it separately for parts that have those values and for those that don't

or

Try defining values explicitly with "=" but I don't know what the default is, so you might need to do some trial and error, or install Tweakable Everything, just to see what default it shows.

Link to comment
Share on other sites

try changing the % to @; Final may have to be all Caps. not sure on that one.

TweakableEverything is good too.

*Yep, it was the %, and FINAL. change those and the errors should be gone.

Well there were no errors, but it didn't seem like it worked. I think there was a subtle difference, though that could just be a placebo effect, but the craft still ends up hitting the port at about 0.4 m/s, making it bounce before linking. I tried a few times docking at 0.1 and 0.05 m/s, I even changed the multipliers in the config to 0.01, but the result was consistent.

I'm curious, where do those acquireForce and acquireTorque attributes come from? They don't appear to be in the part configs, are they buried somewhere in the core files?

Link to comment
Share on other sites

The problem is there's nothing there to multiply, as Cpt. Kipard suggested.

Instead of

%acquireForce *= 0.1

use

%acquireForce = 0.1

(and fiddle with the 0.1 until you get an amount you like).

Same for the other one.

They come from the ModuleDockingNode class. Like most modules, it reads its settings from the cfg; anything in the code tagged as [KSPField] will be read from cfg when loading.

If no value is specified in the cfg for a KSPField, the default value will be used when the part loads.

Link to comment
Share on other sites

you can look at the code with Unity's Monodevelop IDE. the stock modules are not well documented, and not all the settings are visible by looking at the configs. This is one way to dig a little further than the config files.

here's the ModuleDockingNode. some of them you see in the part config, some not. generally a public variable in a part module can be manipulated through the part's config settings. But the rub is not all of them are used in the module, if you know C# well you can look deeper and see which ones are and which ones aren't. The other setting you can try adjusting is captureMaxRvel. I'd experiment with just one docking port on the launch pad, use ALT-F12 to turn off gravity. if you find a setting that works, you can use MM to apply it to all docking ports.

nJHzUjZ.jpg

*Edit: I figured using *= would edit the default values; should have realized MM only deals with what's written in the config files.

Edited by nli2work
Link to comment
Share on other sites

Module Manager detected an error in the file. Does it matter where it's stored within GameData, or is it just a syntax error? Should there be a second closing square bracket in the first line?

Shouldn't it be

@PART[*]:HAS[@MODULE[ModuleDockingNode]]:Final

{

@MODULE[ModuleDockingNode] {

%acquireForce *= 0.1

%acquireTorque *= 0.1

}

}

EDIT- Looks like he missed a ] in it.

EDIT- post # 4 right but # 5 wrong

Edited by Mecripp2
Link to comment
Share on other sites

yar... I been editing #4 to correct the MM patch. I was missing a bracket initially.

I think this should actually work

@PART[*]:HAS[@MODULE[ModuleDockingNode]]:FINAL  //applied after everything else
{

[INDENT]@MODULE[ModuleDockingNode]
{
[INDENT]%acquireForce = 0.1 //adds acquireForce if not specified; changes to 0.1 if is specified; stock value is 2 if not specified in part CFG.
%acquireTorque = 0.1 //same as above[/INDENT]


}[/INDENT]
}

I'm still not very good with the voodoo that is MM.

Edited by nli2work
Link to comment
Share on other sites

I think this should actually work

@PART[*]:HAS[@MODULE[ModuleDockingNode]]:FINAL  //applied after everything else
{

[INDENT]@MODULE[ModuleDockingNode]
{
[INDENT]%acquireForce = 0.1 //adds acquireForce if not specified; changes to 0.1 if is specified; stock value is 2 if not specified in part CFG.
%acquireTorque = 0.1 //same as above[/INDENT]


}[/INDENT]
}

.

Seems to work exactly as desired. Thanks.

Link to comment
Share on other sites

What does 2f mean?

I assumed the f defined the value as a floating point number. Maybe the value itself refers to the acceleration, so it's effectively 2.0 m/s2? I'll have to keep an eye on the ship's acceleration next time, though 2 m/s2 seems a bit high.

Link to comment
Share on other sites

What does 2f mean?

Yes, as stated the f just indicates it's a floating point number. My guess for force is 2kN, not sure what units torque uses, but maybe 2kN*m? A set acceleration doesn't fit the empirical experience since lower mass ships seem to be affected by the magnetic force more.

Link to comment
Share on other sites

My guess for force is 2kN, not sure what units torque uses, but maybe 2kN*m? A set acceleration doesn't fit the empirical experience since lower mass ships seem to be affected by the magnetic force more.

If you had a 10 t ship, applying a force of 2000 N would result in an acceleration of 0.2 m/s2, which seems close but slightly less than what I see for a docking of a ship of that mass (roughly ÃŽâ€0.4 m/s). However, if you had a 1 t ship, a 2000 N force would result in an acceleration of 2 m/s2.

To me those numbers don't quite seem to reflect what happens in the game, but I could be mistaken. The magnetism time is usually less than a second and I never see the relative velocity go over 1 m/s.

Link to comment
Share on other sites

  • 1 year later...
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...