mockingbirdnest / Principia

𝑛-Body and Extended Body Gravitation for Kerbal Space Program
MIT License
768 stars 69 forks source link

Keep track of the vessels when they are managed by KSP #2457

Open pleroy opened 4 years ago

pleroy commented 4 years ago

This is a follow-up on #2443, the solution of which is a bit of a hack ("zombies"). We could keep the Vessel objects at all times and observe what KSP does with them.

Growflavor commented 4 years ago

if reasonably possible, I would much appreciate if this is implemented in a way that preserves the fortuitous ability to 'splice prelaunch/landed state' crafts from KSC launchpad/runway to other celestial bodies using Making History DLC determined lat/lon/rotation edits in a Principia save as previously described in these posts at the KSP forum:

--the current 'zombies' appear to not affect craft in a 'prelaunch' state = craft with launch clamps attached. but there is preliminary evidence that 'landed state' craft might experience at least a height addition due to the current 'zombie' implementation (forum link)

--forum link for reference, the description of the fortuitous 'splice' method that makes creating scenarios so much easier (i.e. for education, testing, etc)

Thank you :-)

eggrobin commented 4 years ago

there is preliminary evidence that 'landed state' craft might experience at least a height addition due to the current 'zombie' implementation

No, that is not possible. The zombies do far less than you seem to think.

I am not familiar enough with this type of code to quickly understand what the zombie_prediction_adaptive_step_parameters etc. are actually doing.

As their name indicate, they are the parameters for the adaptive-step integration of the prediction.

In other words, they are the two numbers that you control in the Prediction settings section of the Principia UI. They “do” nothing, they are merely remembered (prediction computation has no other effect, so the persistence of prediction settings does not affect where your vessel goes).

Whatever your issue is, the zombies are innocent.

I would much appreciate if this is implemented in a way that preserves the fortuitous ability to 'splice prelaunch/landed state' crafts from KSC launchpad/runway to other celestial bodies using Making History DLC determined lat/lon/rotation edits in a Principia save

I think this is directly at odds with what we are trying to do in this issue; while a vessel is under Principia’s control (or, once we have implemented this issue, under Principia’s watch), only physically sound things should happen to it.

Having a teleportation to another planet in your history is likely to lead to massive issues when trying to compactly store the history; all our plans for addressing #2400 fundamentally rely on the vessel doing sane things in its history (as an aside, that teleportation also look silly when plotted). Thus, while we might not go out of our way to prevent teleportation while we watch the vessel, we definitely do not want to support it. A vessel that gets teleported to another planet should be ignored and forgotten by Principia while that happens.

The canonical way to make Principia ignore a vessel in-game is to hack gravity (in the cheat menu) while it is active; this can be used to set its orbit using the cheat menu. This is however not persistent, so we have explicit mechanism to support save file editing.

On the other hand, if you are doing save file editing, you have full control of the save file: the identity of the vessel for Principia’s purposes is its pid (A GUID, corresponding to the C# fields ProtoVessel.vesselID, Vessel.id). Replacing that by a GUID you generate yourself will make the vessel appear to be a new one, unknown to Principia, obviating any issues involved with vessels changing while under Principia’s control.

Growflavor commented 4 years ago

Very helpful clarification. Yes: RE:

"A vessel that gets teleported to another planet should be ignored and forgotten by Principia while that happens."

Thank you for clarifying the gravity hack & save editing pid ways to do that.

Key reminder notes to self: ``` > the persistence of prediction settings does not affect where your vessel goes > once we have implemented this issue, under Principia’s watch), only physically sound things should happen to it. ...when trying to compactly store the history > canonical way to make Principia ignore a vessel in-game is to hack gravity (in the cheat menu) while it is active; this can be used to set its orbit using the cheat menu > Replacing that by a GUID you generate yourself will make the vessel appear to be a new one, unknown to Principia, ```