Page 1 of 2

KK's Detailed Modding Tutorial

Posted: Sun Dec 17, 2017 7:03 pm
by KingdomKrafters
I joined these forums somewhat recently, with very little experience in making mods. But overtime I learned how to make a large verity of new features. It wasn't easy. Every tutorial I found was confusing or unclear on various parts. Therefore, I have decided to make my own tutorial on making your own mods, from ships to weapons, with every little detail you will need to know, in only 9 steps! This tutorial is for beginner modders with SOME experience. Lets get started!

Tools you will need:
    -Slisptream mod manager
    -notepad
    -your brain
Tools you will want:
    -Superluminal 2
    -GIMP or Paint.net
    -your arms

Step 1: getting your ideas
well this part sounds easy, but it isn't. What do you want to make? A beam that stuns crew? Or perhaps a renegade mercenary ship? Its up to you on what you want to make. Be original!
But wait! there's more. Mods are always better with custom artwork, and its far easier to get going once you have a sprite to use. If your good at this stuff, then you can just go ahead and make it. But if your not good with sprite making, then try the simple stuff, like taking parts of other sprites (they don't even have to be from FTL!) and mix them together, and viola! Be careful though, I would SERIOUSLY RECOMMEND that you use GIMP or Paint.net, or the chances are that your sprites are going to look like big ugly white blocks.

Step 2: getting the code
Now comes the part that may confuse you. There are two things you can do to get code. If you want fresh code with no mods, then first open Slipstream. If you've never run Slipstream before, then it will promt you to find the data.dat and rescource.dat files. This sounds confusing, but its not. Find the steam directory, then go to the folder labeled steamapps. Then choose common, then choose FTL Faster than Light. Now slipstream will open the mod runner. Select file from the top, then select "extract dats".
Image
select file on Slipstream

Choose where you want to extract them from (it should automatically choose the right location), and click "save". Now go to where it extracted from, and you'll find 4 folders, data, img, audio, and fonts.
Data is the most important of these. This is where all the code we need is stored. Img contains all images, and sounds contains well.... all the sounds. We can ignore fonts. The other way to get this code is slightly easier, but you will get someone else's modded files. Assuming you know how to put mods into slipstream, go to your mods folder and find the mod you want to alter the code of. Then copy the file and paste it into a clean folder (this just keeps everything neat). right click the file and select rename. Change the file extension from .ftl to .zip. Tada! you now have a zipped folder with all the code in it! open the .zip folder and take all the files out (they should all end with .append). You now have modded code! (note: this tutorial will most likely not work with the mod you just used... try the previous method and once you know how to code come back and try this)

Step 3: Reading code (weapons)
Heres the easy part! Lets start with how to make a custom weapon. Go into the data folder and find the file labeled "blueprints.xml". Copy the file and paste it into a new, empty folder. IMPORTANT: NEVER ALTER THE ORIGINAL FILE!!!. Next, right click the file and select rename. after .xml, add .append. This makes sure that your files don't contradict with other mods. Now open the file with notepad.
Image
this is what the file should be named

In notepad, you should see a lot of words that will make little sense to you. Don't worry, I'll tell you exactly what all this means. First, you should know this: FTL uses xml to work. xml code uses things called tags.
Tags look like this: <example> </example>. Weapon and system properties are defined by these tags. For now, just delete all the code by pressing alt + a on your keyboard and then hitting backspace. Now copy this code into the empty text file

Code: Select all

<?xml version="1.0" encoding="utf=8"?>

<weaponBlueprint name="">
   <type></type>
   <title></title>
   <short></short>
   <tip></tip>
   <desc></desc>
   <tooltip></tooltip>
   <damage></damage>
   <shots></shots>
   <sp></sp>
   <fireChance></fireChance>
   <breachChance></breachChance>
   <cooldown></cooldown>
   <power></power>
   <cost></cost>
   <bp></bp>
   <rarity></rarity>
   <image>laser_light1</image>
   <launchSounds>
      <sound>lightLaser1</sound>
      <sound>lightLaser2</sound>
      <sound>lightLaser3</sound>
   </launchSounds>
   <hitShipSounds>
      <sound>hitHull2</sound>
      <sound>hitHull3</sound>
   </hitShipSounds>
   <hitShieldSounds>
      <sound>hitShield1</sound>
      <sound>hitShield2</sound>
      <sound>hitShield3</sound>
   </hitShieldSounds>
   <missSounds>
      <sound>miss</sound>
   </missSounds>
   <weaponArt>laser_burst_1</weaponArt>
   <iconImage>laser</iconImage>
