Jump to content

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


whale_2

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.

Spoiler

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 (no longer valid for KAS 1.0 as there are no harpoons at the moment of writing)
  • 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 (NOTE - relevant for old KAS < 1.0, new KAS is yet to be addressed)
  • 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, 1.7.3. However 1.8 has changed quite a lot, so recent builds (0.9.6-0.9.7) are for 1.8.x only

Download from GitHub

Download from SpaceDock

Download from CurseForge

Source code is on GitHub as well.

Changelog

Spoiler

0.9.7

Don't Break the Ground

Added configurable parts and modules excludes list
Fixes for Breaking Ground expansion - ground experiments are excluded from stabilizing
Also fixed Mk1 capsule not recognized as landed when launched from Level 1-2 pads

0.9.6

KSP-1.8.0 compatibility

0.9.5

Coming out of Hangar

This release fixes rare case when you launch a craft from Hangar and it falls through the floor.
The fix work in following way - vessel just launched from Hangar is not being stabilized (so far it appears stable enough so doesn't need any additional babysitting).

0.9.4

Compatibility Release

Built against KSP 1.3.1, 1.5.1, 1.6.1 and 1.7.1 just for the sake of it

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
0.9.7
Link to comment
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!

Link to comment
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.

Link to comment
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
Link to comment
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. 

Link to comment
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...

Link to comment
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

Link to comment
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. 

Link to comment
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

Link to comment
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.

Link to comment
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 

Link to comment
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 :-)

Link to comment
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.

Link to comment
Share on other sites

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