Downpour Reference/Mod Directories
Each mod in Downpour is stored as a subfolder inside the RainWorld_Data/StreamingAssets/mods
directory. This subfolder contains all metadata, file modifications and overrides, assets, and code modules (DLL files) that define the mod's contents and functionality.
ModInfo JSON[edit source]
Each mod should have a modinfo.json
file included in the top level directory of the mod. This JSON file defines the metadata for the mod, mainly the information that will be displayed for that mod within the REMIX menu. The following key-value pairs exist for this JSON file:
Key | Meaning |
---|---|
id | This is a unique string identifier for this mod. This identifier should never be changed. Recommended to be a lower-case string with no spaces. Other mods will reference this ID to refer to your mod, such as when listing mod requirements. |
name | This is the title of your mod that will be shown and listed in the REMIX menu. |
version | This is a string specifying the current version number of your mod. |
target_game_version | The version number of Rain World this mod was made for. Note that this must start with a "v". (The current game version can be found in RainWorld_Data/StreamingAssets/GameVersion.txt )
|
authors | A string listing the authors of the mod. The <LINE> keyword can be used to add a breakline. If the authors string is too long to be displayed directly, it will be converted to a credits roll in the REMIX menu. |
description | A longer description of the functionality of the mod, to be displayed in the REMIX menu. The <LINE> keyword can be used to add a breakline. |
youtube_trailer_id | Optionally, specify the ID for a YouTube video to associate with this mod as a preview trailer. The ID is the text after ?v= in a YouTube video URL. |
requirements | An array of strings specifying other mods which must be installed to use this mod. Each string in the array should match the id key of the required mod. |
requirements_names | A parallel array to the "requirements" array, which you can use to display more user friendly names for the requirements in the REMIX menu rather than displaying their internal id string. |
tags | An array of strings specifying the Steam Workshop tags which will be added to this mod. These should match the tags listed on the game's workshop page. |
checksum_override_version | An optional boolean parameter. If false, or omitted, the mod will be considered "updated" if changes are found to any files in the mod's folder. If true, the mod will only be considered "updated" if the value of the version parameter changes. (See additional notes in the next section below) |
An example modinfo.json file contents:
{
"id": "testmod",
"name": "Test Mod",
"version": "1.0",
"target_game_version": "v1.5",
"authors": "AndrewFM",
"description": "This mod does something interesting, probably!",
"youtube_trailer_id": "u-cuf39rK8g",
"requirements": ["bestmod", "vrmod"],
"requirements_names": ["That Other Mod", "Virtual Reality Support"],
"tags": ["Game Mechanics"],
"checksum_override_version": false
}
In addition to the modinfo.json file, the mod directory can also include a thumbnail.png image to be displayed in the REMIX menu. This should be an image with 16:9 aspect ratio, recommended to be at least 640x360 pixels large. Additionally, the file size of this thumbnail image should remain below 1 MB.
Checksum Override[edit source]
Note that the "checksum_override_version" flag can also be useful during development of your mod when file changes will be frequent. This will suppress the checksum validation and prevent the normal workflow of resolving file changes, merges, and mod conflicts, which can save you time when relaunching the game and/or enabling your mod. However, it is recommended to turn this flag back off before distributing your mod. If you leave it enabled and forget to update your mod's version before distributing the update, it may break your mod for people who already had it installed and enabled, as it will suppress the default update resolution workflow.
Overwriting Files[edit source]
The contents of the mod folder are a mirror of the StreamingAssets folder. For example, if you wanted your mod to replace the image file at:
"Assets/StreamingAssets/futile/resources/illustrations/maintitle.png"
with a different image, you would place the new image at:
"your-mod-folder/futile/resources/illustrations/maintitle.png"
Since the directory structure and file name match one of the original game's files, the game will use the version from your mod directory instead of the original version of the file, whenever your mod is enabled.
In some cases files outside the StreamingAssets folder can be modified as well. For example to modify sound effects (Assets/LoadedSoundEffects) your folder structure would be:
"your-mod-folder/futile/resources/loadedsoundeffects/..."
Or to modify music files (Assets/Music), the structure would be:
"your-mod-folder/futile/resources/music/..."
Refer to Downpour Reference/Modification Files for other ways to modify existing files other than completely overwriting their contents, for better mod compatibility.
AssetManager[edit source]
Whenever referencing any asset files from disk in your code (whether they be files from within your mod's folder, or files within the base game's folders), you should use the static utility functions offered by the AssetManager
class. This ensures the file path to the correct version of the file is used based on which mods are enabled or disabled, following the logic above.
For example:
AssetManager.ResolveFilePath("futile/resources/illustrations/maintitle.png");
This would return the file path to the vanilla maintitle.png file. However, if the example mod described in the previous section were enabled, this instead would return the file path to that mod's overwritten version of maintitle.png.
The available utility functions are:
Method | Meaning |
---|---|
ResolveFilePath(path) | Return the correct path to the given file based on enabled/disabled mods. |
ResolveDirectory(path) | Return the correct path to the given subdirectory based on enabled/disabled mods. |
ListDirectory(path) | Returns all unique files contained in all versions of the given subdirectory based on enabled/disabled mods. |
ListDirectory(path, true) | Returns all unique subdirectories contained in all versions of the given subdirectory based on enabled/disabled mods. |
To give an example of ListDirectory, consider a hypothetical vanilla directory at:
"Assets/StreamingAssets/futile/resources/example"
which contained the files "a.txt", "b.txt", and "c.txt". Then say you created a mod which included the folder:
"your-mod-folder/futile/resources/example"
which contained the files "c.txt", and "d.txt". Then when the code below is executed:
AssetManager.ListDirectory("futile/resources/example");
If your mod is disabled, the files "a.txt" (vanilla), "b.txt" (vanilla), "c.txt" (vanilla) would be returned.
If your mod is enabled, the files "a.txt" (vanilla), "b.txt" (vanilla), "c.txt" (modded), "d.txt" (modded) would be returned.