whale_2

[1.3.1 - 1.6.x] WorldStabilizer - Bugfix for vessels bouncing on scene load

Recommended Posts

As some reports suggest, 1.5.1 still suffers from it...

The infamous bouncing bug was mostly fixed in 1.4.1, however, in some odd situations it is reported to appear again. If this happens to you, you're welcome to try this mod.

 

But surprisingly, there are reports that 1.4.5 has the bug again: Squad Bugtracker Issue #16159, note #19

 

There's a bug that was seemingly fixed in 1.3 and reintroduced in 1.3.1 - when you enter the scene with some vessels landed they jump up in the air (or in the lack of it).

Bug #16159

If you don't experience it, just ignore this post. However, many, including me, do experience it and it is rather frustrating. It is unclear when and how this would be fixed officially, chances are it will only happen in Release 1.4 and this release in my understanding could potentially break many mods, so 1.3.1 might be around for quite a long time.

The root reason of this seems to be that the game places the vessels slightly beneath the ground and after that physics kicks in and the ground pushes the vessels outwards with significant force. In many cases, especially on low-gravity worlds this could be disastrous.

Usually it looks like this (recording courtesy of Fredrik Wolf)

 

What does the mod do

It intercepts all unpacked (i.e. those affected by physics engine) vessels in the scene right before the physics is about to kick in, determines if they are "submerged" into the ground, raises them slightly above and slowly releases.

Now it looks like this:

(the recording was done with early version, now the vessels are moved upwards even less)

 

Features and caveats:

  • Vessels on launch clamps are not affected
  • Kerbals on EVA are not affected by default (configurable)
  • Vessels in Prelaunch state (i.e. just launched from VAB/SPH) are affected by default (configurable)
  • Vessels that are Splashed, Flying, Orbiting, Escaping, or on Sub-orbital trajectory are not affected  
  • Particular vessels can be excluded from stabilization (see config file)
  • If there is a Hangar with attached anchor, it would be reattached after the hangar settled
  • If the vessel is moored to the surface with KAS harpoon, it should be safe
  • If the vessel contains KAS pylons/concrete blocks in attached state (with staticAttached = true, that have physical connection to the ground), they will be reattached like Hangar anchors
  • You might experience some FPS drop during the stabilization, for instance when you are coming into physics range with some other vessel and it goes off-rails.
    This usually lasts only about 3 seconds and can be reduced further in config file in exchange for less gentle vessel release.  

 

Compatibility and Robustness

This fix has been tested in a bunch of other people's games including mine and so far no issues were reported, but I'm pretty sure something will eventually be blown up - some parts or mods me and all participated in testing don't have weren't tested. Some specific mod may require special treatment. Some particular situations may require special treatment as well. For instance, I'm pretty sure if your base is hanging on a cliff, it would not survive. I just didn't find a cliff in KSP to hang a base on it.

BACK UP YOUR SAVE BEFORE TRYING THIS FIX and please report the issue if bad things happen.

 

Configuration is being done via WorldStabilizer.cfg file inside the mod directory, it should be pretty self-explanatory and there are comments.

The mod comes with MiniAVC version checker - obligatory notice: 

This mod includes version checking using MiniAVC. If you opt-in, it will use the internet to check whether there is a new version available. Data is only read from the internet and no personal information is sent. For a more comprehensive version checking experience, please download the KSP-AVC Plugin.

Licensed under MIT License

Kudos to @BahamutoD, @Papa_Joe and all participants of this thread for code pieces I pried into.

Thanks for all who participated in testing.

 

Latest version for KSP 1.3.1 is 0.8.4, for 1.4.3 - 0.9.2, for 1.5.1 - 0.9.3, currently available on GitHub, SpaceDock, CurseForge and CKAN. As there are reports for 1.4.5, proper recompile is expected soon, but other people report 0.9.2 works just fine. Ping me if you badly want 1.4.5 recompile with fixed AVC version.

Since 0.9.4 I start doing multi-builds, so at least 0.9.4 is available on GitHub for KSP-1.3.1, 1.5.1, 1.6.1 

Download from GitHub

