Modification Development

MOD DEVELOPMENT

This wiki explains everything you need to know about developing Carrier Command 2 mods. Mods allow you to alter the appearance and behaviour of many aspects of the game. By reading this wiki you will learn how to create your own mods, and how to share your creations with other players in the community.

TYPES OF MODIFICATION

Currently there is support for modding the following types of game content:

- Textures and texture atlases

- Meshes

- Physics meshes

- Audio

- Shaders

- Localisation

- Scripts

- Game objects

As of version v1.3.0, mods enabled on a server will be automatically downloaded to clients when they connect (with the exception of modded languages). This permits physics, game objects and scripts that may affect gameplay behaviour to be altered without causing desync in multiplayer, and also mitigates cheating on public servers.

Mods are also disabled on the main menu (with the exception of modded languages). This is to ensure players can still easily access the game options and mod selection screen in the event that a game update causes some enabled mods to stop functioning correctly.

Note: mods work by overriding files in the base game. It is currently not possible to add new files to the game, only to replace existing ones.

CREATING A NEW MOD

This brief tutorial will demonstrate the necessary steps you must go through to create and test a mod.

Note: this tutorial is intended for content creators and assumes you already know how to create and edit XML and image files.

To begin creating a mod, navigate to the Carrier Command 2 user data folder - %appdata%\Carrier Command 2 on Windows, or /Users/<user name>/Library/Application Support/Carrier Command 2/ on Mac. Within this directory, create a folder called mods if it doesn't already exist. Within the mods folder, create a folder for your mod (e.g. my_mod). This folder can have any name but it is recommended to name it the same as your mod.

Every mod must provide the following 3 items to be valid - a mod manifest (mod.xml), a thumbnail file (thumbnail.png) and a content folder. If your mod is missing any of these items it will not show up in-game and cannot be uploaded to the Steam workshop.

Note: all file and folder names specified are case-sensitive and must be identical to how they appear here.

The Mod Manifest (mod.xml)

Open an editor of your choice capable of creating XML files (e.g. Notepad++, VSCode), and paste the following text:

<?xml version="1.0" encoding="UTF-8"?>
<data name="My Mod" author="Commander Altus Gage" description="My first mod!">
</data>

You should change the name, author and description text of your mod to something more suitable. Save this file to your mod folder as mod.xml.

The Mod Thumbnail (thumbnail.png)

You may use any png image as a thumbnail for your mod. This will be the image that is displayed on the Steam workshop if you choose to upload your mod. We recommended that you use a square image of size 256x256. For now, you can download the following placeholder thumbnail (right-click -> Save image as...) and place it in your mod folder with the name thumbnail.png.

The Content Folder (/content)

Finally, you will need to create a subfolder called content within your mod folder. This folder can remain empty for now.

Testing Everything So Far

You should now have the following files and folders:

/<CC2 user data folder>
	/mods
		/my_mod
			mod.xml
			thumbnail.png
			/content

Run the game and go to the Mods screen on the main menu. If you have successfully followed these steps, you should now see your mod in the list of installed local mods.

FILE AND FOLDER STRUCTURE

Open the game's install folder (you can get to this easily through the Steam client by right-clicking the game in your library and then selecting Manage -> Browse local files). Navigate to the rom_0 folder. This folder contains all of the content used by the game - much of it is moddable (see section Types of Modification above).

When the game loads, it first looks in the content folder of any enabled mods to find the files it needs. If it can't find a file, it uses the version in rom_0 (unmodified base-game content).

As such, files that you wish to mod should be placed in your mod's content folder with the same file and folder structure as those in the game's rom_0 folder. For example, to mod the screen_navigation script in the rom_0/scripts folder, your mod will need to provide the following folder structure:

/<CC2 user data folder>
	/mods
		/my_mod
			mod.xml
			thumbnail.png
			/content
				/scripts
					screen_navigation.lua

The content folder in your mod is analogous to the rom_0 folder in the game's install directory.

COMPILING ASSETS

Many moddable assets such as textures are stored in a special format that has been optimised for loading in the game, making them difficult to edit. To accommodate modding these files, a mod SDK has been provided which includes a tool to "compile" assets from a source file into the format used by the game.

For example, a source texture might be a .png file that you can edit in Photoshop. When compiled, it becomes a .txtr file that the game can read.

The Mod SDK

Within the game's install directory is a folder named mod_dev_kit which contains two more folders named source and bin. The source folder contains the original source files for all of the moddable assets in the game. The bin folder contains the asset compiler, named build_content.exe, as well as some additional configuration files required by the compiler.

If you run build_content.exe, all source files contained within source will be compiled into their game-ready formats and then copied into a content folder ready to be added to your mod.

Mod Development Workflow

Note: this section assumes you have followed the previous section Creating a New Mod and already have a mod folder set up.

Compiling all source files in source can take a long time because there is over 1GB of files to process. As such, the following workflow is recommended in order to make this process quick and straightforward.

First, copy the contents of mod_dev_kit into your mod's folder. Your mod folder should at this point look like this:

/<CC2 user data folder>
	/mods
		/my_mod
			mod.xml
			thumbnail.png
			/content
			/bin
				(mod compiler tool and configs)
			/source
				(source game assets)

Next, delete any source files from your copy of source that you don't intend to mod. This will ensure that only the few files you are interested in modding must be compiled, significantly speeding up the compilation process.

Finally, run bin/build_content.exe to compile the remaining assets into your mod's content folder. You can now modify the files in your copy of source and run build_content.exe to update your mod's compiled content.

Warning: running build_content.exe will overwrite any existing files in the content folder with the same name, so it is highly recommended that you make modifications exclusively in the source folder and treat your content folder as read-only.

UPLOADING YOUR MOD

When you have finished developing your mod, it's possible to share it with other players via the Steam Workshop. To upload a mod to Steam, first open Carrier Command 2 and, from the main menu, navigate to Mods -> Upload To Steam Workshop.

You will then see a list of valid local mods that you can upload. Simply select the mod you wish to upload, then set the upload visibility and whether you want to create a new workshop item or update an existing item. If you choose to update an existing item, you will be presented with a list of your existing workshop mods and can select one to update. Players will automatically receive your update when they next open Steam.

By submitting items to the Steam Workshop, you agree to the workshop terms of service.

Note: only the mod.xml, thumbnail.xml and content folder will be uploaded with your mod. Any other files including content files that are identical to the base game will be ignored.