• 0
inigma

Possible to Save Ship from Persistence File?

Question

I totally hit delete on my save game, without realizing it also deleted hours worth of craft files, development versions, and my backup craft files! All I have remaining is a persistent game file I somehow manage to save prior to the whole incident. It has the latest version of the space shuttle I worked so hard on, sitting on the pad ready for launch. Pristine condition. I just can't figure out a way to save it to a craft file.

Is there any chance or way whatsoever to save that ship as a craft file again? I am desperate.

UPDATE 1/13/2015 - THIS HAS BEEN ANSWERED AND THE ENDING IS HAPPY!

Starwhip was working on a converter in Python but it looks like Claw beat him to it in C#. :D

InflightShipSave

https://github.com/ClawKSP/InflightShipSave/releases

put this dll in your GameData folder, load KSP, load your active vessel in flight, and hit F6 to save it as a file named the craft name with _rescued appended at the end of it in your save game VAB folder.

Beautiful. Simply beautiful.

Space Shuttle Intrepid (version 22) was rescued from its persistence.sfs file (formerly a quicksave file I luckily didn't delete) and made into a .craft file! Thanks Claw! Hours of work (on those wings) rescued for sure. I hope Google has helped you find this post in joy. If so, reply!

bGnyxb1.png

Edited by inigma

Share this post


Link to post
Share on other sites

Recommended Posts

  • 0
Claw, I asked this in the mod request thread, but I don't think you saw it so I'll ask it again here. Do you mind if I take a look at your source and repurpose it for use in Kerbal Construction Time?

No, sorry. I did not see that request. And my add-ons fall under this license: https://creativecommons.org/licenses/by-nc-sa/4.0/ Which basically says you can copy/use/modify/build on it so long as you give some credit, is for non-commercial use, and that you follow similar sharing rules.

And I appreciate you asking. :D Feel free to take what you need. I will be working on it more today actually, so possibly some updates to follow soon-ish.

Cheers,

~Claw

Edited by Claw

Share this post


Link to post
Share on other sites
  • 0

Updated my utility. One thing left to fix: handling ships that have docked in flight.

Cheers,

~Claw

Share this post


Link to post
Share on other sites
  • 0
Updated my utility. One thing left to fix: handling ships that have docked in flight.

Strictly speaking, you don't need to bother with that; just recover the entire ship and let the user split it manually; yay for the re-root tool :D.

Of course, it would be convenient if you could do it automatically, and successfully.

Share this post


Link to post
Share on other sites
  • 0

Well, the main issue there is that docked nodes in flight are handled differently to normal editor node connections. Plus there's a possibility that multi-docked ports or dockings that result in loop constructions could cause issues.

Share this post


Link to post
Share on other sites
  • 0
Strictly speaking, you don't need to bother with that...

It's not a root problem but an internal book keeping problem. The tree structure of KSP is an expectation of all of the things that interact with a given ship. The problem with docking ports is that they create a small rift in how the ship is stored, because the linkages are created in a slightly different way when docked than when you have two things physically stuck together. That's good news because accidentally creating circular loops shouldn't be a problem, but that also means I have to do a few other things to get the ports hooked together in a way that the editor can handle.

The other good news is that even if I didn't fix the way it handles docking ports, you can still rescue a ship that has docking ports and open it in the editor without it crashing KSP. It would just require the user to manually edit the .craft file to manually restore some missing links. Also, as an added side benefit, it will likely lead in to me working on a fix for the "can't dock / undock" bug that's been around for a while. But that's starting to get way off topic. :P

I also built some "factory restore" code that will put the ship back into a fully reset state (as requested). I haven't turned it on yet though because it will be destructive to a wide variety of mods. So I'm waiting until if/when I get around to making a GUI so that I can have that as a toggle option.

Cheers,

~Claw

Share this post


Link to post
Share on other sites
  • 0

For the defaults module settings, would opening the appropriate .cfg file be an option. Run the code so when it gets to a module tag in a part open the corresponding .cfg file and get the default values, over write the lines in the sfs/craft file, and keep on going?

That's how I would do it. At a quick glance this is just going through every line of the file correct? Easy enough to save the partname as a temp variable and if module is encountered open the cfg file get that info and write it. While I've not done python or c, I have done this exact thing in VB and php.

Share this post


Link to post
Share on other sites
  • 0
It's not a root problem but an internal book keeping problem. The tree structure of KSP is an expectation of all of the things that interact with a given ship. The problem with docking ports is that they create a small rift in how the ship is stored, because the linkages are created in a slightly different way when docked than when you have two things physically stuck together.

Ah, okay. Hmm... multi-docked ships seem like they would be quite a bit harder to deal with unless the "first" docking node is treated specially somehow; how do you identify which link should be kept, and which should be removed? Or for that matter, identify multi-docking in general? It's not really enough to just go one/two level/s up/down the tree from the docking port and examine the parts given some of the crazy contraptions people have built :(.

Share this post


Link to post
Share on other sites
  • 0
For the defaults module settings, would opening the appropriate .cfg file be an option. Run the code so when it gets to a module tag in a part open the corresponding .cfg file and get the default values, over write the lines in the sfs/craft file, and keep on going?

Well, you could approach the problem in a multitude of ways to reset the parts. For the current setup, the add-on only resets things that cause the editor to fail. There is also a piece of code in there (not active yet) that resets each part to the same state it would be in if you had just selected it out of the editor list. It actually seems to work very well in the testing I've done so far, but it will be very incompatible for certain mods which is why I am waiting till I can make it a toggle option.

You could probably also read the .cfg files and load things that way. I did not choose that route because sometimes what's listed in the .cfg files isn't all of the startup parameters for a given module. I did not confirm that by actually investigating the .cfg files, but I was afraid that method would be prone to error, and chose a different way. So I'm not saying it can't be done that way, I simply didn't look...So it might be perfectly valid.

The mod compatibility problem that I'm actually referring to is that with mod parts, resetting everything to "factory" state (however you choose to do that) can be disastrous. Take for instance, Procedural Wings. PWings (to my understanding) stores values for wing shape and parameters in the part module. So if I were to reset the part module to a "brand new" state (as if you just pulled it off the parts list), any work done with PWings would be completely destroyed.

Ah, okay. Hmm... multi-docked ships seem like they would be quite a bit harder to deal with unless the "first" docking node is treated specially somehow...

Actually, it does treat the first docking port differently. I haven't inspected a lot of multi-docked structures directly at the savefile level, but enough to know they are different. This is one of those things that I anticipate will be reasonably easy...but it may also turn out to be a nightmare. :P

Cheers,

~Claw

Share this post


Link to post
Share on other sites
  • 0

Hey Claw, are you going to post this in Addons Work in Progress? I can help maintain it there if you dont have time.

Share this post


Link to post
Share on other sites
  • 0

It's actually included on my bug fix & utilities page, which is rapidly becoming unwieldy. http://forum.kerbalspaceprogram.com/threads/97285 Technically it's still "Add-on Development", but I will likely keep the utilities all together to help manage my time (as you hinted).

I suppose I should update my signature to reflect those additions. :P

Cheers,

~Claw

Share this post


Link to post
Share on other sites
  • 0

:D :D :D

she made orbit with a heavy+ cargo! and ooh boy what a first successful run it was...

zUvbL7N.png

QW5A65e.png

mz5egie.png

Space Shuttle Intrepid made heavy plus cargo delivery to 172km. Second run made it to 182km. Landed her at KSC. Then I ripped out everything in the cargo bay leaving the bare floor making her as light as possible, and turned her around back to orbit only by reducing the fuel amounts in the external tank and lower liquid boosters (solids are nearly impossible at this time to lift heavy+ cargo - I should know - I spent 12 hours fighting it lol)! Success!!! A newb-friendly shuttle (hopefully) capable of simple empty flights to space, to capable of anything you can fit into the Mk 3 cargo bay without tweaking anything but fuel amounts! This thing is powerful. Easy. And beautiful. She's a dream to fly. The pictures don't do it justice. :D :D :D

She can also return abort to KSC with any cargo, including the heavy+ you see above. Pics and vid later for that piece of engineering sweetness.

275 parts empty. 304 parts with the heavy+ cargo. :) Not bad. I hope to reduce part count further once I tweak it further. After tweaks, and a video run, she'll be ready to publish.