</weaponBlueprint>

The code I have provided you with is a blank template for your weapon. It contains only the basic tags needed. Bellow I will include all property tags and what they do

Code: Select all

<damage></damage> this specifies how much HULL damage the weapon does. Can be negative (repairs hull)

<shots></shots> how many shots the weapon fires. Must be 1 or higher

<sp></sp> this specifies how many shield layers the weapon goes through. (can be negative, but negative only works on beams)

<fireChance></fireChance> this specifies the chance (in percentage) to cause a fire. IMPORTANT: putting a 1 will mean 10%. 10 will make it 100%. 5 is 50%, and so on

<breachChance></breachChance> the chance (in percentage) to cause a breach.  IMPORTANT: putting a 1 will mean 10%. 10 will make it 100%. 5 is 50%, and so on

<stunChance></stunChance> the chance (in percentage) to stun crew members.  IMPORTANT: putting a 1 will mean 10%. 10 will make it 100%. 5 is 50%, and so on

<cooldown></cooldown> how long it takes (in seconds) for the weapon to charge. Can be 0

<speed></speed> how fast the projectile travels (in pixels per second). Must be 1 or greater

<power></power> how much power the weapon requires. Can be a negative number(uses no power and provides power to system), 0 (takes no power but requires another weapon to work), and greater than 4

<cost></cost> how much the weapons cost to purchase. The sell costs is a fraction of this

<bp></bp> Ignore this. All weapon need this to work, but the value changes nothing. (was going to be part of a customization feature, but it was never added)

<rarity></rarity>How rare the weapon is. 0 (the lowest possible number) means it will never show up in stores or events, and 5 (the highest possible number) means it will be ULTRA RARE

<persDamage></persDamage> this specifies how much bio damage the weapon does. IMPORTANT: damage is in intervals of 15, so if you put it at 1, it will do 15 bio damage. can be negative

<color> <r></r> <g></g> <b></b> </color> Only works for beams. Changes the color of the beam. (RGB)

<sysDamage></sysDamage> Specifies how much system damage the weapon does. If a weapon does hull damage, it will do as much hull damage it does to systems as well. This tag can alter how much it does. can be negative

<length></length> only works for beams. specifies how long (in pixels) a beam is

<hullBust></hullBust> means the weapon does 2x damage on systemless rooms. Can only be set to 1 or 0. If you set to 0 it will NOT activate hull bust.

<missiles></missiles> specifies how many missiles the weapon takes to fire. Works on ALL weapon types, but on beams it will not use the missile.

<ion></ion> specifies how much ion damage the weapon does

<projectiles> <projectile count="" fake=""></projectile> </projectiles> Used in flak weapons. The count specifies how many of that type of projectile it fires, fake specifies whether it does damage (true means no damage) and projectile is what sprite the weapon uses.

<radius></radius> how large (in pixels) the radius (only works for flak weapons) is for the weapons

