• We have updated our Community Code of Conduct. Please read through the new rules for the forum that are an integral part of Paradox Interactive’s User Agreement.

Victoria 3 - Dev Diary #60 - Modding

16_9.jpg

Hi folks! I'm Mike, one of the Game Designers who specializes in content for V3, and today we're going to talk about the delights of modding.

Modding is a whole world of things in Paradox games. Some mods are total overhauls, some are just simple little tweaks. I've seen sweet little mods that just add a person's pet as a graphic, or even one that I spotted on Hearts of Iron's workshop page as I wrote this that added in a dearly-departed office cat as a replacement for Joseph Stalin. There's all sorts of mods out there! And, hopefully, by the time you've finished reading this dev diary, you'll know how to create the start of your own mod for Victoria 3, too.

Starting with the launcher

First thing's first: the way the innards of Victoria 3 operate is similar, but not exactly the same as, Crusader Kings 3 and Imperator, since they're all derived from the Jomini engine we also use. If you know how those games tick scripting-wise, you're 90% of the way to knowing how to make a V3 mod. If not, I will happily let Crusader Kings 3 explain a bit about how scripting in Jomini works.

If that stuff still leaves you a little baffled, don't worry about it! We're gonna walk through the basics of making a whole mod, from the first point of creation to actually running the darn thing.

So! Let's start from the top. When you fire up Victoria 3, you'll be greeted by the game's launcher. If you look in the upper-left of the launcher, you'll see four little options: Home, DLC, Mods, and Game settings. Click the Mods one. Go on. You know you want to.

DD60_1.jpg

From the Mods menu, you'll be greeted with three buttons. If you click "Mod tools" in the middle, you'll be greeted with a prompt to create a new mod if you haven't got any yet, otherwise you'll have to find the button on the menu and click it to bring up the Create new mod prompt.

Let's make something simple, shall we? How's about we make a country out of Ohio. Yeah, let's just make one country and make it show up in-game, that'll be a good test of all this stuff.

DD60_2.jpg

Slam that create button, and the launcher will create a new directory in your mod folder wherever your savegames and such are stored. In my case, and in most of your cases, that'll be in some place like

DD60_3.jpg

Found the directory? Good. Inside that directly, you're gonna find a folder named ".metadata", with a single file inside that, called "metadata.json". That folder and file is where all the data is stored that the launcher reads when checking out the mod, including the mod's name, version number if you wanna be fancy, and so forth. If you want to tinker with that stuff later, go on ahead, but we're not gonna touch it for this. Go back to the main directory, so that you're looking at "[...]\Paradox Interactive\Victoria 3\mod\It's Ohio!"

Mucking with files

Let's start defining Ohio. The key thing with how to set up a mod is that you have to essentially copy the paths used in the main game, so the game reads everything right. In V3, country definitions are stored at "Victoria 3\game\common\country_definitions", so in our "It's Ohio!" directory we're going to make a "common" folder, and then a "country_definitions" folder within that. This mimics the path of the base game (that "Victoria 3\game" bit), so when the game reads this mod and tries to figure out how it interacts with the base game, it doesn't scream and die.

Inside our mod's "common\country_definitions" folder, we're going to make a little file I've arbitrarily called "ohio.txt". Open it up, and we'll paste text like this bad boy into it:

DD60_4.jpg

Wow! We've defined Ohio. Now let's tinker with history files so Ohio appears in-game.

Country control of a state is defined in a couple history files, found in the following directories:
  • common\history\buildings
  • common\history\pops
  • common\history\states

All three of these will need the base game files copied over- we sadly can't just add a new entry in a new file, because we also need to remove/replace the USA-related data in these as well. Make sure you duplicate these folder paths in the It's Ohio! mod folder, like you did with common\country_definitions.

Starting with the buildings directory, what we do is find "STATE_OHIO" among the buildings files- turns out it's in 05_north_america.txt. Copy that file and plop it into your mod's history\buildings folder, open it up there, then search for STATE_OHIO. You'll find a section that starts off with