Claw,

Publish your addin as a separate thread. People need to know this exists!

Share this post


Link to post
Share on other sites
  • 0

Sadly this comes too late to save my SSTO shuttle (I made a new one and a new KSP is out now), but one million internets to Claw anyway!

Share this post


Link to post
Share on other sites
  • 0
:D :D :D

she made orbit with a heavy+ cargo! and ooh boy what a first successful run it was...

Thank you for the pictures. That kind of feedback makes my effort feel worth while. :D

Sadly this comes too late to save my SSTO shuttle (I made a new one and a new KSP is out now), but one million internets to Claw anyway!

Sorry... :( If only I knew how to mod back then.

Cheers,

~Claw

Share this post


Link to post
Share on other sites
  • 0

Tweakable 3 made heavy+ delivery at 200k last night comfortably. Removed fuel lines and redid tank. 20 less parts! Needs slight vertical adjustment to find balance sweetspot between empty and full cargo. Booster tweaks up next.

Space Shuttle Claw (Intrepid Class) after 200k heavy+ delivery.

NYAZ17Jh.jpg

Edited by inigma

Share this post


Link to post
Share on other sites
  • 0

As promised. Released! I'll have to link this thread back to the OP on Monday. But for now, Claw and Starwhip are credited with rescuing this craft from its otherwise untimely end.

Thank you guys. Your work was well worth it.

Thread link and craft file:

http://forum.kerbalspaceprogram.com/threads/108219-STS-1-Space-Shuttle-%28NASA-Replica-Easy-to-Load-Fly%29-Full-O-Y-Tanks-to-Orbit-VIDEO-CRAFT

Share this post


Link to post
Share on other sites
  • 0

Excellent video Inigma. Nice job. :D

Cheers,

~Claw

Share this post


Link to post
Share on other sites
  • 0

Hey Claw, check out the credits when you get a chance:

You have saved a legacy. Thank you again.

Share this post


Link to post
Share on other sites
  • 0

Haha, nice! And very well done video. :D

Cheers,

~Claw

Share this post


Link to post
Share on other sites
  • 0

If you can get me a Station 1 craft I'll send you a save with infinite money, science, & reputation.

Share this post


Link to post
Share on other sites
  • 0

I hate to necro this thread, but I see no better option...Does anyone have a version of this tool that works in 1.0.5? Whenever I try to use it now, it throws a "MissingMethodException: Method not found: ConfigNode.SetValue" error (I assume this was broken in the 1.0 update).

Thanks in advance.

Share this post


Link to post
Share on other sites
  • 0
On 4/7/2016 at 1:19 AM, Three1415 said:

I hate to necro this thread, but I see no better option...Does anyone have a version of this tool that works in 1.0.5? Whenever I try to use it now, it throws a "MissingMethodException: Method not found: ConfigNode.SetValue" error (I assume this was broken in the 1.0 update).

Thanks in advance.

At the risk of nechroing again, yes!  I have a tool that extracts all ships from any save (.sfs) file and wraps them in a .zip archive.

http://www.Kerbaltek.com/craftkitchen
(bottom of the page)

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