KSPModdingLibs / KSPCommunityFixes

Community patches for bugs in the KSP codebase.
https://github.com/KSPModdingLibs/KSPCommunityFixes/releases/latest
57 stars 19 forks source link

SSPX Centrifuges causing explosions in combination with EPL due to drag cube errors. #119

Closed StormCircuit closed 1 year ago

StormCircuit commented 1 year ago

I am getting drag cube errors from fastloader with the SSPX centrifuges. I tried version 1.24.5 and 1.24.2 but had the same issue in both. It causes kraken explosions when built with Extraplanetary Launchpads but otherwise seems benign. Furthermore it only affects certain centrifuges, almost only the giant ones, specifically the Mercury, Pilgrim, and Cronus. Attached is logs from a session with the minimum to reproduce wherein I fly a vehicle on the launchpad already built and tell it to finalize a vehicle that is literally just two Cronus centrifuges stacked. I tried a bunch of combinations of the order and all exploded.

KSP version: 1.12.5

mods: Harmony B9PartSwitch ExtraplanetaryLaunchpads Kerbaltek (Hyperedit) KSPCommunityFixes NearFutureProps SimpleConstruction SSPX (station parts redux) SSPX IVA ModuleManager 4.2.2

(if you want to test with Simple Construction/Extraplanetary Launchpads I suggest cranking up the productivity rating in the mod's sciencelab MM config file. Setting it to 100 will make things build instantly).

KSP.log

StormCircuit commented 1 year ago

Admittedly I did not check the logs before I uploaded them. In past logs I was seeing the drag cube error but this time it appears they are not there. I am unsure why but I do know this is somehow related to CommunityFixes. It certainly does not occur without it.

gotmachine commented 1 year ago

As a preamble, you can fix this by disabling the PartStartStability KSPCF patch, open the KSPCommunityFixes\Extras\KSPCF_UserSettings.cfg.extra file in a text editor an follow instructions there to do that.

Also, in any case, EPL/SimpleConstruction currently are incompatible with KSPCF due to #98

For reference, exact steps to reproduce :

So, I don't know what the exact root cause is, but this is somehow a triple interaction between B9PS, the PartStartStability patch and EPL. The common factor between all the SSPX parts where this is reproducible is that they produce the following error on flight part load : [ERROR] [Part sspx-expandable-centrifuge-5-1] [ModuleB9PartSwitch 'endcapSwitch2'] Cannot reassign cube weights: had 2 cubes before but now have 4.

Further findings :

So... I'm tempted to say that KSPCF, EPL and SCON are merely victim of an issue whose root cause lies in a SSPX/B9PS interaction. I suspect the root cause is in the ModuleDeployableCentrifuge from SSPX implementing the multiple drag cube interface with discrete drag cubes while B9PS is configured to use procedural drag cubes.

gotmachine commented 1 year ago

So, actually, I was quite close. The issue lies in the SSPX configs missing affectDragCubes = false entries on some B9PS modules. Basically, any part that has a ModuleDeployableCentrifuge or ModuleDeployableHabitat, and also one or more ModuleB9PartSwitch where some transform are switched must define affectDragCubes = false in those B9PS modules. That entry is missing in a few cases.

See https://github.com/post-kerbin-mining-corporation/StationPartsExpansionRedux/pull/315

All this being said, while it's unfortunate that the PartStartStability patch is causing kraken events due to that third-party issue, it shall be noted that the point of this patch is to make the behavior of part initialization deterministic and it's probable that this issue could be reproduced in (rare) circumstances in a stock install when fixed dt per frame is set high enough and when update cycles are dropped in extreme lag situation.

StormCircuit commented 1 year ago

Thanks for the help and the write up! Makes sense. I will see what I can do. It sounds like a simple MM patch to change the dragcube setting on all the centrifuges should about fix it. I will work on that, thanks!