Skip to content

A Python script with tutorial that automates the process of merging states in Victoria 3.

License

Notifications You must be signed in to change notification settings

ShabbyGayBar/StateMerger

Repository files navigation

Victoria 3 States Merging Automation Script & Tutorial

简体中文

Check out my State Merging Mod generated by this script! Available on Steam Workshop!

Description

This repository contains a Python script 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/...
  • /map_data/state_regions/...

How to Make Your Own State Merging Mod

Step 0: Prerequisites

  • Install Python 3.8 or later.
  • Download and unzip the State Merger zip file in the release page.
  • You could choose either one of the following methods, depending on whether you want to make a mod from scratch or use an existing mod as a base.
    • Install Victoria 3 Vanilla game (e.g. via Steam).
    • Install a Victoria 3 mod (e.g. via Steam) that you want to use as a base.

Step 1: Write the State Merging Rules

The merge_state.json file contains the rules for merging states. You can edit this file to customize the 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"]
}

Step 2: Run the Script

  • Navigate to the Victoria 3 /game directory under the root directory (or the mod root directory). You should see the following:

    • /game directory under the root directory

    /game directory under the root directory

    • mod root directory

    mod root directory

  • Copy the path of the Victoria 3 game root directory (or the mod root directory).

  • Navigate to the directory where you unzipped the State Merger zip file.

  • Right click ./state_merger_script.py and open in notepad or other text editor.

  • Replace the game_root_dir variable with the path you copied in the previous step. Make sure to use double backslashes \\ or single forward slashes / as path separators, and add a trailing backslash \\ at the end of the path.

    For example, if your game root directory is: C:\Program Files (x86)\Steam\steamapps\common\Victoria 3\game,

    you should set

    game_root_dir = "C:\\Program Files (x86)\\Steam\\steamapps\\common\\Victoria 3\\game\\"

    or

    game_root_dir = "C:/Program Files (x86)/Steam/steamapps/common/Victoria 3/game/".

  • Run the script by double clicking ./state_merger_script.py or running python ./state_merger_script.py in a terminal.

  • The execution of the script should take about 5 minutes.

  • After the script finishes, you should see a new folder named mod in the same directory as the script. This folder contains the generated files shown in the description section.

  • Copy the contents of the mod folder to your mod folder. You still need to create a .metadata folder to make the game recognize your mod. You can refer to Victoria 3 Wiki for further information.

Step 3: Edit Spline Network

Now comes the last manual part of the process. You need to edit the spline network to remove the invalid hubs of the merged states and reshape the road network between the new states.

  • Open the Victoria 3 game in debug mode.
  • Open the console by pressing ~.
  • Type map_editor and press Enter.
  • Click on the Spline Network tab or press 9.
  • Choose the Edit hub tool.
  • Select invalid hubs (those without names displayed on top) and press Delete.
  • Choose the Add spline tool.
  • Redraw the road connections between the remaining state hubs.

Further detailed information on how to edit the spline network can be found in this steam tutorial.

Feedback

Bug Reports

Please report any bugs you encounter in the Issues tab using the bug report template.

Acknowledgments

  • The Python script for paradox file parsing is based on the Victoria 3 Modding Toolkit.
  • 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.

License

This project is licensed under the MIT License - see the LICENSE file for details.

About

A Python script with tutorial that automates the process of merging states in Victoria 3.

Topics

Resources

License

Stars

Watchers

Forks

Languages