Page 1 of 1

Process for modding .dat files?

Posted: Wed Nov 14, 2012 10:20 pm
by Alsojames
After trying numerous times, I've given up on downloading the available ship editors here. Stuff isn't downloading properly and quite frankly it's giving me a headache.

I'm writing a story and I'm getting tired of having to spend half my game building my ship up to what my story's ship is (weapons, crew and systems-wise).

So I went into the files, changed some weapons and crew around, and started the game. I got an error that said that the application had requested that the runtime shut down (or something like that....essentially, it gave me an error and the game stops working).

Does anybody know how (step-by-step) I can edit the in-game DAT files so that they actually work with the game?

Re: Process for modding .dat files?

Posted: Wed Nov 14, 2012 11:45 pm
by Kieve
  • Step 1: Download FTLDAT (If you haven't already)
    http://www.ftlgame.com/forum/viewtopic.php?f=12&t=1920
    This little tool is required in order to unpack/repack the data and resource .DAT's properly. If you're trying to edit things directly in the .DAT itself, then yes, things will break.
    *FTLDAT is command-line stuff. If you have trouble figuring it out, read through the posted thread. You may also need to do some background research on your particular OS if you're not comfortable navigating and using command-line prompts.
  • Step 1-B: BACK EVERYTHING UP
    Before modding anything always make sure you have clean, untouched copies of the data and resource files squirreled away. If you screw anything up (which is easy enough to do), it's important to have clean copies to restore.
  • Step 2: Unpacking the files
    Using FTLDAT, extract the game's data.dat file. You can unpack resource.dat too, but for your purposes this probably isn't necessary.
  • Step 3: Editing
    Basic things like altering ship loadout and crew is done in the unpacked Blueprints.xml file. There's a wealth of information already available on FTL Wiki. I recommend reading through the modding guide first, and asking for clarification on specifics here after.
    *Important note: the XML's are extremely sensitive and easy to screw up. Even a single misplaced > bracket can cause runtime errors that result in the game failing to start. Proof-read everything you do. Thoroughly.
  • Step 3-B: Distributing (optional)
    If you plan on making a mod to distribute and share, then .APPEND files are a must. Short version: make a new text file, copy the blueprint or event you wish to change from its original file into the new blank, make your edits there, and save the new file as [original.xml].append. Example, altering a ship's blueprint would move from "blueprints.xml" to your own "blueprints.xml.append" and would contain JUST the ship file info you copied, with your changes to it. There are a few reasons for this, but they only matter if you plan on sharing your mod.
  • Step 4: Repacking
    Once you've made all the changes you need, use FTLDAT to repack the edited files.

Re: Process for modding .dat files?

Posted: Wed Nov 14, 2012 11:58 pm
by Alsojames
Arrgh. I was afraid I'd have to download ftldat. Whenever I try, I get a message from Norton antivirus saying that "the file was not safe" and it doesn't finish downloading.

Shit.

Re: Process for modding .dat files?

Posted: Thu Nov 15, 2012 12:17 am
by Kieve
Alsojames wrote:Arrgh. I was afraid I'd have to download ftldat. Whenever I try, I get a message from Norton antivirus saying that "the file was not safe" and it doesn't finish downloading.

Shit.
Tell Norton to blow it out its serial port. FTLDAT is bare-bones utility stuff but it's not a threat to your comp. Just make an exception for FTLDAT's directory and have fun modding.

Re: Process for modding .dat files?

Posted: Thu Nov 15, 2012 12:51 am
by Alsojames
Now I just need to find the button for that >_>

Re: Process for modding .dat files?

Posted: Thu Nov 15, 2012 10:30 am
by alextfish
I had that from Kaspersky too. In the end I never got FTLDAT past my antivirus, but I found that if you download Grognak's Mod Manager and apply a patch, it creates a "data.dat-unpacked" directory where you can find blueprints.xml. You do have to make all your changes in the form of FTL files, which is slightly annoying when debugging a "application would not start" problem (we all get them), but it works pretty well

My working process for making a change to my mod goes:

1) Edit blueprints.xml.append
2) In the directory with "data" and "img", select them both, right-click, say "Add to DIRNAME.zip"
3) Rename DIRNAME.zip to DIRNAME.ftl
4) Drag the new .ftl file into my mods directory
5) Run GMM and patch the new mod in
6) Run FTL and see if I've fixed the problem. If not, go to 1)...

It's a fairly quick process once you've done it a couple of times, but it's even quicker with cygwin's help:

pushd mods/SC2; zip -rq SC2 *; mv SC2.zip ../SC2.ftl; popd; ./modman.exe; ./FTLgame.exe &