Check out my State Merging Mod generated by this script! Available on Steam Workshop!
This repository contains a Python project that automates the process of merging states in Victoria 3.
It generates the following files that can be used in a Victoria 3 mod:
/common/.../event/.../gfx/.../localization/.../map_data/state_regions/...
- Either:
- Download the latest GUI executable file from the release page. (Recommended but Windows only)
- Or:
- Install Python 3.14 or later.
- Run
pip install "https://github.com/ShabbyGayBar/StateMerger/releases/download/v2.2.0/vic3_state_merger-2.2.0-py3-none-any.whl"to install the package via pip.
- Either:
- Install Victoria 3 Vanilla game (e.g. via Steam), If you want to make a mod from scratch
- Or:
- Install a Victoria 3 mod (e.g. via Steam), if you want to merge states in that mod.
The merge_state.json file contains the rules for merging states. You can download this file from the release page which contains a list of vanilla game states, and customize your own state merging rules.
The keys in the merge_state.json file are strings representing a state id. The values are lists of strings representing state id.
All states in the value list will be merged into the state in the key.
For example, the following rule merges state_1, state_2, and state_3 into state_0:
{
"state_0": ["state_1", "state_2", "state_3"]
}-
Run
state-merger.exeby double-clicking it. -
The GUI will pop up.
-
Fill in:
-
Merge file (merge_states.json): The one you edited in Step 1.
-
Game root directory: The root directory of your Victoria 3 game installation or base mod. Beware! The game root directory should be the
gamefolder under the Victoria 3 installation directory or the mod directory. In other words, you should see the following content inside this directory: -
Mod output folder: Where you want the generated mod files to be saved.
-
Small state limit (optional): The maximum number of provinces a state can have to be considered "small". Default is 4.
-
Log file (optional): Available only if you check the "Enable log file" checkbox. If set, a log file will be generated in the designated location.
-
-
Check or uncheck:
- Ignore small states: If set, states will not be granted buffs when merging small states defined above.
- Enable log file: If set, a log file will be generated in the designated location. ENABLE IT WHEN YOU ENCOUNTER BUGS AND SUBMIT A BUG REPORT.
- Merge spline network: If set, the script will produce the merged spline network of the mod so that you can skip the manual process. This is enabled by default.
- Repair spline errors: If set, the script will attempt to repair spline errors in the merged states. This is enabled by default.
-
Click the "Run" button to start the merging process.
-
The execution of the script should take about 1 minute.
-
After the script finishes, you should see the following folders in your designated mod output folder:
-
You still need to create a
.metadatafolder to make the game recognize your mod. You can also add other mod contents. Refer to Victoria 3 Wiki for further information.
Run the CLI with required positional arguments:
state-merger-cli <merge_file> <game_root> <mod_dir> [--data-dir <path>] [--small-state-limit <int>] [--ignore-small-states] [--log-level INFO] [--log-file <path>] [--stages <stage1,stage2,...>]
Example:
state-merger-cli merge_states.json "C:/Program Files (x86)/Steam/steamapps/common/Victoria 3/game" "C:/path/to/mod"
You can also type state-merger-cli --help to see all available options.
Please report any bugs you encounter in the Issues tab using the bug report template and provide the corresponding log file.
- The Python script for paradox file parsing uses Pyradox.
- The Victoria 3 game and its data files are the property of Paradox Interactive.
- This project is an unofficial modding tool and is not affiliated with or endorsed by Paradox Interactive.
Except for the third-party file identified in
THIRD_PARTY_NOTICES.md, the original source code,
documentation, data, and artwork in this repository are licensed under the
GNU General Public License version 3 or later.
This includes docs/images/icon.png and merge_states.json.
The GPL does not apply to src/vic3_state_merger/assets/flag_definitions_usa.py,
which is adapted from Victoria 3. Generated files containing StateMerger's
original bundled templates remain GPL-covered, while processing user-provided
game data does not automatically place that input under the GPL. See
THIRD_PARTY_NOTICES.md for provenance, ownership, and
applicable terms.


