Children of a Dead Earth

Children of a Dead Earth

Not enough ratings
Modding guide
By Echo
A guide on how to make custom mods and publish them on Steam.
   
Award
Favorite
Favorited
Unfavorite
Where to start
These are the three folders that are relevant to modders (paths are for a default Windows, Steam and game installation):
  • Core game root folder: C:\Program Files (x86)\Steam\steamapps\common\Children of a Dead Earth\Resources (do not modify anything here! – from now on: Resources);
  • Custom mods root folder: C:\Users\<username>\AppData\Roaming\CDE\Mods (this is where the fun happens; it can be found more easily with this path: %AppData%\CDE\Mods – from now on I'll omit %AppData%\ and also I’ll call this folder Mods);
  • Steam Workshop export folder: CDE\Mods\WorkshopExport (you’ll have to manually create it, but more on how to actually publish custom mods later – from now on: WorkshopExport).

While I’m on the topic, two more folders you might be interested in knowing they exist are:
  • Local COADE folder: CDE (here’s where game stores your custom designs and levels, their automatic backups, mission records and crash logs);
  • Workshop mods folder: C:\Program Files (x86)\Steam\steamapps\workshop\content\476530 (476530 is the game’s ID on Steam; each subfolder name corresponds to the ID of the mod you’re subscribed to).
First step: how to make a local mod
The basic steps to make a custom, local mod are:

1) Look inside Resources to locate the file(s) relevant to your mod (e.g. if you want to add a new alloy, the relevant file is Resources\Data\Materials\Alloys.txt – .txt is the file extension).

2) Replicate the path inside the Mods folder, creating all the subfolders and the (empty) text file(s) necessary (continuing the example from before, create a folder named Data inside Mods, then a folder named Materials inside Data, finally an empty Alloys.txt file inside Materials – that is: Mods\Data\Materials\Alloys.txt).

3) Replicate the file structure when modding. Generally speaking, new entries are separated from each other by at least one empty line, the first line on each entry consists of the entry type and the entry name separated by a space, and the properties and their values are separated by at least one tab. If you need a text editor that can show you spaces and tabs differently, I recommend Notepad++.

4) If you did things correctly, next time you boot the game you’ll see the results of your mod. If you did not, then either you won’t see it or the Infolinks will automatically open up and greet you with a loading error.
Just as a FYI, if game crashes then you probably deleted some material(s) while still having designs that use it/them (either restore the material(s) or follow this guide: https://cs2bus.com/sharedfiles/filedetails/?id=2818888613); if it freezes on load, well, the only reason I know of that would cause this is that you simultaneously are subscribed to a language mod on Steam and have the same language mod inside your Mods folder.
Second step: how to publish the mod on Steam Workshop
Once you’ve finished your mod, tested that it works, and are ready to publish it, or in case you’ve already published a mod but want to update it, the steps are:

5) Create a folder inside Mods and call it WorkshopExport.

6) Copy your modded files inside it, making sure to keep the path too (continuing the example from before, put your new material in WorkshopExport\Data\Materials\Alloys.txt).

7) Choose a preview image. It must weight less than 1 MB, and can only be .jpg, .png or .bmp. Put this image inside the Mods folder (thus just outside of WorkshopExport) and rename it Preview. This is not an optional step: your upload will be rejected if you don’t follow it to the letter.

8) If you’re publishing a new mod, skip this step. If you’re updating a mod you’ve already published in the Workshop, create a new WorkshopID.txt file inside the Mods folder. Then visit the page of the mod you want to update and grab the number at the end of the link (that’s your mod ID). Paste that into WorkshopID (alternatively, copy the entire link, paste it into the file, then get rid of everything up to ?id= included).

9) If you’re publishing a new mod, write the title and mod description in a document somewhere. If you’re updating a mod you’ve already published in the Workshop, then I highly suggest you grab the mod’s title and description and put them in a document somewhere to keep them safe (and edit them to reflect your latest changes, if necessary). A mod’s title and description get deleted when you update it.

10) Boot the game, click Infolinks → Concept → Steam Workshop → Export To Wokrshop (the button that appears on the bottom-right corner).

11) If the upload is successful, skip this step. If game complains that you need to accept the Steam Subscriber Agreement, then alt-tab out of the game and into Steam, click on your profile name on the top-left to open a drop-down menu, select Content, select the Workshop Items tab, click View Legal Agreement on the right panel, read and accept it, and finally retry exporting your mod to Steam’s Workshop.