DD60_5.jpg

and goes on from there. What's happening there is that we've declared that within the state region of Ohio (that is, "s:STATE_OHIO"), there should be a state controlled by the USA ("region_state:USA") that constitutes American Ohio. But we're making an independent Ohio, so all the data referring to American Ohio is useless and will confuse the game. All we're going to do is change that "region_state:USA={ " line to "region_state:OSU={ " so the same section now reads

DD60_6.jpg

Now, instead of telling the game that within the state region of Ohio we want to create a state controlled by the USA filled with the following buildings, we've told the game to create a state in Ohio that is just… Ohio, and that should be filled with the following buildings.

The same thing applies for common\history\pops. There's a 05_north_america.txt file we're gonna copy over, and we're going to find the STATE_OHIO entry, and change USA control to OSU.

State history is all saved in a single file, so in common\history\states\ you're just going to copy over the entire 00_states.txt file into your mod directory, and again crack open the file and search for STATE_OHIO. There, you'll find this entry:

DD60_7.jpg

A state is created out of provinces, which are all just x + whatever the hex code (a color expressed as six characters) for their province color is in the province map we used to create the whole map. In places like Ohio, there's only one state created per state region, but in places like Germany this section looks far more chaotic, as it is possible to create multiple states within a single state region. Don't think about Germany though, think about Ohio.

Hopefully you've picked up on the pattern of changes we've been doing- here again, we're just going to change that "country = c:USA" bit to "country = c:OSU", so that the whole STATE_OHIO section becomes

DD60_8.jpg

Exciting! I wonder what happens if we start up the game now?

Checking our work

DD60_9.jpg

First, we need to get the darn thing enabled in the launcher. Open up the launcher, add a new playset, and call it "ohio!" or the name of your choice.

DD60_10.jpg

The launcher's going to say that the playset looks empty, so click the "ADD MODS" button that appears, so you can add mods, and then add “It's Ohio!”

Make sure the playset is enabled, and then let's play the game and see what happens.

DD60_11.jpg

Hold on… something feels wrong here. Let's quit out of the game, right-click on Vicky 3 in Steam, open up properties, and change the launch settings by plugging in "-debug_mode".

DD60_12.jpg

This enables the error log to appear in game. Let's see what happens when we load up the game now.

DD60_13.gif

We have errors! We'll open up the error log, which can be found at "...\Paradox Interactive\Victoria 3\logs\error.log", and let's take a look at the error messages. Any time you're working on a mod, I cannot emphasize enough how useful it is to run the game with debug mode on and do your best to resolve any issues reported in the error log.

Please read the error log and fix errors reported there. I'm not even talking to just potential V3 modders now. Please, I beg you… read the error logs and fix the errors reported there.

Anyways! In our case, there's four sources to these errors:
  • By removing Ohio from the USA, we've reduced wine consumption enough that a scripted trade route that the USA starts with needs to be changed or removed. Easy enough, I'll copy the trade route history file over and remove that entry outright so I don't have to think about it anymore.
  • I didn't localize the Ohio tag (OSU)! I'll get around to localization after fixing the next two items.
  • I've completely forgotten to add country history, so Ohio's technological know-how hasn't been defined at all.
  • Starting pop prosperity, located in a separate "populations" file, hasn't been defined for Ohio.

Country histories cover technology and politics. To make this easy on myself and avoid scripting everything from scratch, I'm going to copy the country history of Ohio's natural counterpart at vanilla game start: Belgium. All I'm going to do is get to "common\history\countries\bel - belgium.txt" in the base game, copy that file over to the same path in the mod, rename it to "osu - ohio.txt", and open it up real quick. Inside, the file has a whole section enclosed within "c:BEL". That section contains several effects that set the starting laws and ruling interest groups of the country. I'm just gonna change that c:BEL there to c:OSU, so all those effects regarding politics and technology now apply to our OSU tag, then I'm gonna save the file and close out there.

