Distant Worlds 2

Distant Worlds 2

评价数不足
How to upload mods to the Steam Workshop
由 Baronfuming 制作
How to configure and publish your Distant Worlds 2 mod to the Steam Workshop
   
奖励
收藏
已收藏
取消收藏
Short Video Guide from the DW2 Devs
Before you do anything else, watch this video from the developers to get an idea of what the process looks like:

File Structure
I won't get into the details of how to make a mod here. There are so many different things that can be changed depending on one's technical knowledge.

First, go Steam\steamapps\common\Distant Worlds 2\mods and make sure you have a folder for your mod.
Basically, you need to have at least the following in this folder:
  • mod.json - This is very important, we will go over how to make one and the formatting of its contents in the next section.
  • Preview image - You aren't required to include one of these, but it's really for the best that you do. It will show up as the thumbnail image on both the Steam Workshop and in-game. All you need is a square .jpg image. The exact size isn't as important. What matters is that the dimensions are the same (such as 200x200 pixels).
  • .xml file or files that you are modifying - You can name them something like Races_examplemod.xml, or CharacterRooms_examplemod.xml. The underscore "_" is needed and the content after that changes the load order. At the time of writing (March 17, 2023) the order is alphabetical, so Races_A.xml is loaded first so any changes that it might make would be overwritten by Races_Z.xml from someone else. This is likely to change significantly in the future of DW2 modding though.
  • Stride asset bundle - optional, see last section.
mod.json
This file ties everything together. To create one, just make a text file and save it as mod.json in the same folder as your mod.

mod.json files will generally look like this:

{
"displayName": "Example Mod",
"description": "This is an example of what a mod.json can look like.",
"previewImage": "exampleimage.jpg",
"version": "1.0",
"bundles": [],
"workshopId": 12345678
}

There is some flexibility regarding the formatting with indents, but one might as well play it safe and keep this formatting since it works. Note that the tags on the left (such as "displayName", "previewImage" or "workshopId" are case-sensitive.

  • displayName
    - This determines what the title of your mod will appear as on the Steam Workshop
  • description
    - When you publish or update your mod, the description of the mod on the workshop page defaults to whatever you had in this section. The formatting of this area is weird though, so I suggest saving it to a separate text file instead. A better use of this section is a brief description of what your mod does, because that will show up in the mod menu in-game.
  • previewImage
    - While you don't need to have a preview image, including one will make your mod look much better. All you need is a square (equal height and width such as 200x200 pixels) .jpg image in the folder of your mod. This is just the filename of your image.
  • version
    - This shows up in the mod menu in-game. You can make it for the version of your mod (such as 1.4a), but I prefer the version of Distant Worlds 2 that the mod was created/updated for (such as 1.1.2.4) so that people can see at a glance how up to date the mod is.
  • bundles
    - If you are including a bundle with your mod, you will need to include the filename here. If your mod does not have a bundle, then you can use the closed brackets [].
  • workshopId
    - When you first publish your mod, you should leave this blank. Once your mod is published, you edit your mod.json and add the line "workshopId": # where # is the number that appears at the end of the URL for your mod:
    https://psteamcommunity.yuanyoumao.com/sharedfiles/filedetails/?id=#
    If you can't see the URL by default, ctrl+click on it.

Publish
Once you have everything in order, the next thing to do is publish your mod to the Steam Workshop.

To do this, go to you Steam\steamapps\common\Distant Worlds 2 folder, and open a command prompt. An easy way to do this is by clicking on the Windows File Explorer location bar, and typing cmd and pressing enter.


Next, type into the command prompt:
DistantWorlds2.exe --ugc-publish mods/yourmodfolder and press enter.

Now you can go ahead and upload images (though not the previewimage, which must be references in your mod.json file) and edit your description.

I highly recommend saving a copy of your description (including any formatting) to a text file. I just keep mine in the folder for that mod, sure it get uploaded with everything else, but it's a tiny file, so who cares!
Editing/Updating
Once your mod is published, you should look at the URL for your mod on the Steam Workshop.
It should look something like https://psteamcommunity.yuanyoumao.com/sharedfiles/filedetails/?id=12345678
Copy the ID number and go back to your mod.json file.

You must now add the line
"workshopId": 12345678

Now to update your mod, open the command prompt in your Distant Worlds 2 folder again.

There is supposed to be a --ugc-id command to update the mod, but I could never get it to work for me.

You can instead use DistantWorlds2.exe --ugc-publish mods/yourmodname again to update your mod.

If it makes a new workshop page instead of updating your previously-created one, double-check that your workshopId is the correct number and that the entry in your mod.json is capitalized correctly. Fix that and try again. You can delete the extra workshop page.

Hopefully you saved a copy of your description so you can just paste that in.
Modding Resources & Tools
DW2 Modding Roadmap[www.matrixgames.com] - Contains a lot of info and tools for modding.
Official DW2 discord[discord.gg] - the mods channel has a lot of information and is a good place to ask questions. You can search within this channel by using in: mods 'question'

Bundles
- I'll preface this with the warning that I haven't even begun to dip into bundles so I don't really understand this yet.
Stride Asset Bundle documentation[doc.stride3d.net]
Distant Worlds 2 Bundle Manager[github.com] - View or extract existing DW2 assets from bundles.
To use, copy the dw2bm.exe to your Distant Worlds 2 folder and run with command line.

Bundle Tool[discord.com]

4 条留言
🥷  [开发者] 2023 年 4 月 3 日 上午 9:12 
Use `dw2bt help` to figure out how to use it, the syntax is different from dw2bm.
🥷  [开发者] 2023 年 4 月 3 日 上午 9:11 
Let's see if this link annoys steam and/or discord... DW2 Bundle Tool [cdn.discordapp.com]
🥷  [开发者] 2023 年 4 月 3 日 上午 9:09 
I posted a prototype in the #mods channel on discord of the successor to the dw2bm.
It functions similarly.
AK_icebear 2023 年 3 月 18 日 上午 9:27 
This was super useful, especially in updating my first mods. Thanks!