DW2 Modding Roadmap
Posted: Thu Mar 10, 2022 2:14 am
Below is a summary of the current state of modding for Distant Worlds 2. It outlines what exists now and where we currently have gaps. We are eager to support modders and provide the tools and information they need. So we welcome your feedback and ideas, especially in the areas where we have gaps.
Distant Worlds 2 was written with modding in mind from the start. As much as possible, all the data is externalized in XML and text files. This approach helped in our development process, allowing separate teams to work on new content without needing lots of help from the development team (me).
So artists could integrate new models into the game, the story team could integrate new game events and the core game team could update the tech tree and components, all without needing development help.
As I see it there are 5 main areas of modding:
1. Data - configuration data and game text
2. Art Content - models, textures, sounds
3. Story and Events - linked events that unfold stories
4. Game Logic - code or data that strongly influences how the game plays
5. Mod Management - installing mods, handling multiple active mods
DW2 already handles items 1, 2 and 3 using various tools. Item 4 is only weakly supported. Item 5 is completely missing. We will be working to improve our support for points 4 and 5 in the coming weeks and months.
These areas are described in more detail below.
Data
Nearly all of the game objects are externalized in XML files: star and planet types, resources, races, governments, research, ship components, shiphulls, planetary facilities, creatures, troops
These XML files can be edited in the following ways:
1. DW2 Data Editor tool can edit many of the above objects
2. We provide XSD schema files for all of the above objects, so you can create your own tools if you wish
3. you can simply hand-edit the XML in NotePad
All of the game text is externalized, mostly in a single file (GameText.txt), but some also in the above-mentioned data files.
Galactopedia: the in-game Galactopedia help files are text files that use a very simple markup language.
Data Tools and Documentation
Art Content
This includes the following items: ship models and textures, static images, UI icons, particle effects, sound effects.
DW2 uses Stride as it's rendering engine. Stride has a GameStudio tool that allows compiling art assets into bundle files that are included in the game. These bundle files thus include all of the above art content. However note that we do not use the latest version of Stride. Instead we use Xenko version 3.1.0.1 (Xenko was the former name for Stride).
We also have a tool (ship-tuner) to help modellers generate the necessary data from their models to get their ships and bases into the game. This tool helps setup all the data for weapon bays, hangar bays, engine bays, etc. This data is stored in the ShipHulls.xml file.
Star and Planet Types
All of the stars and planets are procedurally rendered. Modders can plug into this to make their own new types of planets or stars. This involves adding new entries to an XML file (OrbTypes.xml).
Art Tools and Documentation Stride Game Studio: https://www.stride3d.net/download/
ship_tuner-2.60-all.jar: TODO: download elsewhere...
Story and Events
DW2 has a powerful mechanism for creating stories with linked events. These stories are flexible and will mold themselves to any new galaxy - they are not tied to a single savegame.
Story events are contained in an XML file (GameEvents.xml). These game events have logic to place them at the right location in the galaxy at the start of the game. They also have trigger conditions that control when they occur. And then they have multiple actions that can happen once they are triggered, including prompting the player for decisions.
We use this approach to do all of our internal story development, so there are lots of pre-existing examples of how to use this in the GameEvents.xml file. The game events are also comprehensively documented in "Distant Worlds 2 - Game Events - 5 March 2022".
None of these game events require writing any code. You simply edit entries in an XML file, using the provided Data Editor tool.
So while I understand that many modders may want to dive straight into changing game code, I would urge you to first take a good look at the tools already available that may do most of what you want. Game Events in particular cover a lot of ground that modders will find useful.
Story Tools and Documentation
Game Logic
One mechanism that can already be used to strongly influence gameplay are Empire Policy files. These are XML files that contain settings for each playable race. They influence how the race plays the game: what they value and prioritize, thresholds for various decisions and other data. The policy files can be found in the data/policy subfolder. They are named by race, e.g. Human.xml. These files contain the default settings for each race.
The policy settings in these files correspond to the Empire Policy screen in the game. You can hover over each setting in the Policy screen to get an explanatory tooltip.
Connecting to Game Code
The code in DW2 is currently obfuscated. However we plan to deobfuscate most of this to allow access to code modding.
Mod Management
DW2 does not currently have a good approach to handling multiple mods at the same time. In DW Universe we had a separate folder for each mod, and you could select which mod you wanted to use - one at a time.
That's pretty much where we are at the moment. But we want to improve this a lot. We need a good way to revolve conflicts when mods use the same files, indicating which takes precedence, etc.
We are also missing a user-friendly mechanism for discovering and installing mods. Placing mods in their own subfolder is fine, but we need to wrap this with nice UI to manage things.
Distant Worlds 2 was written with modding in mind from the start. As much as possible, all the data is externalized in XML and text files. This approach helped in our development process, allowing separate teams to work on new content without needing lots of help from the development team (me).
So artists could integrate new models into the game, the story team could integrate new game events and the core game team could update the tech tree and components, all without needing development help.
As I see it there are 5 main areas of modding:
1. Data - configuration data and game text
2. Art Content - models, textures, sounds
3. Story and Events - linked events that unfold stories
4. Game Logic - code or data that strongly influences how the game plays
5. Mod Management - installing mods, handling multiple active mods
DW2 already handles items 1, 2 and 3 using various tools. Item 4 is only weakly supported. Item 5 is completely missing. We will be working to improve our support for points 4 and 5 in the coming weeks and months.
These areas are described in more detail below.
Data
Nearly all of the game objects are externalized in XML files: star and planet types, resources, races, governments, research, ship components, shiphulls, planetary facilities, creatures, troops
These XML files can be edited in the following ways:
1. DW2 Data Editor tool can edit many of the above objects
2. We provide XSD schema files for all of the above objects, so you can create your own tools if you wish
3. you can simply hand-edit the XML in NotePad
All of the game text is externalized, mostly in a single file (GameText.txt), but some also in the above-mentioned data files.
Galactopedia: the in-game Galactopedia help files are text files that use a very simple markup language.
Data Tools and Documentation
Art Content
This includes the following items: ship models and textures, static images, UI icons, particle effects, sound effects.
DW2 uses Stride as it's rendering engine. Stride has a GameStudio tool that allows compiling art assets into bundle files that are included in the game. These bundle files thus include all of the above art content. However note that we do not use the latest version of Stride. Instead we use Xenko version 3.1.0.1 (Xenko was the former name for Stride).
We also have a tool (ship-tuner) to help modellers generate the necessary data from their models to get their ships and bases into the game. This tool helps setup all the data for weapon bays, hangar bays, engine bays, etc. This data is stored in the ShipHulls.xml file.
Star and Planet Types
All of the stars and planets are procedurally rendered. Modders can plug into this to make their own new types of planets or stars. This involves adding new entries to an XML file (OrbTypes.xml).
Art Tools and Documentation Stride Game Studio: https://www.stride3d.net/download/
ship_tuner-2.60-all.jar: TODO: download elsewhere...
Story and Events
DW2 has a powerful mechanism for creating stories with linked events. These stories are flexible and will mold themselves to any new galaxy - they are not tied to a single savegame.
Story events are contained in an XML file (GameEvents.xml). These game events have logic to place them at the right location in the galaxy at the start of the game. They also have trigger conditions that control when they occur. And then they have multiple actions that can happen once they are triggered, including prompting the player for decisions.
We use this approach to do all of our internal story development, so there are lots of pre-existing examples of how to use this in the GameEvents.xml file. The game events are also comprehensively documented in "Distant Worlds 2 - Game Events - 5 March 2022".
None of these game events require writing any code. You simply edit entries in an XML file, using the provided Data Editor tool.
So while I understand that many modders may want to dive straight into changing game code, I would urge you to first take a good look at the tools already available that may do most of what you want. Game Events in particular cover a lot of ground that modders will find useful.
Story Tools and Documentation
Game Logic
One mechanism that can already be used to strongly influence gameplay are Empire Policy files. These are XML files that contain settings for each playable race. They influence how the race plays the game: what they value and prioritize, thresholds for various decisions and other data. The policy files can be found in the data/policy subfolder. They are named by race, e.g. Human.xml. These files contain the default settings for each race.
The policy settings in these files correspond to the Empire Policy screen in the game. You can hover over each setting in the Policy screen to get an explanatory tooltip.
Connecting to Game Code
The code in DW2 is currently obfuscated. However we plan to deobfuscate most of this to allow access to code modding.
Mod Management
DW2 does not currently have a good approach to handling multiple mods at the same time. In DW Universe we had a separate folder for each mod, and you could select which mod you wanted to use - one at a time.
That's pretty much where we are at the moment. But we want to improve this a lot. We need a good way to revolve conflicts when mods use the same files, indicating which takes precedence, etc.
We are also missing a user-friendly mechanism for discovering and installing mods. Placing mods in their own subfolder is fine, but we need to wrap this with nice UI to manage things.