Are you a real modder? Have you ever caught a good bug, like a, like a real master coder? Well then, have you ever opened up someone else's source folder?
(Edited 2nd October 2021 for 0.95a)
In order to understand what you need to do, I'll start with the outline of a basic mod. A really damn basic one is my 'Lion's Guard' mod. All it does is add Lion's Guard skins to Sindrain Diktat. Such a thing is actually pretty basic, and is the first one I ever attempted. I'll go through it with a hypothetical example, and it should be easy to figure out what you need to do working sideways or backwards what I've shown here.
SO, we begin in the mods folder. Note, in each picture, I have included at the top the address bar, so you can figure out where we are. For instance, my mods folder is in the Starsector folder, which is in the Fractal Softworks folder etc. etc:
And look - I have selected my mod folder. Let us enter into it's wicked demesne, and determine it's contents:
Here we have three things that are the absolute BASIC you need to mod:
1) A data folder. All the stuff that describes how things work goes here.
2) A graphics folder. This is where all your tasty bote images live.
3) A TERRIFYING and SPOOKY mod_info.json file. This file is how the game figures out that the mod exists, and what it needs to do to plug it into your game.
Let's have a gander at the mod_info.json. You can look at it with wordpad or notepad...but I very, very, very, VERY strongly suggest - nay DEMAND you use
Notepad++. It's free, and it's just flat out better than wordpad and notepad. Let's look at my mod_info.json file in notepad++
The basis of this file is found in EVERY mod. Literally, every mod has this, otherwise the game won't plug it into the game. So you can essentially copy-paste this form another mod, and alter it for your own needs. It's somewhat self-explanatory:
"id" - What your mod uses to refer to itself code-wise. This can be anything, but often for simplicity sake you make it the same name as the folder your mod is in. Not really important for this level, but becomes important in more complicated projects.
"name" - The name that pops up in the mod directory when you start the game. Is pretty much the visible name of your mod to everyone else.
"author" - The Incredibly Handsome Individual who made the mod.
Mesotronik is also an acceptable input here."version" - The version of your mod. When you update or improve the mod, you can increase the number here.
Or write 'Dragons r kewl' for one version, and 'Alex is da bomb' in the next. Except don't actually do that - use numbers so players can easily determine if they are out of date or not.
"description" - The description that shows up in the mod directory when you start the game. Usually a bit of a blurb on what's in the mod, or what the faction is, or
the password to Alex's twitter account."gameVersion" - The game version this mod has been made for. For the current build, it's "0.8.1a"
Simple as that. So copy-paste a mod_info.json from another mod into your mod folder (Blackrock is a good mod to do this from, because Blackrock has the Nevermore, instantly making it twenty times cooler than every mod out there), open it up with notepad++, change it, and save it.
Now let's go back to my trusty mod folder.
Now you know what that mod_info.json file does. Not very scary is it? Let's have a peek inside that graphics folder.
This is what it looks like. There's a hullmods folder, but that's not important here. What is important is the ships folder - this is where the image files for your ships are. If you're using a ship editor, this is where it or maybe you
should save the image files. Within the context of this walkthrough, it's not vital, but it is good to know where it SHOULD be. Back to the mod folder:
And now, we plunge headfirst with reckless abandon into the briney waters of the data folder:
Again, ignore the hullmods folder. What is important is the 'campaign' folder, the 'hulls' folder, the 'variants' folder, and the 'world' folder. Let's start with the hulls folder. The 'hulls' folder holds the information about your ship, containing .ship files and ship_data.csv. Let's have a gander inside:
Oh, what do you know! There's a ship there, called XIV_noscope_420 that has 20 TPC pulse lasers. This .shipfile was generated using a ship editor, and tells the game stuff about your ship, like it's shape, how big it is, how big it's shields are, how TPC pulse lasers it has, and so on. Also in this folder is the ship_data.csv file. This contains information about your ship that modders like to change a lot, like armour, hitpoints, ordinance points, fuel use, cargo - essentially everything that pops up in the 'stats' region when you look at the ship info. You can use either a ship editor, or Excel to look at this data.
Ammendum: There is a caveat to this file that doesn't immediately become obvious, which is the 'tags' column. This column essentially says what blueprint the hull belongs to. So, you can get a family of ships under, say, the 'noscope_bp' by adding noscope_bp to this column. Or, if you want it to be apart of the base tech, low tech, midline tech or high tech lines, then add 'base_tech', 'lowtech_bp', 'midline_bp' and 'hightech_bp'. Or, if you want this ship to show up individually as a rare drop, then make the tag rare_bp. Where this blueprint comes in will be discussed later; for now my Lion Guard .skins and .hulls all use the 'LG_package' tag.
Anyway, we now know that I have a (hypothetical) ship that I want in the game, called XIV_noscope_420. I have the ship image in my graphics/ships folder. I have the .ship file in data/hulls, and the appropriate row of data in the ships.csv file. But how do I get it into the game so I can shoot Luddites? Let's go back to the data folder:
We've looked at the hulls folder, but now we have to go to the next step: we need a variant of the ship. INTO THE VARIANT PORTAL:
Here is the inside of the variants folder. Each and every ship has a variant file (or ten), which determines what the ship should be armed with when it spawns in a fleet. These are generated using the 'variant' mode in the ship editor. They can also be edited using notepad++, but I suggest you edit, not create, using notepad++. SO, we can observe that XIV_noscope_420 has a variant. XIV_noscope_420_best is, obviously, the best variant of XIV_noscope_420.
Now we have all the basic data the game needs to spawn my ship for a faction. It has an image in graphics/ships, a .ship file and the appropriate data in ship_data.csv in data/hulls, and a variant file in data/variants. Now, we just need to tell the game to actually do it. Let's swing back into the data folder, an OH DEAR ITS DIO:
Quick! Dodge the timestop and get into
za warduo the world folder...and then the 'factions folder:
Behold! A .faction file! Or rather, TWO .faction files! Fiendish! Fabulous! Fantastic! AND, with 0.9a, the introduction of the devious, devilish and damned, default_ship_roles.json file!
The .faction files dictate some basic information about factions, like their names, campaign colours, encounter music and what ships they can use. Note: What ships they can use. These files, however, can't make planets and stations appear and put your faction on it - they can only do basic stuff. You can easily find the original in a similar location in the starsectorcore folder in the original StarSector folder. Let's open up my sindrian_diktat.faction file.
Seems very small, doesn't it? That because for a pre-existing faction, you don't have to completely remake the .faction file. You just need to make up the file in such a way that it can insert what you want into the pre-existing .faction file. Luckily for you, if you want to stick a ship into a faction and nothing else, you won't have to do much more than what I've done above - add the hull to the knownHulls section. Also make sure to put quotation marks around your hull, and place a comma after it. This tells the faction (in this case the Sindrian Diktat) it knows how to make the ship. That's it - if you want your ship in a faction, slip it in here, and the faction will know the hull.
The same goes for fighters and weapons. hullFrequency let's you control how often the ship shows up in a fleet, with big numbers (about 10) saying it'll show up a lot, and small numbers (0.5) to keep it rarer than normal. Also, MARK THIS: the LG_package is in the 'tags' section, which tells the Sindrians that hey, you can use all the ships with the LG_package in your tags column. Which means hey, you can use Lion's Guard ships if you want. You can play around with 'priorityShips' and 'ImportedShips', which are somewhat self explanatory.
Another thing to point out: If you have an array empty, for instance: "knownShips": [], with nothing inside the brackets, then that essentially multiplies the "knownShips" by zero,
completely removing any ship from being known by the faction. This also occurs similarly with any other bracketed information here. When you make your file, ensure that all the brackets have information in them, or are removed completely. Remember, you don't need ALL of the information of a faction file here, just the stuff you need to change.
HOWEVER, if you're used to 0.8.1a, or you've only read up until now, you'll think that you'll only need the .faction file to get your ship in.
THAT IS WHERE YOU ARE WRONG.
AND SO WAS I.
UNTIL I LEARNED OTHERWISE.If we can return to the factions file, we can see this weird, wild and wacky default_ship_roles. Let's slip and slide into it...
And this is what we have:
This is where all the variants live! Essentially, the faction file looks for a hull, which then goes to this file to find the variants. The numbers after each variant is how often that variant will be chosen. Further, (and don't quote me on this) when all the numbers for a hull are added up, the larger this combined number is, the more often this hull will show up in the faction fleets. The 'combatsmall' and 'combatmedium' etc. are 'classes' which the game uses to figure out how 'heavy' your ship is. For instance, if XIV_noscope_420 was a giant capital ship, then I'd stick it beneath "combatCapital". If it were a small combat ship, then I'd stick it under "combatSmall". There are far more classes which you can observe in the original, however for this example I'll just casually place the name of the variant of XIV_noscope_420 under combatSmall. I make sure my name is surrounded by quotation marks, then a colon, then a number, which ends with a comma. I make sure all the { and } are closed and not putting red lines everywhere, save, then back out. Note: if you're copying from me, you don't need any of the other variants or shiprole classes in there, just your own. Just make sure that the { and }'s are all closed.
Now the game will spawn XIV_noscope_420 in the Sindrian Diktat's fleets, and with the hull system set to blare Snoop Dogg's 'Gin and Juice' everytime it's activated, I'm sure this is going to be an MLG sort of playthrough. What's more, it will now also spawn more regularly in their markets, as it also shows up in their fleets, truly dankifying the Starsector experience.
I hope this has been useful and not too complicated - it's not hard to now go back and change / tweak / alter / make your own things to your heart's content, and unsurreptitiously insert your ship into your Starsector game. I'm almost certain more experienced and eagle-eyed modders will give better and more in-depth advice, but hopefully this helps you out.