SBC File Modding

From Space Engineers Wiki
Jump to navigation Jump to search

Community members can create and share game modifications. Basic programming knowledge of mark-up languages is required.

This summary here is quite abbreviated. The best way to learn is to ask community members about the SE API (application programmable interface) in the modding channel in the Keen Discord.

What are SBC files

Modding SBC files means editing text files written in XML language; XML is human-readable and easy to learn. If you don't have much experience with XML yet, read this XML tutorial first: https://www.w3schools.com/xml/

In the SE game directory under SpaceEngineers\Content\Data\, there are files with .SBC suffix.
C:\Program Files (x86)\Steam\steamapps\common\SpaceEngineers\Content\Data\ SBC files define game rules! Don't edit the game files, these changes would be overwritten by the next update.

How to mod SBC files

To create a working mod, you need to create new files that mirror the game's directory and file structure. If you copy SBC files into a mod and edit them, your modded files override the equivalent rules in the \Content\Data\ files in a saved game after loading.

  1. In Windows Explorer, go to the directory
    %APPDATA%\SpaceEngineers\Mods\
  2. Create a new folder structure under it:
    • %APPDATA%\SpaceEngineers\Mods\YOUR_MOD_NAME\
    • %APPDATA%\SpaceEngineers\Mods\YOUR_MOD_NAME\Data\

The general procedure is:

  1. Go to SpaceEngineers\Content\Data.
  2. Find the SBC files that define the rules that you want to edit.
  3. Copy(!) these files to your %APPDATA%\SpaceEngineers\Mods\YOUR_MOD_NAME\Data folder.
  4. Open each copied SBC file in a text editor such as NotePad++.
  5. Edit the human-readable values in the copied SBC and save.

Now your mod appears as a local mod on the World Settings screen.

Where multimedia files are stored

In addition to modding data, for some blocks, you can also mod multimedia such as sounds and textures. To do that, create the following directory structure to store these files in your mod:

  • (required) %APPDATA%\SpaceEngineers\Mods\YOUR_MOD_NAME\Data
  • (optional) %APPDATA%\SpaceEngineers\Mods\YOUR_MOD_NAME\Audio\
  • (optional) %APPDATA%\SpaceEngineers\Mods\YOUR_MOD_NAME\Models\
  • (optional) %APPDATA%\SpaceEngineers\Mods\YOUR_MOD_NAME\Textures\

Example

Q: How do I know which SBC contains which game rules? Which lines should I edit? Which values are accepted?

A: Very valid questions, we players don't know any of that.

At first, you just find and copy existing patterns: Use a text editor such as NotePad++ and do a full text search on a directory; search for item or block names to learn from examples.

For example, you want to mod solar panels so they produce more power. You search the directory SteamLibrary\steamapps\common\SpaceEngineers\Content\Data\CubeBlocks for the word "Solar". You find CubeBlocks_Energy.sbc and CubeBlocks_DecorativePack3.sbc which talk a lot about solar panels. You guess that one file contains the vanilla solar panels and the second the DLC. Copy them into your mod folder as described above.

In NotePad++, look carefully at the XML structure inside your copy of the SBC file. From the inner structure, you remove all block definitions that you are not interested in. You leave only the XML definitions of solar panels that you want to mod.

Save the files and add your (half-finished) mod to a game's World Settings to test it. If you placed the files correctly, the mod automatically appears as an available local mod in the list.

If loads on solar panels still work, make your modifications. For example, to mod the power, you make a text search for the word power and you find: < MaxPowerOutput>0.16</MaxPowerOutput> Bingo. You change only the `0.16` value and leave the rest as is. You don't know which values are accepted by Keen: should you enter 1, 100000, -27? Try it with a similar number first, in the case of 0.16, try 0.32.

Sometimes the value is the path to a multimedia file: a model, image, or sound. Follow the path, and copy that file as well. This requires recreating its directory structure in your mod folder as well. Then mod the multimedia file in a 3D model editor, an image editor, or sound editor. This part is much harder since it only works if you save it exactly in Keen's format. Ask on Keen's discord for details and recommended editors and plugins. Modding text and numbers is easier.

Tip: Sometimes you don't find a block because it's called differently in the source files than in the user interface. Look for the localisation file that reveals the true internal names to look for.