Actions

Difference between revisions of "Guide (Modding)"

From Unofficial Stationeers Wiki

(File Structure: - GameData not Gamedata - specific to Linux)
m (adding links to 'File Structure' section from 'Building & Uploading To Workshop')
 
(3 intermediate revisions by the same user not shown)
Line 191: Line 191:
 
     <Value>Four à Arc</Value>
 
     <Value>Four à Arc</Value>
 
</Record></pre></blockquote></div>
 
</Record></pre></blockquote></div>
 +
 +
== Building & Uploading To Workshop ==
 +
The a reliable way to upload a mod to the workshop is upload it via the game client in the "Workshop" menu.
 +
Below are some steps to follow to build and upload your mod to the workshop.
 +
 +
'''Before you upload to the workshop it is best you check you have the correct structure of mods folder for your installation, see section [[Guide_(Modding)#File_Structure|File Structure]] above.'''
 +
 +
First: you need to make a folder that is going to contain your mod.
 +
It path to it should look similar to this for Windows users: <code>%userprofile%\documents\my games\stationeers\mods\Mod Name</code>
 +
 +
Second: you need to fill out the folder following the correct structure, see section [[Guide_(Modding)#File_Structure|File Structure]] above.
 +
 +
Third: load the game and enter the Workshop Mods menu from the '''Workshop''' button at the main menu.
 +
You should find your you mod listed there without the <code>[Workshop]</code> prefix
 +
 +
Forth: Test you mod and make any further changes you need to until you have the final version that you want to use to upload and make public.
 +
You may need to restart the game after each change to the mod files for them to show in the game.
 +
 +
Fifth and final step:
 +
# Go back into '''Workshop Mods''' menu via the '''Workshop''' button at the main menu.
 +
# Select your mod listed there without the <code>[Workshop]</code> prefix
 +
# You should be provided with a single button called '''Publish''', Press this once, depending on how big your mod it and the upload speed of your internet connection it can take some time. There is currently not a progress indicator.
 +
# Your mod should be fully uploaded and it's initial Workshop page will be created when another mod is added to the list with the prefix of <code>[Workshop]</code> and the name of your mod.
 +
# Done, Don't forget to disable the local version of your mod(it will be the one without the prefix of <code>[Workshop]</code>), you do not want it loaded two times!
 +
# (Optional) If you want to view and/or edit the workshop page you can get to it via selecting the '''Workshop Page''' button of you mod that you uploaded, again it should be prefixed with <code>[Workshop]</code> and finish with the name of your mod.

Latest revision as of 20:20, 4 February 2024

Stationeers allows players to mod the game in a variety of ways using only a text editor and (semi-optionally) an image editor. Moddable features include starting equipment, world conditions, and item recipes. On this page we will demonstrate how easy it is to make changes to the game.

File Structure[edit]

To be recognized as valid, a mod must follow a particular file structure. The game provides an example of this file structure with a helpful readme at [Installation Location]/Stationeers\rocketstation_Data\StreamingAssets\ExampleMod.zip. This reveals the following structure (some text copied from the readme):

  • [Mod Name]\ — named after the mod, contains all the mod files
    • About\ — Contains descriptive information about the mod.
      • About.xml — Your mod meta-data used when uploaded to the workshop and when displaying your mod in the workshop menu.
      • Preview.png — Preview image of your mod used in the in-game mod browser.
      • thumb.png — Preview image of your mod used in the Steam Workshop. MUST BE BELOW 1MB OR UPLOAD WILL FAIL.
    • GameData/ — A directory to contain the files that change the game.
      • Language/ — Contains localization files for representing strings in various languages.
        • english.xml — Maps any additional string variables you use into English.
        • [Other Languages].xml — Maps string variables into other languages you might like to support.
      • [Modded Files].xml — Various XML files to overwrite portions of the game's defaults.

Your mods must be placed in Stationeer's mods folder, which on Windows is located at [User directory]\Documents\My Games\Stationeers\mods\. If you find the Stationeers directory but it doesn't contain a mods directory, you must create one. Once there, your mod should appear in the mods section of the Stationeers menu. Ensure that it is listed above the core game in the loading order. To quickly make and test changes to your mod, you needn't restart the game; instead, you can go to the mods section of the main menu and shuffle their order around. This will cause the game to reload all of the mods.

About Files[edit]

You must provide three files in the About/ directory for your mod to work. The two images are used in the Workshop and in-game mod menu; if you don't want to bother with these, you can just copy the generic images from the example mod. The file About.xml requires slightly more customization. The best way to do this is to copy the example mod file (reproduced below) and edit the fields with a text editor: you will need to set the mod name, author name, version number, and a short description of the mod.

The example mod metadata file "About.xml":
<?xml version="1.0" encoding="utf-8"?>
<ModMetadata xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
  <Name>StationeersExampleMod</Name>
  <Author>You!</Author>
  <Version>0.123456.78</Version>
  <Description>This mod serves to demonstrate the correct format of a custom mod folder for Stationeers.</Description>
</ModMetadata>

Game Data Files[edit]

This is where the real work of the mod takes place. Each xml file in this directory, upon loading, writes (potentially overwriting) the game data. The default data is found in [Installation Location]/Stationeers\rocketstation_Data\StreamingAssets\Data\, and currently contains 27 xml files, each of which may be modded. These are as follows, with files that may be of particular interest to modders in bold.

File Purpose
advancedFurnace Defines the recipes for the Advanced Furnace
arcfurnace Defines the time, energy, and products of smelting ingots in the Arc Furnace.
atmospherepresets Defines default atmospheric properties for the moon and Mars. Possibly deprecated? For modding, use worldsettings instead.
autolathe Defines the time, energy, and recipes for items in the Autolathe.
centrifuge Defines the time required and products of processing ore in the Centrifuge.
chemistry Defines the time required and recipes for items from the Chemistry Station.
cooking Defines the time, energy, and recipes for items in the Microwave.
customtraders Defines new traders for the trading system. This file has no entries by default, but contains a commented-out example for modders.
DynamicObjectsFabricator Defines the recipes for dynamic objects, which currently is a very small set.
electronics Defines the time, energy, and recipes for items in the Electronics Printer.
fabricator Defines the time, energy, and recipes for items in the Fabricator.
furnace Defines the required reagents, pressure range, and temperature range for smelting in the Furnace.
gascanisters Defines recipes for creating various gas canisters, but it is unclear where these are used. Possibly deprecated?
ingots Defines a mapping of resource types to their respective ingots. It isn't clear what happens if this is modded.
mineables Defines a list of mineable ores to generate in the world, with their rarity (but larger means more ore), vein sizes, etc. Usually, this is overridden in worldsettings: possibly deprecated?
organicsprinter Defines the time, energy, and recipes for items in the Organics Printer.
paintmixer Defines the time, energy, and recipes for items in the Paint Mixer.
paints Defines alternative paint recipes in the Tool Manufactory. Presumably this is a placeholder while until the developers are happy with the paintmixer system?
PipeBender Defines the time, energy, and recipes for items in the Hydraulic Pipe Bender.
reagentgrinder Defines the time and recipes for items in the Reagent Processor
recycling While this appears to relate to the Recycler, the file contains no entries. Possibly deprecated?
security Defines the time, energy, and recipes for items in the Security Printer
startconditions Defines the starting equipment at the beginning of the game, separated out by starting race.
terraingenerationpresets Defines default terrain features. For modding, probably use worldsettings instead.
toolmanufacturer Defines the time, energy, and recipes for items in the Tool Manufactory.
tradeables Defines the value of items in the trading system.
worldsettings Defines the atmospheric, terrain, and lighting properties (and much more) of worlds and allows the definition of new worlds.

Examples[edit]

World Conditions[edit]

Suppose you wish to make Mars more friendly to humans, by adding more oxygen and increasing the temperature. To do this, you can copy the example mod, change the name and description in About.xml, and delete the example entries in the GameData directory. Next, copy over the default worldsettings file into your mod and delete all of the planets except Mars (the planet we intend to modify). To change the atmosphere composition, locate the <AtmosphereComposition> tags, and increasing the <Quantity> of Oxygen to say, 20. If you want, you could also eliminate pollutants by deleting that entire <SpawnGas> section. To increase the temperature, find the <Kelvin> tags and adjust the <value> entries upward. Note that atmospheric temperature is defined by a set of fixed points to interpolate between; time is measured from 0 (dawn) to 1 (immediately before the subsequent dawn), with noon at 0.25 and midnight at 0.75.

The relevant sections of the code are as follows (click expand on the right):
    <AtmosphereComposition>
      <SpawnGas>
        <Type>CarbonDioxide</Type>
        <Quantity>8.656</Quantity>
        <Name>CarbonDioxide</Name>
      </SpawnGas>
      <SpawnGas>
        <Type>Nitrogen</Type>
        <Quantity>0.27</Quantity>
        <Name>Nitrogen</Name>
      </SpawnGas>
      <SpawnGas>
        <Type>Oxygen</Type>
        <Quantity>20</Quantity>
        <Name>Oxygen</Name>
      </SpawnGas>
      <SpawnGas>
        <Type>Pollutant</Type>
        <Quantity>0.05839586</Quantity>
        <Name>Pollutant</Name>
      </SpawnGas>
    </AtmosphereComposition>

    <Kelvin>
        <keys>
          <Keyframe>
            <time>0</time>
            <value>288.15</value>
            <inTangent>60</inTangent>
            <outTangent>60</outTangent>
            <tangentMode>34</tangentMode>
          </Keyframe>
          <Keyframe>
            <time>0.25</time>
            <value>293.15</value>
            <inTangent>-10</inTangent>
            <outTangent>-10</outTangent>
            <tangentMode>34</tangentMode>
          </Keyframe>
          <Keyframe>
            <time>0.5</time>
            <value>288.15</value>
            <inTangent>-192</inTangent>
            <outTangent>-192</outTangent>
            <tangentMode>34</tangentMode>
          </Keyframe>
          <Keyframe>
            <time>0.75</time>
            <value>278.15</value>
            <inTangent>10</inTangent>
            <outTangent>10</outTangent>
            <tangentMode>34</tangentMode>
          </Keyframe>
          <Keyframe>
            <time>1</time>
            <value>288.15</value>
            <inTangent>324</inTangent>
            <outTangent>324</outTangent>
            <tangentMode>34</tangentMode>
          </Keyframe>
        </keys>
        <preWrapMode>ClampForever</preWrapMode>
        <postWrapMode>ClampForever</postWrapMode>
    </Kelvin>    


Item Costs[edit]

For a second example, suppose you really like the Stationary Battery, but you hate having to make steel before you can produce them. You wish for them to cost no steel, but for balance you want them to cost more copper instead. To do this, copy the electronics.xml file into your mod Gamedata directory, and delete all the RecipeData entries except for ItemKitBattery (the recipe we want to modify). Then, adjust the cost entries directly.

The entire resulting file then looks like this (click expand on the right):
<?xml version="1.0" encoding="utf-8"?>
<GameData xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
  <ElectronicsPrinterRecipes>
    <RecipeData>
      <PrefabName>ItemKitBattery</PrefabName>
      <Recipe>
        <Time>5</Time>
        <Energy>100</Energy>
        <Iron>0</Iron>
        <Gold>20</Gold>
        <Carbon>0</Carbon>
        <Copper>40</Copper>
        <Steel>0</Steel>
        <Uranium>0</Uranium>       
        <Hydrocarbon>0</Hydrocarbon>
      </Recipe>    
    </RecipeData>  
  </ElectronicsPrinterRecipes>
</GameData>

Localization Files[edit]

These are a large list of "Key" and "Value" entries for translating internal strings to the appropriate language. In modding, you will only need to localize strings that you define yourself; this comes up most often in creating new planets, as the "Name" and "Description" fields both define such strings. You only need to do this for languages you intend to support. To generate this file for a mod, it is probably easiest to copy the existing default localization file, delete all the entries, and then add back in entries for your new string. To understand how localization works, here are examples for the constructed Arc Furnace (internal name "StructureArcFurnace") in two languages:

English:
<Record>
    <Key>StructureArcFurnace</Key>
    <Value>Arc Furnace</Value>
</Record>
French:
<Record>
    <Key>StructureArcFurnace</Key>
    <Value>Four à Arc</Value>
</Record>

Building & Uploading To Workshop[edit]

The a reliable way to upload a mod to the workshop is upload it via the game client in the "Workshop" menu. Below are some steps to follow to build and upload your mod to the workshop.

Before you upload to the workshop it is best you check you have the correct structure of mods folder for your installation, see section File Structure above.

First: you need to make a folder that is going to contain your mod. It path to it should look similar to this for Windows users: %userprofile%\documents\my games\stationeers\mods\Mod Name

Second: you need to fill out the folder following the correct structure, see section File Structure above.

Third: load the game and enter the Workshop Mods menu from the Workshop button at the main menu. You should find your you mod listed there without the [Workshop] prefix

Forth: Test you mod and make any further changes you need to until you have the final version that you want to use to upload and make public. You may need to restart the game after each change to the mod files for them to show in the game.

Fifth and final step:

  1. Go back into Workshop Mods menu via the Workshop button at the main menu.
  2. Select your mod listed there without the [Workshop] prefix
  3. You should be provided with a single button called Publish, Press this once, depending on how big your mod it and the upload speed of your internet connection it can take some time. There is currently not a progress indicator.
  4. Your mod should be fully uploaded and it's initial Workshop page will be created when another mod is added to the list with the prefix of [Workshop] and the name of your mod.
  5. Done, Don't forget to disable the local version of your mod(it will be the one without the prefix of [Workshop]), you do not want it loaded two times!
  6. (Optional) If you want to view and/or edit the workshop page you can get to it via selecting the Workshop Page button of you mod that you uploaded, again it should be prefixed with [Workshop] and finish with the name of your mod.