The other history file I need to add is a population file. The population file contains some scripted effects which distribute health and literacy rates among a country's starting pops. We're going to find the Belgian one at "common\history\population\bel - belgium.txt". Like with the country history stuff, we're going to rename our copy to "osu - ohio.txt" (as long as it's named anything other than an existing history file, it won't accidentally overwrite anything, but keeping the same naming convention in place is useful for organization), and inside that file change the scope from c:BEL to c:OSU so the effects of the population file actually apply to Ohioans.

Speaking of "Ohioans", let's get that localization sorted. Base game localization is stored at "Victoria 3\game\localization" and further divided into the various languages the game is available in. I'm an Anglophone, so I'm going to default to English for this stuff. We're going to recreate the whole English-language localization folder path in our mod (so "It's Ohio!\localization\english"), then we're going to create our own little loc file to throw in there- let's call it ohio_l_english.yml just to stick to the theme. Now, all we need to add in that file is

DD60_14.jpg

And now our country should have a name and an adjective!

Some of you folks with modding experience may have noticed that existing localization in our games tends to have a number after the colon in these localization entries (like 'FRA:0 "France" ', for example). Those numbers are just there to help us and our translators keep track of when entries are changed and require revised translations- they have no functional purpose beyond that, and if you're just modding in one language and don't intend to translate your mod with the same tools we use, there's no need for you to include that number bit after the colon.

With those errors hopefully fixed, let's start up V3 again.

DD60_15.jpg

Ladies and gentlemen, we have Ohio. It still doesn't have a scripted flag- you can read more about how those work and are scripted here - but it's a country that functions. You could select Ohio and play as Ohio now, if you wanted, or you could elaborate further, and start writing events and journal entries. You could script up individual characters, or replace all Yankee pops in Ohio with your own bespoke Ohioan culture where everyone has names like "Bud" and "Janet". Explore the game itself, and the insides that make it all work!

In our Dev Diary next week, Paul will be talking about Data Visualization!
 
  • 109Like
  • 26Love
  • 14
  • 14
  • 6Haha
  • 1
Reactions:
finally my favorite topic, most of my question will be fantasy focus since that were crazy modding happens.

1) is it possible to have pops consume different good that other won't? for example i want in my fantasy mod of certain race to consume iron as food while other races use it as industrial good, is it possible to do such thing?

2) could you also have PM or professions could only be employed by certain culture or race? e.g mages could only employed elves or PM could only used humans.

3) is it possible to have a new technology tab that is only exclusive for nation or culture? e.g nation with certain culture that has dwarf heritage could research tech that make mining faster or unlock pm exclusive to them.

4) is it possible to have interbreeding? so humans and elves pop in the same state could have potentially half-elves pops
1) I reckon the most you could do is assign taboos and obsessions to culture at game start, and amplity the consumption effects so that a culture with the X taboo will not touch that good _at all_. That's the immediate hacky solution that comes to mind, but I don't think even that would fully go for what you're after.

2) Pop _types_ can be specified for production methods, but not pop _cultures_, no.

3) It's possible to script techs that only appear in the game for certain countries at least, yeah. There's a unique silkworking tech in V3 which isn't available for all countries, as a vanilla example.
Assuming the Imperator & CK3 Terrain editor makes a comeback and with colours for provinces being changed to hex from RGB, does the editor now feature more than exclusively a (much better) nudge tool when e.g. creating new provinces? Are you potentially even going to be able to manipulate province borders in-editor now, making terrain editing that much easier?
Pretty sure you already can do that in the CK3 editor. A nice functionality for the editor would be the possibility to designate state regions or even manipulate some history files - is that in?
There is a map editor in-game (you can run "map_editor" in the console to open it), and it has functionality for painting new provinces and for assigning them to different states. It doesn't have any history manipulation, though- you'll have to crack open the modded map files after you've used the tool in-game to get the new province assignments for each state region and then go to "common\history\states" and plug in the new values where needed.
 
  • 18
  • 3Like
  • 1Love
  • 1