<spin></spin> how quickly (in pixels per second) the projectile spins (only for flak weapons

Dont worry if the tags confused you. Overtime you'll learn what they all do. Just don't be afraid to experiment!

Step 4: Writing the code (weapons)
Now its time to write the code. For now I'm going to walk you through making a very simple laser weapon. First find the part where it says: <weaponBlueprint name="">. In between the two quotation marks, we'll write this: LASER_WEAK. It is important that you make sure it's all caps. While it isn't necessary for the weapon to function, it helps keep the code clean and easy to read and identify. Next find the part that says <type></type>. In here we need to specify what weapon type it is. Weapon types are LASER, MISSILE, BOMB, BEAM, and BURST. For this weapon we need to put LASER as our type. Next, lets decide what to call our weapon. You can name it whatever you want, but for this tutorial I am going to call is "Weak Laser". Next lets write our short title. This is the shortened name of the title. For this weapon lets just call it "Laser". Now comes the fun part. Making the properties of your weapon! I' going to include a picture bellow of what I did for my laser. Feel free to follow or make your own properties. Ignore the image and sound properties, we'll get to those later.
Image
the finished laser weapon

Step 4 1/2: Organizing your code (FOR ANY MOD TYPE)
THIS IS A NECESSARY STEP!!! YOUR MOD WILL NOT WORK IF YOU DO NOT FOLLOW THESE INSTRUCTIONS!!! In order for FTL to process your mod correctly, your files need to be in folders with the correct name. First off, you should already have a folder containing your blueprints. This folder can be named anything you wish. Its the contents of this folder that we will be changing. We'll call this your "mod folder". Now inside of your mod folder you'll need another folder labeled "data". Inside the data folder you will put all of your .append files. If your wish to make custom sprites for your mod, you will need another folder called "img". If you wish to have custom sounds, you will need a folder called "audio".

Step 5: Making your weapon sprite (optional)
Now its time to make your sprite and add it in game. First off, we're going to need a copy of the animations file. Go into the data folder with all of the unmodded code and find the file called animations.xml. Copy it and put it into your data folder. Next, grab your image and drag it into the img folder. I myself am not too good at making weapon sprites, so instead I'm going to walk you through how you would animate your sprite. below I've included a template.

Code: Select all

<animSheet name="" w="" h="" fw="" fh="">weapons/</animSheet>
<weaponAnim name="">            
   <sheet></sheet>   
   <desc length="" x="0" y="0"/>                                    
   <chargedFrame></chargedFrame>                                    
   <fireFrame></fireFrame>                                       
   <firePoint  x="" y="" charge=""/>                                 
   <mountPoint x="" y=""/>                                       
</weaponAnim>

Understanding this code is simple. First off, we have the animsheet. This is going to basically be the img your using, but with some specified variables. First, name the sheet anything you want. Then specify the width of the image(w), the height of the image (h), the frame width (this is width of just one frame), and the frame height (should be the same as the normal height). You will then see where it says: weapons/. After the slash, type in the name of the sprite you made. It is important that you keep both the weapons/. Next we will create the actual animation. In the sheet tag type in the name of the animsheet you previously made. Next, in the desc length tag you need to specify how many frames there are in the sprite (IMPORTANT: the first frame is frame 0, not frame 1). Leave the x and y at 0. Next you need to specify which frame is displayed when the weapon is fully charged. (remember the first frame is called frame 0). Next specify which frame starts the firing sequence. (this should be the frame after the charged frame). Firepoint is the location (in x and y) where the projectile comes out of. Mountpoint is the location (x and y) where the weapon mounts onto the ship.

Step 6: Adding your weapon into the game
This step will cover two things, how to include your weapons on a player ship, and how to get your weapons to show up on enemy ships. Go and find the file called "autoblueprints.xml". Copy and paste it into your data folder. Rename it to autoblueprints.xml.append and then open it with notepad. DO NOT DELETE EVERYTHING LIKE WE DID WITH THE LAST TWO FILES. This file is separated into many lists of weapons.
Image
the list of all weapons auto ships can have

For now lets just edit the auto ship weapon list. Find where it says <name>LASER_BURST_1</name>. Copy that line and paste it bellow. Then change LASER_BURST_1 to WEAK_LASER, or whatever you called your weapon blueprint. Once we add this file to the game, all AI ships will have a chance to spawn with our new weapon. Now, lets put our weapon onto a already made player ship. First off, if you DO have superluminal, then you can just skip this next part. I'll talk about superluminal later. You can ignore the next part if you plan on also making your own ship, because I'm going to walk your through how to merge your weapon with that too. We are going to add our laser to the type A engi ship, so that it has something other than an ion weapon and a drone. Now open back up blueprints.xml.append, and copy and paste this text in to the document:

Code: Select all

<shipBlueprint name="PLAYER_SHIP_CIRCLE" layout="circle_cruiser" img="circle_cruiser">
   <class>Engi Cruiser</class>
   <name>The Torus</name>
   <unlock>To unlock this Engi ship you'll need to get to the 5th sector with any layout of the Kestrel.</unlock>
   <desc>Although it may look like a pile of junk loosely held together, this well designed ship relies on drones and ion weaponry.</desc>
   <systemList>
      <pilot power="1" room="8" start="true" />
      <doors power="1" room="5" start="true" img="room_doors_4">
         <slot>
            <direction>right</direction>
            <number>0</number>
         </slot>
      </doors>
      <sensors power="1" room="4" start="true" img="room_sensors_4">
         <slot>
            <direction>left</direction>
            <number>1</number>
         </slot>
      </sensors>
      <oxygen power="1" room="15" start="true" img="room_oxygen_4" />
      <engines power="2" room="2" start="true" img="room_engines_2" />
      <shields power="2" room="3" start="true" img="room_shields_4" />
      <weapons power="3" room="11" start="true" />
      <drones power="3" room="0" start="true" />
      <medbay power="1" room="7" start="true" />
      <clonebay power="1" room="7" start="false" />
      <!-- F-->
      <teleporter power="1" room="9" start="false" />
      <!-- F-->
      <cloaking power="1" room="12" start="false" img="room_cloaking_4" />
      <!-- F-->
      <battery power="1" room="1" start="false" img="room_battery_6" />
      <!-- F-->
      <mind power="1" room="6" start="false" img="room_mind_6" />
      <!-- F-->
      <hacking power="1" room="14" start="false" img="room_hacking_2">
         <!-- F-->
         <slot>
            <direction>down</direction>
            <number>0</number>
         </slot>
      </hacking>
   </systemList>
   <weaponSlots>3</weaponSlots>
   <droneSlots>3</droneSlots>
   <weaponList count="1" missiles="0">
      <weapon name="ION_4" />
   </weaponList>
   <droneList count="1" drones="15">
      <drone name="COMBAT_1" />
   </droneList>
   <aug name="NANO_MEDBAY" />
   <health amount="30" />
   <maxPower amount="10" />
   <crewCount amount="1" class="human" />
   <crewCount amount="2" class="engi" />
</shipBlueprint>

This is the exact code for the Engi type A ship. Find where it says:

Code: Select all

<weaponList count="1" missiles="0">
   <weapon name="ION_4" />
</weaponList>

This is the list for the weapons on the ship. Copy <weapon name="ION_4" /> and paste it again below. now change the name from ION_4 to WEAK_LASER, or whatever you called your weapon blueprint. Now save the document and close out of it. We are done!

Step 6 1/2: making sure everything is right
Before we continue, it is important that we make sure that EVERYTHING IS CORRECT. We can always come back and change the code, but its a major pain to have to keep going back every time theres a bug. Go back and make sure you didn't forget anything. Are all your files in the correct folder? Are you positive that your sprites aren't going to be white blocks? If you are, then lest continue!

Step 7: making your ship
Now lets make our ship. First off, I WOULD SERIOUSLY RECOMMEND THAT YOU DOWNLOAD SUPERLUMINAL. It makes life SO much easier.
Image
Superluminal is easy to use!

For now, I'm going to assume that you have Superluminal. Of course this isnt a tutorial on how to use Superluminal, so instead I'll just tell you how to put your custom weapon on the ship. There is of course, the easiest way, where you compile your weapon first mod first, then quit FTL and open Superluminal, where in the options section you'll find your weapon there ready to use, I'm going to teach you THE OTHER WAY. First, design your ship, and for now, just put a place holder weapon there instead. Whatever weapon you want. Now go to file and click "save as". I always prefer to save my finished ships to my mod folder, so that they are easy to find. Save it to wherever you want. Remeber how earlier I walked you through how to unpack finished mods in step 2? We are going to do the EXACT same thing. You'll notice that the ship file ends in .FTL. all you need to do is right click the file, select "rename". Then change the file extension to .zip. Open the zip folder, and you'll find all of the images and code for the ship.

Step 8: Merging your code
Here we go! Now its ENTIRELY up to you whether you want to move the weapon stuff to the ship file, or the ship stuff to the weapon file, but first, take all of the ship stuff (images and code) out of the .zip file. For now I'm just going to merge the weapons with the ship (it really doesn't matter, its just easier this way). For all of the weapon images, just move them to the img folder for the ship. Simple as that! If you had custom sounds for your weapons, it should be even simpler to merge them. Seeing as your ship shouldn't have any sounds, simply copy over the audio folder. Now comes the code merging. This is FAR simpler than it sounds. Simply open up the file with your weapon code, and paste it into the blueprints with your ship (the ship blueprints should also be in a file labeled "blueprints.xml.append). Now find the code for your ships weapon list, which should look like this:

Code: Select all

<weaponList count="1" missiles="0">
   <weapon name="FILLER_WEAPON_NAME" />
</weaponList>

Now simply change the name of the filler weapon to the name of your weapon!

Step 9: Packing it all together
THE FINAL STEP! And also perhaps the easiest one! Now that all the code is merged, simply put it all into a new .zip folder. Now, rename the folder and change the extension to .FTL. Copy the file and put it in slipstream, and we are done!

Thank you for going through my tutorial, and I hope you found it usefull! If you found something confusing or an error in the code, please let me know below! Thanks again!

Re: KK's Detailed Modding Tutorial

Posted: Mon Jan 15, 2018 6:01 am
by Stormbringer
hi there, kikra, I'd like to point out that you can easily merge in superluminal by loading the mod you want to merge with before loading/saving a ship. it will save time, and decreases the risk of buggy stations, glows etc.

Re: KK's Detailed Modding Tutorial

Posted: Sun Feb 04, 2018 3:54 am
by saltypoe
Thank you so much for this, helps out a lot. I have one question tho, I am trying to launch Superluminal and it keeps asking me to find data.dat and resources.dat, where can I find these? I've tried searching my entire computer for them and I just can't find them at all, and it won't run properly without them.

Re: KK's Detailed Modding Tutorial

Posted: Sun Feb 04, 2018 4:07 am
by KingdomKrafters
thanks for the feedback! to find the data.dat files, go to file explorer, then local disk C, users, your user name, then find steamapps, then common, then choose the fasterthanlight folder. It should be there.

Re: KK's Detailed Modding Tutorial

Posted: Fri Mar 16, 2018 10:10 pm
by ObstRiegel
Hi, is there a way I can change the use of font files for some text?

I am triyng to create an german mod and have some issues with some letter that canĀ“t be used with the HL2.font.
Can I change the text that use HL2.font to use another font that can view the missig letters?

Re: KK's Detailed Modding Tutorial

Posted: Sat Mar 17, 2018 12:54 am
by KingdomKrafters
ObstRiegel,

I haven't really gone into altering the fonts, but from what I understand, altering the font would work, but it would probably need to fit the same size as the normal font in FTL. There is no text document directed towards fonts, so coding is minimal. If you arent sure wether it will work, just rename the normal FTL font (in the font folder next to the data and img folder) and past in your new font and give it the name of the normal font to try it out. If altering the font still doesn't work, then chances are you would have to dive into the executable to fix it.

Re: KK's Detailed Modding Tutorial

Posted: Sat Mar 17, 2018 9:28 am
by ObstRiegel
You Sir are a MOTHER F**KING GENIUS, thank you very much my friend. I have just change the name from "JustinFont11Bold.font" to "HL2.font" and it work!!!
Dude you have saved me from many days of headache. I will mention you for your help in the Mod when its ready.

Re: KK's Detailed Modding Tutorial

Posted: Mon Mar 19, 2018 1:33 am
by KingdomKrafters
Glad to help!

Re: KK's Detailed Modding Tutorial

Posted: Thu Apr 12, 2018 3:15 am
by AgentTHeKat
Tools you will want:
    -Superluminal 2
    -GIMP or Paint.net
    -your arms

arms
oof must be hard with those slug tentacles

Re: KK's Detailed Modding Tutorial

Posted: Thu Apr 12, 2018 3:40 am
by KingdomKrafters
yes, very much so.
I would imagine its even harder with mantis claws or engi stump thingies