Download from SpaceDock

Download from CurseForge

Source code is on GitHub as well.

Changelog

Spoiler

0.9.4

Compatibility Release

Built against KSP 1.3.1, 1.5.1, 1.6.1

0.9.3

Compatibility Release

Compiled against 1.5.1.


0.9.2

Compatibility Release

Compiled against 1.4.3.


0.9.1

Compatibility Release

Although the bouncing bug was almost fixed in KSP 1.4.x, there are still some odd situations where it happens, according to several reports. This release does not add features or bugfixes, it's just a recompile against 1.4.2 DLLs and correct version for MiniAVC.

0.8.4

Fix for vessels parked under the roof of Astronaut Complex (actually under many other roofs should you have such)  

0.8.3

Previous version introduced hard dependency on specific KAS/KIS version. This versions drops the dependency

Some black magic around moored vessels has a slight chance to work. I.e. vessel, moored by KAS harpoon and winch more often stays moored and intact than not.

0.8.2

Fixed KAS/KIS pylons floating above the ground. Same with Hangars.

Reworked the way I handle vessels, moored by harpoons - should be more stable now.

Moved .version file to where it really works

0.8.1

Fixed ignoring of actual attachment state of KIS/KAS pylon.

0.8.0

Added support for KAS pylons/concrete blocks

0.7.1

Fixed some part meshes being excluded when determining vessel bounds

0.7.0

Debug is disabled by default
Added MiniAVC and .version file
Changed versioning

Pre-release
 0.6

Rewrote whole altitude detection system
Added debug markers for vessel top and bottom points
Added config file
Added vessel exclusions

Pre-release
 0.5

More safeguarding, as for some reason we can't reliably determine altitude 100% of the time
Craft still can explode, use with caution.

Pre-release
 0.4

Excluded meshes without colliders from size calculations, but forced inclusion of wheels. For some 
reasons wheel meshes have no colliders attached to them. Some more safeguarding against going underground.

Pre-release
0.3

More safeguarding

Pre-release
 0.2

Tried to work around mysteriois situation where raycast from bottom point
does not hit the ground, but hits something beneath.
Excluded KerbalEVA from stabilizing.
Tweaked some safety params - 110% up, 90% down.

Pre-release
 0.1

Support for KAS harpoons, Hangar anchors. Raising up by minimum safe height.
Still highly experimental.

NOTE: In previous pre-release, 0.0, I've made a typo - there's directory GameData/WorlStabilizer - without 
letter "d". Make sure you delete this old dir when installing 0.1.

Pre-release
 0.0

alpha version
 

 

Development thread for posterity.

Edited by whale_2
Multi-build

Share this post


Link to post
Share on other sites

Thank you so much for this! Now KSP's darned physics will stop sending my ground vessels flying every time they come out of physicslessness.

Share this post


Link to post
Share on other sites

I haven't experienced the bug much myself but great job anyways!

I know this is an issue for a lot of players right now. I see complaints about it constantly.

Kudos for taking it on!

Edited by Rocket In My Pocket

Share this post


Link to post
Share on other sites

I experience this issue in my career game all the time to the point where I have to turn on unbreakable joints and no crash damage. Looking forward to giving this a try. Thanks for making the fix! :)

Share this post


Link to post
Share on other sites

This would be great! If this works, it would mean that I wouldn't need hundreds of @Angel-125's muncrete pads and miles of pipes to make things stay put! (no offense, @Angel-125!)

Edited by adsii1970

Share this post


Link to post
Share on other sites

I have experienced this bug on Kerbin actually. I had KIS/KAS installed and it caused whole large base to flip, even though it was designed in the way that small MK2 fuel tanks were used for bottom for extra stability.
Thank you for looking into this, I will try it out and report any problems!

Share this post


Link to post
Share on other sites

Been waiting for this for so long....

 

