How to recover corrupted ships

    Joined
    Mar 10, 2015
    Messages
    122
    Reaction score
    50
    • Community Content - Bronze 1
    • Purchased!
    • Legacy Citizen 5
    So, the other day my computer overheated while I was building and it corrupted a whole bunch of things. Most notably, the sector I was in was completely deleted - every ship disappeared. Two of them were pretty important to me, so I tried to get them back - and succeeded. Here's what I did:

    1. Find your install path. I bought the game on steam, so mine is ~/.steam/steam/SteamApps/StarMade/StarMade. If you're on windows, check in C:\Program Files\ or C:\Program Files (x86)\. You probably have two folders called StarMade, just like I do - you're looking for the one with StarMade.jar.
    2. Find your world. The big StarMade folder has another folder called server-database which contains all your save data. The world I was in was called "creative", so I opened server-database/creative.
    3. In here, you'll find a lot of stuff. There's a file for every ship, station, shop, asteroid, planet, and player in here, as well as some other stuff. Most of them are .ent files; what stood out to me was that some of them had been renamed to .ent.corrupted - most notably, my ships and my player file (as well as my catalog - although I didn't actually notice anything missing).
    4. Keep a note of which ships (or stations, or asteroids, or other entities you want to recover) have .corrupted on them. You're going to need to know that for later.
    5. There's a folder in here called DATA. Inside that, you'll find tons of .smd2 files - this is where chunk data is kept for all of your ships. What stood out to me here was that the ships I wanted still had files in here - dozens of files - and they weren't corrupted.
    6. If this is what your situation looks like, what happened to me probably happened to you: your ships are mostly fine. Well, the block data - the part that takes the most work to redo - is fine. The game just doesn't know where to put those ships. If you're not seeing files in DATA with your ship's name on them, or if you see them with .corrupted on the end, you'll have to try something else.
    7. You have two options now.
      • Quick method - this is faster, but you will PERMANENTLY LOSE one chunk of your ship (centered around the core). In my case, one of my ships didn't actually have any blocks around the core anyway, so it didn't matter.
      • Long method - if your ship was large (and has a lot of files in your DATA folder), this will take longer, but will restore the whole ship (no missing chunk around the core). I used a bash script to make it faster, but if you're not up to running code or renaming a bunch of files, you might want to go for the quick method and just replace the missing chunk manually.
    8. BACK UP YOUR WORLD. You can do this by right clicking on the folder for your world (mine was called "creative", so I right clicked on the folder "creative" inside "server-database") and either copying it to a different location, or compressing it.
    9. Start up the game and fly to where you want to recover your ships. You can recover them anywhere; it doesn't have to be in the sector you lost them in.
    10. If you're going with the quick method, you can simply create a new ship with the exact same UID as the one you lost. It must exactly match - mine was called "Monchoman45_1427770718353", so I created a new ship with that name. This will spawn in your previously corrupted ship (with the chunk around the core missing). Do note that, when spawning in, it will clip through anything nearby, so make sure you place the core far away from other ships.
    11. If you're going with the long method, create a new ship with a memorable name. I called mine "REPLACE WITH CORRUPTED". If you're trying to recover multiple ships, you can create one core for each one, but make sure you space them out considerably - as above, when you recover them, they will clip through anything nearby.
    12. Close the game and go back to your files. You should see a new .ent file for the ship you just created. In DATA, you should also see a .smd2 for the ship. You can delete the .smd2, you don't need it.
    13. Now, rename all the .smd2 files for your corrupted ship to the name of your new one. Mine looked like:
      Code:
      ENTITY_SHIP_Monchoman45_1427770718353.0.10.0.smd2
      ENTITY_SHIP_Monchoman45_1427770718353.0.11.0.smd2
      ENTITY_SHIP_Monchoman45_1427770718353.0.12.0.smd2
      ENTITY_SHIP_Monchoman45_1427770718353.0.13.0.smd2
      ENTITY_SHIP_Monchoman45_1427770718353.0.2.0.smd2
      ENTITY_SHIP_Monchoman45_1427770718353.0.3.0.smd2
      ENTITY_SHIP_Monchoman45_1427770718353.0.4.0.smd2
      ENTITY_SHIP_Monchoman45_1427770718353.0.5.0.smd2
      ENTITY_SHIP_Monchoman45_1427770718353.0.6.0.smd2
      ENTITY_SHIP_Monchoman45_1427770718353.0.7.0.smd2
      ENTITY_SHIP_Monchoman45_1427770718353.0.8.0.smd2
      ENTITY_SHIP_Monchoman45_1427770718353.0.9.0.smd2
      So I renamed all of these to:
      Code:
      ENTITY_SHIP_REPLACE WITH CORRUPTED.0.10.0.smd2
      ENTITY_SHIP_REPLACE WITH CORRUPTED.0.11.0.smd2
      ENTITY_SHIP_REPLACE WITH CORRUPTED.0.12.0.smd2
      ENTITY_SHIP_REPLACE WITH CORRUPTED.0.13.0.smd2
      ENTITY_SHIP_REPLACE WITH CORRUPTED.0.2.0.smd2
      ENTITY_SHIP_REPLACE WITH CORRUPTED.0.3.0.smd2
      ENTITY_SHIP_REPLACE WITH CORRUPTED.0.4.0.smd2
      ENTITY_SHIP_REPLACE WITH CORRUPTED.0.5.0.smd2
      ENTITY_SHIP_REPLACE WITH CORRUPTED.0.6.0.smd2
      ENTITY_SHIP_REPLACE WITH CORRUPTED.0.7.0.smd2
      ENTITY_SHIP_REPLACE WITH CORRUPTED.0.8.0.smd2
      ENTITY_SHIP_REPLACE WITH CORRUPTED.0.9.0.smd2
      The bash script I did that with was:
      Code:
      #!/bin/bash
      for file in ./*; do
              if [ "$file" != "${file/$1/$2}" ]; then
                      mv "$file" "${file/$1/$2}"
              fi
      done
      #./rename.sh <from> <to>
    14. Once everything has been renamed, relaunch the game. You should see all of your ships load in.

    One thing I have noticed with this is that, although you get all your blocks back, you lose any metadata that came with them; eg, you'll have to reconnect all your weapons, logic, teleporters, etc. Display modules also get cleared (which made me sad, because I had a lot of information on display modules). But, at least you get the blocks.

    Moral of the story: blueprint your ships often.