Modding

From Victoria 3 Wiki
Jump to navigation Jump to search

Modding allows to change elements of the game or add new features. Certain things are hardcoded, i.e. not available for modding, such as changing map modes or adding new hotkeys.

All mods will be achievement compatible unless they utilize console commands.

Tips[edit | edit source]

  • Create a mod instead of directly modifying the game files, as they will be overwritten with any game update.
  • Your created mod folder is located in "Documents\Paradox Interactive\Victoria 3\mod\MODNAME" and directly inside, you should create your "common", "localization", (etc), folders of your mod as they are needed.
  • Use a good text editor that has syntax highlighting and other useful features like find in files. The following programs are free and currently have plugins to support Victoria 3 scripting:
    1. Sublime Text is very fast and has syntax, completion, and documentation support with the plugin found here: Victoria 3 Tools
    2. Visual Studio Code is a slower but feature rich editor that has a fan-made plugin called CWTools that is found here: CwTools
    3. Notepad++ is another good lightweight editor but it has no fan made plugins that support Victoria 3 specifically. Choosing Perl as your language syntax will give satisfactory syntax highlighting.
  • Start the game with "-debug_mode" and "-filewatcher" options to use the console, dev tools, and automatically reload changed files without having to restart the game.
  • Use the error.log to catch any bugs, it is extremely useful the logging is very accurate and is one of the greatest tools modders have for debugging things that are not working. It is located next to the mod folder in Documents/Paradox Interactive/Victoria 3/logs
  • Backup your work, things can go wrong and it is always good to have a backup. Either do it manually or use a version control system like Git. Also consider using GitHub for team collaboration. If you are new to Git a program like Github Desktopis great for beginners.
  • Use "script_docs" and "DumpDataTypes" console commands in the game to generate other logs with event effects, triggers and scopes.
  • If you are unsure of how to do something, search through the base game files for words you know you need to use. Finding in files is one of the most important tools to quickly write bug free mods.
  • Remove your local mod when you subscribe to the Steam version, otherwise it won't work.
  • Indent properly, so that opening and closing brackets are on the same level. Proper formatting will allow you to fold blocks of code, help spot any mistakes and make it easier to read.
  • Add comments, starting with #, to remember later how things works, to navigate easier or to disable parts of code without deleting them.
  • Respect the file suffixes of the kind of file you're replicating. The game not only guides itself on basis of folder structure, but also on files suffixes. For example, if you're adding new decisions to your flavor mod, make sure you name it: "MODNAME_decisions.txt". The same applies for the equivalent localization files. Using the decisions example: "MODNAME_decisions_l_english.yml". Some game files don't use names as prefix, but instead 2 digits. The same principle applies when creating a mod from these files, replace the numbers with your mod name prefix, for example: MODNAME_color_names.txt .
  • Localization .yml files must be encoded in UTF-8-BOM. Otherwise the game will simply ignore the file.

Modding Articles[edit | edit source]

Country modding

Event modding

Journal modding

Modifier modding

Tools & utilities[edit | edit source]

  • CWTools plugin for editing paradox game files in Visual Studio Code. It has syntax-highlighting, error checking, auto-completion and more. Based on the Cwtools library for parsing, editing, and validating Paradox Interactive script files
  • Victoria 3 Tools is a Sublime Text syntax with many features to help Victoria 3 scripting easier.
  • Pdx-Unlimiter a powerful and smart savegame manager, it can edit save files. It can preview modded flags without starting the game.
  • Map data editor a mapdata editor to edit mapdata in common/history/states visually, it is helpful to edit the which provinces are which countries.
  • Vicky-Mapgen A Map Generator generates provinces by heighmap.png and boundaries.png
  • Music Mod Creation Tool as its name, it is for music mod, and now it supported vic 3
  • UWPDumper: a tool to extract files from Microsoft Store games.
  • Clausewitz Maya Exporter: a tool to create and export 3D models to use in vic3 and other Clausewitz games.
  • Jomini.js a powerful parsing libary in javascript based on webassemby, has a C version named Rakaly.

Game object reference[edit | edit source]

Dependency and Folder Structure[edit | edit source]

If you want to add a new game object, you will need to keep in mind which more fundamental objects it depends on, and how to organize the files so the game recognizes it.

All paths are relative to the 'game' folder inside your Victoria 3 install directory, as that is where all scriptable parts of the game are located.

Note: objects with no dependencies may still reference primitive objects (numbers, strings etc) or core game concepts, but no object type that mods can edit or define, only change the parameter value of. Nested references, especially within modifiers, are generally also not counted, since modifiers can have arbitrary dependency relations.

Object type Path Dependencies
Professions common/pop_types No
Trade goods common/goods No
Needs common/pop_needs
Trade goods, via 'default'
Trade goods, via 'goods' inside 'entry'
Eras common/technology/eras No
Technologies game/common/technology/technologies
Eras, via 'era'
Technologies, via 'unlocking_technologies'
Institutions common/institutions No
Law groups common/law_groups No
Laws common/laws
Institutions, via 'institution'
Law groups, via group
Laws, via 'disallowing_laws'
Laws, via 'possible_political_movements'
Ideologies common/ideologies
Law groups, as parameters
Laws, via law group parameter mappings
Interest group traits game/common/interest_group_traits No
Interest groups common/interest_groups
Interest group traits, via 'traits'
Ideologies, via 'ideologies'
Production methods common/production_methods
Technologies, via 'unlocking_technologies'
Laws, via 'disallowing_laws'
Production methods, via 'unlocking_production_methods'
Production method groups common/production_method_groups
Production methods, via 'production_methods'
Building groups common/building_groups
Building groups, via 'parent_group'
Building, via 'default_building'
Buildings common/buildings
Building groups, via 'building_group'
Technology, via 'unlocking_technologies'
Production method groups, via 'production_method_groups'


Parameters[edit | edit source]

When creating a game object, you generally need to follow a specific pattern. Here are the parameters for various game objects, what they mean, which are required, and what type of value to enter.

Object type Parameter Parameter type Required Meaning
Trade goods texture string Yes good icon filepath
cost integer Yes base good price
category keyword, one of:
staple
industrial
luxury
military
Yes which goods category it belongs to
prestige_factor integer Yes base prestige for being lowest rank leading producer:

specifically, holding the MIN_PRESTIGE_AWARD spot.

traded_quantity integer No how many goods are traded for each level of a trade route
convoy_cost_multiplier floating point number No how many times more convoys are needed to transport this good
consumption_tax_cost integer No how much authority it costs to levy a consumption tax

note: absence of this parameter implies no consumption tax can be levied

Technology Era technology_cost integer Yes the base technology cost for techs in this era
Technology era Technology Era Yes which era this technology belongs to
texture string Yes technology icon filepath
category keyword, one of:
production
military
society
Yes which category this technology belongs to
modifier country modifier No which immediate effects this technology has on your country

Example: Cotton Gin provides 25% cotton plantation throughput.
Unlocked buildings, production methods, laws, etc are specified
from the unlocked object, not the unlocking technology.

unlocking_technologies list of technologies No All prerequisite technologies. If empty, it has no prerequisites
can_research boolean No if 'no', makes it unavailable for normal research.

Example: Sericulture.


See also[edit | edit source]

Console commands

Modders Guides[edit | edit source]

Grester's Compendium