Menu

Dynamic Databases

November 2, 2016 - Modding, Tutorial
Dynamic Databases

I cannot emphasize how important it is to know this part when you’re modding Starpoint Gemini Warlords. No, really… it’s essential. If you don’t get this bit right, the mod will likely work, but only on its own. If the modded databases are setup correctly, there is no limitation on how many mods can work side-by-side. This is biggest difference between modding Starpoint Gemini 2 and Starpoint Gemini Warlords.
 
 

Tutorial overview

  1. Databases and what are they used for
  2. Editing a database
  3. Setting up a modded database properly
  4. In-game magic

 

1. Databases and what are they used for

Basically anything you want to do, change or add in Warlords, is in some way linked through a database. The databases tell the game what sound files to load, where to find ship files, what damage a weapon does and so on. You can bypass editing a database ONLY if you’re changing an existing asset that’s already linked in the default database. For example if you wanted to change a character portrait, you don’t have to edit a database. You can simply place the texture file in the corresponding folder in Mods\ModName. If the file has the same name as the original, and if the mod is set as active, then the game will use the new texture. Adding completely new things means you’ll be editing databases. It’s nothing to be feared of, as the next section will explain.

2. Editing a database

Which database you’ll have to edit depends on what you’re trying to achieve. Adding a new ship means you’ll have to add the reference to it as a new entry in the Data\Base\Ships.wdt. Adding a new sound effect is done through the Data\Base\Sound.wdt and so on.

You can simply open a .wdt (database) in the Notepad++. It’s a text file, so it won’t cause any problems. Editing it though can be a little bit tricky so our standard procedure is this:

  1. Open the .wdt file in Notepad++
  2. Copy the entire contents to clipboard
  3. Open a new spreadsheet in MS Excel or OpenOffice Calc (make sure to set all fields to Text since in some programs, the copied values could get auto-formatted into dates or something)
  4. Paste the data from the clipboard into the spreadsheet
  5. Modify the values to your heart’s desire
  6. Copy the modified data back into the .wdt file and save it

 
Adding columns is pointless, since the game won’t use them and can only get confused, so please don’t even try doing that ;).

3. Setting up a modded database properly

Here comes the second major difference in comparison to how databases were handled in Starpoint Gemini 2. The modded database only has to contain the difference. Meaning, if you’re adding a new ship through a mod, your modded Ships.wdt only has to contain that ONE entry. The game will do the rest, just make sure the KeyName is unique, or at least different from the ship keynames in the default database.

However, if you want to change a ship that already exists in the vanilla game, your modded Ships.wdt will contain only that entry. For example, the Cettia is a small gunship available in the vanilla game. It’s keyname is CETTIA. To change something about that ship in your mod, your Ships.wdt will have one entry, keynamed CETTIA. When the game is loading up your mod, it will notice you have an entry in the mod that bears the same keyname as an entry in the vanilla database. The game will use your entry.

Besides a number of other bonuses, this also makes modded databases (and mods in general) a lot easier to manage, especially over a longer period of time or through multiple mods. You no longer have to constantly update your existing mods because of some minor tweak that we did in the vanilla game. Your mods will continue to work normally, unless you actually changed that particular item that we’ve tweaked.

4. In-game magic

What are those IDs in databases for? Simply put, you can mostly ignore them, but to make things easier, use proper values. This just numbers the entries and helps the game load the database. The above examples of modded databases will both have only one Id with the value of 0.

So what exactly does the game do? Here’s the rundown:

  1. The game loads up the default databases
  2. If a mod is set to active, the game checks its files and cross-references them with the default files
  3. If any file matches by its folder and name, it uses the mod file
  4. If a database is found, the game adds the new entries dynamically to its internal database, on top of the default database
  5. If any database entry corresponds to a default entry (in the same-named database), the game uses the modded entry

 
All this means that there is only one important thing to watch out for: the database entry keynames. Make up a naming convention of your own, something that will make the chance of coinciding with another mod lesser. With this in mind, and if this simple rule is followed, you can, in theory have any number of mods work together at the same time.

Leave a Reply

Your email address will not be published. Required fields are marked *