Nope...some parts exploded :( what do you need to debug it? Save, log?

Edited by brusura

Share this post


Link to post
Share on other sites
1 hour ago, brusura said:

Been waiting for this for so long....

 

Nope...some parts exploded :( what do you need to debug it? Save, log?

Yes, could you please turn on debug log in config file, then go blow it up again, post the craft file, the log and maybe some screenshots. I'll look into it this night.

Share this post


Link to post
Share on other sites

Been using this for a couple of days. 

I have to say it’s fantastic. Great job!

Share this post


Link to post
Share on other sites
4 hours ago, whale_2 said:

Yes, could you please turn on debug log in config file, then go blow it up again, post the craft file, the log and maybe some screenshots. I'll look into it this night.

https://drive.google.com/drive/folders/1mVehhOhglv9xA-0Sh779o7LffUWv4rGr?usp=sharing

I can not give you the craft file is a base assembled over time on minmus, in the link there is log, whole savegame and screenshoot ( the smoke you see is a Rockomax brand adapter exploding inside the terrain ) , the same structure do not explode on load without the mod

PS: to load the savegame you need KIS/KAS and OSE workshop 

Edited by brusura

Share this post


Link to post
Share on other sites
Just now, brusura said:

...in the link there is log, whole savegame and screenshoot ( the smoke you see is a Rockomax brand adapter exploding inside the terrain ) , the same structure do not explode on load without the mod

OK, this should work too. 

Share this post


Link to post
Share on other sites
11 hours ago, brusura said:

Nope...some parts exploded :( what do you need to debug it? Save, log?

Am I right, it does explode without WorldStabilizer too? 
First thing I see is solar panels starting to flap like a bird wings...

Share this post


Link to post
Share on other sites
12 hours ago, whale_2 said:

Am I right, it does explode without WorldStabilizer too? 
First thing I see is solar panels starting to flap like a bird wings...

Nope it do not explode without WorldStabilizer

In my game I have also Joint Reinforcemente from Ferram and the solar panels do not flap

Share this post


Link to post
Share on other sites
Just now, brusura said:

Nope it do not explode without WorldStabilizer

In my game I have also Joint Reinforcemente from Ferram and the solar panels do not flap

Well, it definitely does in my setup without the mod. OK, I'll try to add KJR and look deeper. 

Share this post


Link to post
Share on other sites
1 hour ago, whale_2 said:

Well, it definitely does in my setup without the mod. OK, I'll try to add KJR and look deeper. 

Thanks for taking the time, I also remember terrain detail is important, mine in this case was set to default

Share this post


Link to post
Share on other sites
3 hours ago, brusura said:

Thanks for taking the time, I also remember terrain detail is important, mine in this case was set to default

I think I've fixed this. Please try 0.7.1

Hope I didn't add any regression, I've checked for most obvious ones. The reason was in the way I determine which mesh should be used to calculate part bounds. Some parts have their hierarchy crafted differently from others, like it was with stock large adapter in this particular case.

Share this post


Link to post
Share on other sites

so I use a video https://www.twitch.tv/videos/211503705## to demo the bounce  and so then I added the mod . same scene and no bounce

the vehicle didn't break as it has been.

 also I had a rover that used a flex joint that would flip out and roller way up in the air.. it doesn't do that any more with this added

Thanks this does help

Jammer 

Share this post


Link to post
Share on other sites
20 hours ago, whale_2 said:

I think I've fixed this. Please try 0.7.1

Hope I didn't add any regression, I've checked for most obvious ones. The reason was in the way I determine which mesh should be used to calculate part bounds. Some parts have their hierarchy crafted differently from others, like it was with stock large adapter in this particular case.

Confirming no explosion :-)

Share this post


Link to post
Share on other sites

Released 0.8.0 with support for KAS pylons / concrete blocks. I somehow missed the fact that they can form physical connection to the ground. Now if such pylon is found, it is detached before raising the vessel and re-attached when stabilization stops. It works fine on Kerbin with default settings for stabilization ticks but might result in blocks permanently floating above surface if there are too few ticks, minimum downward movement set for something big or if surface gravity is weak. I plan to rework this part.

Share this post


Link to post
Share on other sites

Made a silly error in previous release not honouring actual attachment state of KAS pylons. So here is 0.8.1

Thanks to @IgorZ for spotting this!

Edited by whale_2

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now