12) Whether you are creating a new mod or updating an existing one, its visibility will be set to public. You can add (not change, because the text fields will be empty) the mod’s title and description by opening the mod page itself.
Third step: how to create a collection
13) In case you want to create a collection, here is where the button to do that is located:




And that’s it. Have fun!
Addendum: Campaigns
The in-game lever editor doesn't have an option to make fleets orbit Lagrange points. To achieve that first export the campaign (as an aside, I should point out that modules, ships and campaigns are an exception to the “replicate Resources’ path inside Mods” rule, as the path from which they get imported differs from the path they are inside Resources), then open the .txt file and Ctrl+F the fleet name. Usually there are only two instances for each fleet: one is preceded by StarterFleet, the other is at the very end of a longer line that starts with the body that the fleet orbits, then has a tab-separated 0, and then there’s the faction to which the fleet belongs (again, tab-separated). Alternatively, Ctrl+F the level name, then scroll down to Fleets and search the fleet there. Remember that 0? It indicates that the fleet truly orbits that body, and not one of its Lagrange point. Manually change it to the number of your desired Lagrange point, save the file, and next time you play that mission the fleet will orbit the body’s desired Lagrange point.

If a campaign makes use of custom modules/ships, they are exported in the same file as the campaign. You’ll find them before the levels.

If you create a new body using the level editor, you can delete it only by manually removing it from CDE\UserLevels.txt (hint: Ctrl+F CelestialBody to find it quickly). The delete button only prevents it from being a selectable body in the mission (I don't know if it'll still be considered in orbital mechanics calculations, when a ship/fleet stops stationkeeping).
Addendum: Languages
Taking the Official Chinese mod as an example,
https://cs2bus.com/sharedfiles/filedetails/?id=1251438896
depending on your language you might need to:
  • name your file in Mods\Data\Languages using English (Latin) alphabet (that's because, as English is the language you first boot the game with and the name of the languages that are shown in the in-game Options menu are the names of the .txt files in the Languages folder, you can only use the characters whose Unicode falls within the Unicode range defined in English.txt);
  • extend the Unicode range(s);
  • put at least a font in Mods\Fonts;
  • override at least one of the original fonts with (one of) your font(s);
  • optionally, replace stock Logo.png by putting a custom Logo.png image in Mods\Textures (I don't know if it'll work if the size is different; in case, use a 627x269 image; I don't know if other formats are supported, but, as you probably want transparency, .jpg don't support transparency).

I noticed a discrepancy in the number of lines between English.txt (5343) and Simplified Chinese.txt (5354), so I went hunting (for the 11 extra lines).

Lines 1-9 in English.txt:
UnicodeRanges 0020 024F 2000 206F GameTitle Children of a Dead Earth

Lines 1-13 in Simplified Chinese.txt (which shows how to increase the Unicode ranges and override fonts):
UnicodeRanges 0020 024F 2000 206F 3000 303F 3400 4DBF 4E00 9FFF FF00 FFEF FontOverride Exo-Regular.otf msyh.ttf FontOverride Akashi.ttf msyh.ttf FontOverride Titillium-Regular.otf msyh.ttf GameTitle 亡星余孤

Line 9 in English.txt corresponds to line 13 in Simplified Chinese.txt. That's an offset of +4 lines.

Lines 1607-1617 in English.txt:
RunTurn Run Turn 1m 1m 10m 10m 1h 1h 6h 6h 1D 1D 6D 6D 1M 1M Infolinks Infolinks

Lines 1611-1631 in Simplified Chinese.txt:
RunTurn 下一回合 1m 1 分钟 10m 10 分钟 1h 1 小时 6h 6 小时 1D 1天 6D 6天 1M 1月 Infolinks 信息查询

Line 1617 in English.txt corresponds to line 1631 in Simplified Chinese.txt. That's an offset of +14 lines.

Lines 3758-3762 in English.txt:
CutsceneMessage Message Message LevelMessages Talker Talker LevelMessages Message Message LevelMessages TutorialTag Tutorial Tag LevelMessages Starting Starting

Lines 3772-3773 in Simplified Chinese.txt:
CutsceneMessage Message 信息 LevelMessages Starting 开场

Line 3762 in English.txt corresponds to line 3773 in Simplified Chinese.txt. That's an offset of +11 lines. I did not check the two files line by line and Meld was uncooperative, so there might be other discrepancies in the number of the lines between the two files.

Be warned that loading the same language from Mods\Data\Languages and from the Workshop results in game being stuck loading forever (I learned it the hard way).
Addendum: Emission lines
Each entry in a spectra has two space-separated (not tab-separated) columns: the first is the wavelength in nm and the second is the transition probability in s⁻¹. Looking at the vanilla file, most entries have a third column, but I don't know what it does.
Addendum: Elements
To be valid (i.e. appear in Infolinks as an element and be usable in a material without game crashing), the minimum properties an element must have are:
  • Symbol;
  • MolarMass_g__mol.

Some element's properties influence the automatically calculated cost of a material. The identified ones are (but there could be more):
  • atomic weight: the lower, the costlier (that's a reason why hydrogen costs more than deuterium);
  • element solar abundance: the lower, the costlier;
  • transmutation parent: the longer the chain of parents, the costlier.
Addendum: Refraction indices
Each spectra can have either one or two sections, labeled 'n' and 'k':
  • n denotes the refractive index, which changes the material's color if the material is solid (if it's a fluid, it does nothing);
  • k denotes the extinction coefficient, which changes the visuals pertaining to a rocket's exhaust plume and propellant vented from a ruptured tank if the material is a fluid (if it's a solid, it does nothing).

For both sections, each entry has two space-separated (not tab-separated) columns: the first is the wavelength in mm and the second is the index. Inside the same section, the entries must be ordered by increasing wavelength because:
  • the index of wavelengths lower than the first entry is the index of the first entry;
  • the index of wavelengths between two consecutively-defined entries is the linear progression between the indices of those entries;
  • the index of wavelengths higher than the last entry is the index of the last entry.

If a section is missing, then the index pertaining to that section will be 0 for all the wavelengths.
Addendum: Materials
To be a valid solid (i.e. appear in Infolinks as either metal or nonmetal), the minimum properties a material must have are:
  • Elements: at least one entry, all entries must be valid;
  • ElementCount: must have as many entries as there are in Elements (if an element is repeated multiple times, each repetition must have its element count too);
  • Density_kg__m3.

Some material's properties influence the automatically calculated cost of a solid material. The identified ones (there could be more) are:
  • type and quantity of the elements that constitute it (see "Addendum: Elements");
  • flags: IsABiomaterial (decreases the cost), IsFibrous, IsPorous, IsNanostructured (increases the cost) - IsFibrous and IsPorous increase the cost only if there are at least two, not necessarily different, elements defined (e.g. C 0.5 C 0.5 - that's a reason why boron filament is so cheap compared to RCC);
  • melting point: the higher, the costlier;
  • magnetic properties.

To be a valid fluid (i.e. appear in Infolinks as a fluid), the minimum properties a material must have in addition to those of a valid solid are:
  • MeltingPoint_K;
  • BoilingPoint_K;
  • SpecificHeat_J__kg_K;
  • ThermalConductivity_W__m_K;
  • Viscosity_Pa_s.

Some material's properties influence the automatically calculated cost of a fluid material. The identified ones (there could be more) are:
  • type and quantity of the elements that constitute it (see "Addendum: Elements");
  • melting point: the higher, the costlier;
  • boiling point: the higher, the costlier.

Regarding ElementCount:
  • an increase in number of atoms causes an increase in gamma radiation shielding and a reduction of the ablation cap (which means the material will be more resistant to lasers);
  • if the material is a fissile (Fissiles.txt), the ElementCount of the fissile element should be 1, otherwise the depleted version of the fissile material will disappear from the reactor's mass and cost pie charts (the ElementCount of all other elements should be tuned accordingly);
  • if the material is a radionuclide (Radionuclides.txt), the ElementCount of the radioisotopic element should be 1, otherwise the radioactive decay specific power of the material will be changed (for some reason, an increase in the ElementCount of the radioisotopic element causes a decrease of radioactive decay specific power; the ElementCount of all other elements should be tuned accordingly).

Given the above, I highly suggest to:
  • if the material is a solid that doesn't have either the IsFibrous or IsPorous flags, and that is not present in Fissiles.txt, Radionuclides.txt, ChemicalReactions.txt and/or FusionReactions.txt, then set the ElementCount of each element to its count ratio, so that the sum of all ElementCount is 1 (e.g. Boron Carbide: B₄C → B 0.8 C 0.2);
  • if the material is a solid that has the IsFibrous and/or IsPorous flags, and that is not present in Fissiles.txt, Radionuclides.txt, ChemicalReactions.txt and/or FusionReactions.txt, then make sure there are at least two elements and set the ElementCount of each element to its count ratio, so that the sum of all ElementCount is 1 (e.g. Boron Filament: B → B 0.5 B 0.5);
  • if the material contains a fissile element but not its depleted isotope, then set the ElementCount of the fissile element to 1 and the ElementCount of all other elements to their count ratio relative to the fissile element (e.g. Triuranium Octoxide: ²³⁵U₃O₈ → U-235 1 O 2.6667);
  • if the material contains both a fissile element and its depleted isotope, then set the ElementCount of the fissile element and its depleted isotope to their count ratio relative to each other, so that the sum of their ElementCount is 1, and the ElementCount of all other elements to their count ratio relative to the sum of the fissile and depleted element's ElementCount (e.g. Depleted Triuranium Octoxide: U₃O₈ → U-238 0.997 U-235 0.003 O 2.6667);
  • if the material contains a radioisotopic element, then set the ElementCount of the radioisotopic element to 1 and the ElementCount of all other elements to their count ratio relative to the radioisotopic element (e.g. Strontium-90 Titanate: ⁹⁰SrTiO₃ → Sr-90 1 Ti 1 O 3);
  • in all other cases, set ElementCount to the actual number of atoms in the molecule.

A material's automatically calculated cost can be overwritten by Cost_c__kg (a material property that none of the vanilla materials use).

To be a valid gas composition for a laser's arc lamp, all the following conditions must be true:
  • the element is valid;
  • the element's Emission property is defined;
  • the material is a valid fluid;
  • the material's Elements property has a single entry (a material that has the same element repeated two times is not a valid arc lamp gas);
  • the material's ElementCount property has a single entry and this entry is 1 (combined with the above, it means that the material must be monatomic; a material whose elements and elements count are e.g. H 0.5 H 0.5 is not a valid arc lamp gas).

Certain materials can go only in certain files (e.g. Human in Paints.txt), and won't work if you misplace them. Once you're done editing your material(s), especially if you plan on releasing the mod, I recommend to boot the game, check that everything works as intended, exit the game, and check your CDE\Crashes folder. If there are no crash logs relative to your latest session, then great; otherwise, open the crash log and search for an entry that looks like:
Loading Crystals...Ensure at \mac\home\documents\code\utilities\utilities\reflection\simpleserializationmanager.cpp(183): Replaced Datum "Borosilicate Glass" of Material. 0
Where instead of "Borosilicate Glass" you find the misplaced material and instead of "Crystals" you find the file in which you should have put that material to begin with. I've seen this error appear both for materials that should have been in Crystals.txt and for materials that should have been in Organic Compounds.txt. Once you fix the ones that the crash log shows you, boot the game, exit it, and check again CDE\Crashes folder: crash logs only show one material (per file?) at a time, therefore, depending on how many misplaced materials you have, you'll have to repeat the process till no new crash logs are generated (or at least, till there are no more errors caused by the materials you're modding).

It is possible to export a spreadsheet that contains (most of) the properties of all materials in your COADE installation (vanilla + local mods + Workshop mods; i.e. all the materials that are loaded when you boot the game). To do so, visit your Steam's Library, right-click either the game on the left panel or its card in the center, click "Properties...", then General, and under the Launch Options write or paste the following:
PrintMaterials
Boot the game, it will close while loading but Steam will tell you it's still running, let it do its things and wait till it fully shuts down on its own (i.e. the button shows "Play" again). Don't forcibly close it yourself. You can now remove PrintMaterials from the Launch Options. The materials and (most of) their properties will be exported to CDE\PrintedMaterials.csv.
Addendum: Textures
Loading a custom texture might be as easy as placing an image inside Mods\Textures and renaming it appropriately (.png and .jpg formats are known to work), or might require you to change its resolution to be the same as the vanilla texture. For example, if two people use the same image it might work for one of them but not for the other. The reason for this is as of yet unknown (it might be caused by the different hardware being used).

In case you have to change the resolution of an image, you can do it either with a method that is simple but that will stretch and crop the image if the aspect ratios are different, or with a method that requires more steps but that will neither stretch nor crop the image. I'll provide instructions for doing both methods with Krita, but you can use whatever image editing software you want.

Make a copy of the image you want to edit, put the copy inside Mods\Textures (the other one will be your backup), rename it appropriately, open it in Krita, then:

Simple method:
  1. Image → Scale Image To New Size... (hotkey: Ctrl+Alt+I)
    1. Constrain proportions: No.
    2. Set Width to the width of the vanilla image.
    3. Set Height to the height of the vanilla image.
    4. Click OK.
  2. File → Export...
    1. Set the extension to jpg or png (jpg images don't support transparency; other extensions might work, but I haven't tested).
    2. Click Save.
    3. If the extension you chose is the same as the original, click Yes to overwrite the image you're editing.
    4. Then:
      • If the extension you chose is jpg:
        1. Click the colored rectangle next to "Transparent pixel fill color":
          1. Set your desired values for Red, Green and Blue.
          2. Click OK.
      • If the extension you chose is png and you don't want to keep the transparency:
        1. Store alpha channel (transparency): No.
        2. Click the colored rectangle next to "Transparent color":
          1. Set your desired values for Red, Green and Blue.
          2. Click OK.
      • If the extension you chose is png and you want to keep the transparency:
        1. Store alpha channel (transparency): Yes.
    5. Click OK.
  3. Exit Krita.
  4. If the extension you chose is different than the original, delete the copy of the original that you put inside Mods\Textures.

Long method:
  1. Image → Scale Image To New Size... (hotkey: Ctrl+Alt+I)
    1. Constrain proportions: Yes.
    2. If your screen's width · the height of the vanilla image / the width of the vanilla image ≤ your screen's height set Width to your screen's width, otherwise set Height to your screen's height.
    3. Click OK.
  2. Image → Resize Canvas... (hotkey: Ctrl+Alt+C)
    1. Constrain proportions: No.
    2. Set Width to your screen's width.
    3. Set Height to your screen's height.
    4. Anchor: in the 3x3 box, click the one in the middle.
    5. Click OK.
  3. Image → Scale Image To New Size... (hotkey: Ctrl+Alt+I)
    1. Constrain proportions: Yes.
    2. Set Width to the width of the vanilla image.
    3. If Height > the height of the vanilla image set Height to the height of the vanilla image (don't change the Width back).
    4. Write down the Width and Height displayed in the window.
    5. Click Cancel.
  4. Keeping an eye on the file's name (either on the top-left or top of your screen), press and keep pressing Ctrl+Z till the '*' at the end of the name goes away.
  5. Image → Scale Image To New Size... (hotkey: Ctrl+Alt+I)
    1. Constrain proportions: Yes.
    2. Set Width to the width you wrote down.
    3. If Height > the height you wrote down set Height to the height you wrote down (don't change the Width back).
    4. Click OK.
  6. Image → Resize Canvas... (hotkey: Ctrl+Alt+C)
    1. Constrain proportions: No.
    2. Set Width to the width of the vanilla image.
    3. Set Height to the height of the vanilla image.
    4. Anchor: in the 3x3 box, click the one in the middle.
    5. Click OK.
  7. File → Export...
    1. Set the extension to jpg or png (jpg images don't support transparency; other extensions might work, but I haven't tested).
    2. Click Save.
    3. If the extension you chose is the same as the original, click Yes to overwrite the image you're editing.
    4. Then:
      • If the extension you chose is jpg:
        1. Click the colored rectangle next to "Transparent pixel fill color":
          1. Set your desired values for Red, Green and Blue.
          2. Click OK.
      • If the extension you chose is png and you don't want to keep the transparency:
        1. Store alpha channel (transparency): No.
        2. Click the colored rectangle next to "Transparent color":
          1. Set your desired values for Red, Green and Blue.
          2. Click OK.
      • If the extension you chose is png and you want to keep the transparency:
        1. Store alpha channel (transparency): Yes.
    5. Click OK.
  8. Exit Krita.
  9. If the extension you chose is different than the original, delete the copy of the original that you put inside Mods\Textures.
2 Comments
Echo  [author] 10 Sep, 2023 @ 10:07am 
You're welcome!
Killerbannana_1 9 Sep, 2023 @ 8:41pm 
Massive help to getting my texture and paint armor mod to work, thank you bro.