For editing savegames of BotF, UltimateEditor of DCER is a helpful tool. It already has some internal capabilities to edit savegames, but alot of functionality is only available by hexediting. Therefore the UltimateEditor has a compfortable menu to extract (and import) files of (or into) a savegame. If you want to extract them manually, you will have to decompress them using the BotF LZSS Algorithm.
To get an Overview about the content of all those files within a savegame, have a look at the Savegame File-Listing!
Moving existing ships on map is easy! You just have to edit GTForceList and GWTForce and adjust the sector row and sector column.
Adding/Removing Ships and Fleets
Adding or removing ships is alot more complicated.
Each ship belongs to a specific fleet/taskforce and each fleet belongs to a race. So you see that with adding or removing ships, you also need to work on the fleets!
Adjusting the Ship Number
First, the files GShipHead, GTForceHd and GWTForceHd have to contain the new ship count. Their value should be the same.
Adding/Removing the Ships
To add or remove ships, you have to add or remove entries in GShipList.
Cause they are stored in blocks of fixed size, you can simply adjust the view width of your hexeditor to have one ship each row. All important values are described in Savegame File-Listing#GShipList.
When adding new ships, you have to care about that you don't choose shipIDs that are already in use. In later turns you might wonder about double entries. But you simply can discard all ship entries above the number stored within GShipHead.
Important is the fleetID, cause each ship needs to be assigned to an existing fleet.
Adjusting the Taskforces
In GTForceList and GWTForce each ship gets assigned to a taskforce. GTForce seems to be reffering to current turn and GWTForce to the next turn. You can simply keep them equal. Again they are stored in blocks of fixed size. The only really important thing is that you keep care of the fleetIDs and shipIDs. Each fleet can contain nine ships and their IDs have to match GShipList.
For each race there is an alienTFInfo file with the decimal raceID as postfix. These files first contain the number of taskforces of the corresponding race, followed by the corresponding fleetIDs.
For the alienTFInfo files this is an easy adjustment.
The races are in same order as shown in UltimateEditor.
Adjusting the ID counters
Whenever a ship is build or a fleet created, BotF generates an ID for it. For not using the same one twice, it has a counter that gets increased everytime. For the fleetIDs it's stored within TForceCntr and for the shipIDs in ShipCntr. For preventing bugs and crashes, it has to be above the highest ID currently in use. However, cause the used data type is limited, it's best to keep it as low as possible to prevent buffer overflows.
The shipnames are given iteratively with an increasing counter for the postfix. Reusing same name seems to cause bugs, so you need to care of that it doesn't conflict with already existent ships! Therefore you have to edit shipname.dat when adding ships with names included in BotF shipname list within stbof.res.
shipname.dat consists of several blocks of fixed size, each representing one shipname category.
Within each block, there is a position pointer that get's computed randomly when starting a new game. It just points to the first name used within the category.
Additionally there is a second pointer to the next name to be used of that category. This pointer just gets increased whenever a new name is used of it's category and loops when the end of shipnames within that category is reached. Whenever this pointer reaches the pointer to first choosen name, a counter for the postfix gets increased.
Unfortunately, beside the category and count of ships within that category, it isn't known yet how those name pointers exactly map the name list within stbof.res. If you are unsure how to set the pointers, test it or just increase their postfix counter.
Adding/Removing ships controlled by AI isn't explored yet. Relevant files are:
Best way is to use maps without of AI.
As you can see in Savegame_File-Listing#strcInfo each star has a list of all the constructed buildings. If you want to add or remove constructed buildings, you'll have to edit this single strcInfo file, nothing more.
Each entry in this list begins with a starID. For identifying which star it is, you'd either search for it in the sector.lst file to determine the sector coordinates or in the systInfo file for determining the system name.
You may probably want to edit a specific system. This is alot more troublesome cause within the strcInfo file you have no orientation where a list element begins and where it ends. You can speculate, go by try and error, search for a point where the hexcode makes sense again or you'll have to begin reading the file with the first byte and count alot.
The way that might work best is setting the hexview width to 4 and then directly search for the starID you've determined. Everytime you've found an according value, look at the building count next to it, skip twice as many lines (8 bytes each entry), and check whether the potential starID is in line, cause all the entries are stored in line with the starID.
Say you've found the star entry you want to change.
Removing a building is most simple, just lessen the entry count and remove an entry or lessen the building count within that entry.
If you want to add a new building, first check whether it's already available. Adjust the building count if so. There shouldn't be double entries!
When adding a new entry, also just change the number of entries accordingly.
To identify which building is meant or which building type to use, compare the building type to the buildings within the building stats view of UE.
UE already sorts them by id but also tells you the id (index) of the selected building at the bottom between the arrow buttons.
You could also extract the edifice.bst file out of stbof.res, open it with your hexeditor, set the hex view width to 176 and search for the corresponding id at line-offset 73, but using UE to identify the building should work fine. :)