Part of the problem was described here, and I'm still trying to figure out how docking ports exactly work, even if there are no attachment points involved.
If I undock a vessel and redock it to another vessel to a docking port that just has been created, all in the same function, the vessel does not seem to update its position. Ok, so I store all the information, wait for the next pre-step, and then redock it. Works. But now I'm faced with another problem, but first let me explain what exactly I'm doing:
In IMS, you dock modules together, then "integrate" them one by one. Integration reads the properties of the module from a config file, adds those properties and the module's mesh to the main vessel, copies its docking ports over, and then deletes the module. Of course, any module previously docked to the integrated module now isn't docked anymore (since the vessel it's been docked to has been deleted), but has to be redocked manually, which is very tedious.
Enter the above explained function, the problem, and the fix, so the leftover module gets docked to the copied docking port on the main vessel.
It all works nicely enough, until the situation gets complex. Now modules are left dangling in space for a frame, and some of them autodock with another module that's been left dangling before they can redock to the main vessel. Enter trouble as you haven't known it. Situations can get so convoluted that they seem to be able to crash on saving.
the crash described in my last post... the last line written is always the one before where the dockinfo is supposed to be, so I have good reason to believe that something manages to crash the writing of the dockinfo line. Add to this that it only happens in the most convoluted circumstances where there's even a chance of circular docking, and it seems very likely that the problem has to do with docking ports.
I know, circular docking is supposed to be impossible, but since I do not know when and how the ports exactly update, I could imagine it to lead to trouble if too many docking operations on the same vessel happen in the same function. And the crash also happens when I save with scenario editor in the situation I know would cause a crash in autosave, at the very same position, so something with those ports must be wrong. Something that orbiter survives on runtime, but that crashes it when it tries to save.
EDIT2: Sorry, no circular docking after all. I jumped a module in the chain and noticed it when double- and tripple checking. There's a lot of stuff to check... but I still have to solve the general problem.
Being able to disable autodocking could be a potential solution to this, but there seems to be no possibility to do that. So it would be very helpful to know how and when exactly docking ports update their and their docked vessel's position, so I can maybe maneuver between them updating and autodocking. Or, something else that might solve the problem entirely would be an option to force a docking port to update a docked vessel's position without undocking and redocking it, but for that again I need more knowledge on how these things work.
I know the docking ports were not designed with this kind of abuse in mind. Understanding how they actually work might help me to not abuse them quite as hard... :shifty:
If I undock a vessel and redock it to another vessel to a docking port that just has been created, all in the same function, the vessel does not seem to update its position. Ok, so I store all the information, wait for the next pre-step, and then redock it. Works. But now I'm faced with another problem, but first let me explain what exactly I'm doing:
In IMS, you dock modules together, then "integrate" them one by one. Integration reads the properties of the module from a config file, adds those properties and the module's mesh to the main vessel, copies its docking ports over, and then deletes the module. Of course, any module previously docked to the integrated module now isn't docked anymore (since the vessel it's been docked to has been deleted), but has to be redocked manually, which is very tedious.
Enter the above explained function, the problem, and the fix, so the leftover module gets docked to the copied docking port on the main vessel.
It all works nicely enough, until the situation gets complex. Now modules are left dangling in space for a frame, and some of them autodock with another module that's been left dangling before they can redock to the main vessel. Enter trouble as you haven't known it. Situations can get so convoluted that they seem to be able to crash on saving.
the crash described in my last post... the last line written is always the one before where the dockinfo is supposed to be, so I have good reason to believe that something manages to crash the writing of the dockinfo line. Add to this that it only happens in the most convoluted circumstances where there's even a chance of circular docking, and it seems very likely that the problem has to do with docking ports.
I know, circular docking is supposed to be impossible, but since I do not know when and how the ports exactly update, I could imagine it to lead to trouble if too many docking operations on the same vessel happen in the same function. And the crash also happens when I save with scenario editor in the situation I know would cause a crash in autosave, at the very same position, so something with those ports must be wrong. Something that orbiter survives on runtime, but that crashes it when it tries to save.
EDIT2: Sorry, no circular docking after all. I jumped a module in the chain and noticed it when double- and tripple checking. There's a lot of stuff to check... but I still have to solve the general problem.
Being able to disable autodocking could be a potential solution to this, but there seems to be no possibility to do that. So it would be very helpful to know how and when exactly docking ports update their and their docked vessel's position, so I can maybe maneuver between them updating and autodocking. Or, something else that might solve the problem entirely would be an option to force a docking port to update a docked vessel's position without undocking and redocking it, but for that again I need more knowledge on how these things work.
I know the docking ports were not designed with this kind of abuse in mind. Understanding how they actually work might help me to not abuse them quite as hard... :shifty:
Last edited: