Welcome to the official modding resource for the Captain of Industry game.
COI is currently available on Steam and it is in Early Access stage. While modding is possible, it is not officially supported yet. We are continuously working on improving modding support and documentation.
Note that mod support is experimental and APIs might have breaking changes.
If you are having issues, always examine the logs in the %APPDATA%/Captain of Industry/Logs directory, they contain a lot of useful information.
If you'd like to discuss modding topics with the community and devs, visit our Discord channel #modding-dev-general (you will need to assign yourself a Mod creation role in #pick-your-roles-here channel).
You can also file issues here on Github, but the response time from our team might be delayed.
In order to start modding COI, you will need to:
Properties... -> Local Files -> Browse.C:/Steam/steamapps/common/Captain of Industry).COI_ROOT and set its value to the game root path copied above. On Windows, use the handy Edit environmental variables tool, just open the Start menu and type Edit env and you should see it.ExampleMod in the Release configuration located at src/ExampleMod/ExampleMod.sln. We recommend to use Visual Studio but feel free to use any other tools, such as the dotnet build console command. In Visual Studio you should see all dependent assemblies linked correctly. If not, and you are seeing a lot of errors, check you environmental COI_ROOT variable, try restarting.ExampleMod.dll in /bin/Release/net471.%APPDATA%/Captain of Industry.Mods. Inside it, create a new directory that has the same name as your mod DLL, in our case it's ExampleMod. Copy the compiled ExampleMod.dll there, so that it is at %APPDATA%/Captain of Industry/Mods/ExampleMod/ExampleMod.dll. Note that the directory name and DLL name must match.Miscellaneous settings enable mod support and restart the game so that the setting takes effect.ExampleMod is loaded by locating a new node in the research tree (open using G key). In case of any errors, examine logs in the %APPDATA%/Captain of Industry/Logs directory.Assets such as icons or 3D models can be created using the Unity editor. We currently use Unity 2022.3.5f1 and it is recommended to use the same version to avoid incompatibilities.
One-time Unity setup needed for MaFi tools to function properly.
src/ExampleMod.Unity. Do not open it yet.UnityRootSymlink in srcExampleMod.UnityLibrary that points to the Unity installation folder (e.g. C:Program FilesUnityHubEditor2022.3.5f1). This can be done by invoking mklink /D <target> <srouce> command in console window with admin priviliges. For example: mklink /D "C:CaptainOfIndustryModdingsrcExampleMod.UnityLibraryUnityRootSymlink" "C:Program FilesUnity". When you navigate to the UnityRootSymlink you should see a single Editor directory in it.src/ExampleMod.Unity/Assets/DLLs/create_dll_hardlinks.bat batch file. You will need to run it under admin privileges (right-click, Run as Administrator).
src/ExampleMod.Unity/Assets/ExampleModScene.unity in the Unity Editor. This can be done via Unity Hub by selecting Open project from disk in the Projects tab. Make sure you select the right Unity version if you have multiple installed.MaFi in the top menu on the Unity editor. If not, linked DLLs were not properly loaded and you will not be able to create assets.ExampleModScene by double-clickin on it in the Proejct pane (it's under Assets directory).Edit -> Preferences).
External tools -> External script editor -> Open by file extension. This will stop regenerating project files and placing absolute paths instead of relative.General -> Disable Editor Analytics (if you can and want).Following steps describe how to package icons, for example for new products.
Assets directory create <mod name>/<icons categor> directory, in our case that is ExampleMod/ProductIcons.Sprite (2D and UI) type and apply the change.asdf or pick any existing one.Copy Path. That path can be used to load your prefab in the game.Note: Unlike 3D models, textures do not need to have a prefab created.
Following steps describe how to create a 3D model template that is very benefitial in creation of 3D models of buildings.
ExampleMachineData.cs)."TODO" since we don't have a prefab yet.generate_layout_entity_mesh_template followed by your entity ID. This will generate an OBJ file in %APPDATA%/Captain of Industry/Misc/GeneratedMeshTemplates which represents a 3D bounding box of layout of your new entity with exact port locations.Following steps describe how to package a 3D model.
Assets directory create <mod name>/<model name> directory, in our case that is ExampleMod/ExampleModel..prefab file. In our example we created the prefab in the <mod name> directory.asdf or pick any existing one.Copy Path. That path can be used to load your prefab in the game.Once your assets are ready, follow these steps to package them with your mod.
Mods are published in a directory with the same name as your mod DLL, in our case we have ExampleMod/ExampleMod.dll.
Now we can add asset bundles to the same directory.
Ctrl+S).[MaFi] Build asset bundles. After Unity is done processing, asset bundle files can be found in the src/ExampleMod.Unity/AssetBundles directory.src/ExampleMod.Unity/AssetBundles to the AssetBundles folder next to mod DLL, for example %APPDATA%/Captain of Industry/Mods/ExampleMod/AssetBundles.YourPrefabName_xxxx, without extension) and the mafi_bundles.manifest file. All other .manifest files could be removed as well as the AssetBundles file.If you do any changes to your prefabs, simply rebuild asset bundles and copy use the new files from the AssetBundles directory.