Reactions:
I'm not sure I understand. Do you mean, is there some way to prevent a pop of a particular culture from moving to a certain place?

Let's say I had a post apocalyptic mod set in the Wasteland around, oh, 2241. I want to create a "ghoul" population of mutants, but I don't want them to integrate or assimilate into a population of regular humans. Can I stop that? Or is assimilation always going to occur?

Many thanks for the answer,

Faeelin
 
  • 2Like
Reactions:
Found the directory? Good. Inside that directly, you're gonna find a folder named ".metadata", with a single file inside that, called "metadata.json". That folder and file is where all the data is stored that the launcher reads when checking out the mod, including the mod's name, version number if you wanna be fancy, and so forth. If you want to tinker with that stuff later, go on ahead, but we're not gonna touch it for this. Go back to the main directory, so that you're looking at "[...]\Paradox Interactive\Victoria 3\mod\It's Ohio!"​
Can I change mod folder path? ( like D:\paradox mod\vic 3\it's Ohio! )
OneDrive make my documents folder to 2 bytes strings with spaces , and that make mod folder invisible from stellaris lancher.
 
  • 1Like
Reactions:
You could script up individual characters, or replace all Yankee pops in Ohio with your own bespoke Ohioan culture where everyone has names like "Bud" and "Janet". Explore the game itself, and the insides that make it all work!

I'm definitely making a Yinzer culture mod for western Pennsylvania.
 
  • 2Like
Reactions:
Great Dev Diary, that I'm definitely gonna save for the time when I'll be doing modding.

but I have questions:

1. Considering that you have so many provinces in states, is there a tool that gave you faster way of defining states or we will have to define ach prov to each state by hand?
2. How does defining Decentralized (aka unplayable) nations work? What if I just have couple of country entries, will the world fill up with decentralized nations by itself? Or will it crash without me defining a tag to each state? (To clarify, I want a colonizable world, but I have a feeling that this game is just like CK3 - doesnt have an option for unsettled land)
3. What other tools we will have at our disposal, besides usual Notepad++ editing and Map Editor that was in the games since Imperator? Because I already see that this game will have some intence modding, and while doing intricant things is cool, but making some steps faster would be helpfull.
 
Hope someone makes a day 1 mod for free console access, because apparently, Paradox is incapable of giving us normal console access since Imperator.

Yes I am salty about that.
 
  • 2
Reactions:
Is it possible to have a building that always runs at 100% productivity, with no workers, regardless of whether it's profitable, and ai won't shut it down?
Is it possible to script a building to spawn at a state when a certain building type is constructed there?
 
I'm excited to see what great mods the community comes up with in the weeks and months after release!
Anime portraits within the first 6 hours and I'm willing to bet a second copy of Victoria 3 on it.
 
  • 6
Reactions:
In the example, Ohio's state religion is shown as Protestant. But it's using Belgium's history files, so you'd expect it to be Roman Catholic. Why has that happened, please? Is the state religion always the most popular religion in a country? Because that wasn't always the case in real life (e.g. in the T'ai-p'ing Heavenly Kingdom).
 
Is it possible to Split States through events or other conditions in-game, through modding?

- What determines the name that a Treaty Port will receive when it is split?

Does the Crown on the Ohioan flag only appear because Ohio is a monarchy?

Is "Decentralized" another country type?

Will we be able to mod our own country types beyond "Recognized" and "Unrecognized"?

I hope these are not too many questions, and massive applause to you and the other for the work!
 
  • 1
Reactions:
Let's say I had a post apocalyptic mod set in the Wasteland around, oh, 2241. I want to create a "ghoul" population of mutants, but I don't want them to integrate or assimilate into a population of regular humans. Can I stop that? Or is assimilation always going to occur?
If I remember rightly, it's mentioned in one of the dev diaries that pops can only assimilate to a culture with the same Heritage as their current culture.

So, if I'm right:

English pops in Picardy, or French pops in Yorkshire, can assimilate to French or English respectively, but a Bantu pop in New York can only assimilate to Afro-American, not Yankee.

So give Ghoul Heritage to your Ghoul culture and everything should be sorted.
 
Last edited:
  • 2
  • 1Like
Reactions:
I never thought we would get a dev diary on how to add The Ohio State University and take over the world with the Buckeyes, but here we are. (note: OSU happens to be the common abbreviation for Ohio State University).
 
  • 1Like
  • 1Haha
Reactions:
This debug mode sounds like a huge improvement compared to the time when we had to use a "validator" separate from the game.
I'm going to enjoy this.

(maybe this was already the case on CK3, I haven't even tried to mod CK3, I'm mostly thinking about EU4&CK2)
 
Can I change mod folder path? ( like D:\paradox mod\vic 3\it's Ohio! )
OneDrive make my documents folder to 2 bytes strings with spaces , and that make mod folder invisible from stellaris lancher.
I think the mod folder defaults to wherever the launcher keeps saves stored. I haven't mucked with that much myself tbh, so I'm not too sure.

Great Dev Diary, that I'm definitely gonna save for the time when I'll be doing modding.

but I have questions:

1. Considering that you have so many provinces in states, is there a tool that gave you faster way of defining states or we will have to define ach prov to each state by hand?
Yeah, there's an in-same map editor that you can launcher through the console- there's nothing planned, but I hope a more comprehensive guide to modding can be provided once the game's released and nobody has to worry so much about commenting on unreleased stuff.

2. How does defining Decentralized (aka unplayable) nations work? What if I just have couple of country entries, will the world fill up with decentralized nations by itself? Or will it crash without me defining a tag to each state? (To clarify, I want a colonizable world, but I have a feeling that this game is just like CK3 - doesnt have an option for unsettled land)
Decentralized countries are just a country type. Using the example in the first post, in the little country definition I gave OSU, replacing "country_type = recognized" with "country_type = decentralized" is all that needs to be done to flip Ohio from a recognized country into a decentralized one.

3. What other tools we will have at our disposal, besides usual Notepad++ editing and Map Editor that was in the games since Imperator? Because I already see that this game will have some intence modding, and while doing intricant things is cool, but making some steps faster would be helpfull.
Gonna be honest, I'm so ingrained in my old habits that I mostly just truck along with a lot of unautomated scripting without thinking about it. But I believe I've heard of a couple mod-minded tools being worked on, although I'll leave it to those folks to talk about it when they're ready.

Can pops be deleted/created through events now? The inability to do this in VIc2 modding led to some issues.
There's a create_pop effect.

Can we in fact use alpha values for non-rectangular flags?

And can we mod things like rivers to change in game? The Yellow river, if I remember correctly.
No, alpha values don't work on flags. :(

In the example, Ohio's state religion is shown as Protestant. But it's using Belgium's history files, so you'd expect it to be Roman Catholic. Why has that happened, please? Is the state religion always the most popular religion in a country? Because that wasn't always the case in real life (e.g. in the T'ai-p'ing Heavenly Kingdom).
Ohio's religion is protestant because its primary culture is defined as Yankee- it's got nothing to do with the country history file. Cultures are defined with a primary religion, so you can write up a database and have, like, "create_pop = { culture = spanish size = 2000 }" in the history database and the game just knows that spanish culture's primary religion so it defaults to making that 2000-sized Spanish pop Catholic. Yankee, in turn, is defined as being Protestant.

Both pops and countries can have religions specified otherwise, mind you, it's just that the game will default to whatever a culture's primary religion is unless stated otherwise. "create_pop = { culture = spanish religion = shinto size = 2000 }" will create 2000 Shinto Spaniards, and

Code:
OSU = {
	color = { 206 15 61 }
	
	country_type = recognized
	
	tier = principality
	
	cultures = { yankee }
	religion = mahayana    # NOTE THIS LINE
	capital = STATE_OHIO
}

will create a Buddhist Ohio.
 
  • 17
  • 2Love
  • 2
  • 1
Reactions: