• 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:
About the debug mode - what about filthy cheaters like me? I sometimes like to play around with the console, but when I tried to to this in CK3 I was annoyed with the pink debug text everywhere without any option to turn that on/off in game and keeping the console. (It was only possible to turn debug mode off via console, but this also locked access to the console.) (At least that's how it worked around release I haven't played CK3 since then.)
 
  • 2
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
I am not a dev, nor a modder, but I have a few cents that could be used here.

1) I think making certain cultures/races a certain pop type could work here? Orcish workers being different than Elvish workers you can just use the thing where pop types have different needs and wants, so you add iron into a new category and Orcish worker type pops would have to consume a good in that category, usually iron since it's the only thing there.

2) Above could work here. Elven mage pop type would be only achievable by elves and the building would apply that pop type? I think these are possible but ask the devs again.

3) Ofaloaf answered this one.

4) I think you could add a background event that checks if there are elves and humans in the same province, takes a proportion of their populations and since there is a create_pops command now it then creates half elf pops. I am very sure this would work, maybe similar to slave population growing events in modded Victoria 2.

Just my two cents but I would love to know if these solutions are applicable! @Ofaloaf
 
About the debug mode - what about filthy cheaters like me? I sometimes like to play around with the console, but when I tried to to this in CK3 I was annoyed with the pink debug text everywhere without any option to turn that on/off in game and keeping the console. (It was only possible to turn debug mode off via console, but this also locked access to the console.) (At least that's how it worked around release I haven't played CK3 since then.)
Pink debug text is simply the price you must pay for your sins.
 
  • 28Haha
  • 5
  • 4
  • 2Like
  • 2
Reactions:
Love the DD!

I feel like Victoria 3 would be ideal for a country designer - something not unlike EU4's country designer and CK3's ruler designer. Has the team given this any thought? Perhaps as a post-release patch or DLC?

About the debug mode - what about filthy cheaters like me? I sometimes like to play around with the console, but when I tried to to this in CK3 I was annoyed with the pink debug text everywhere without any option to turn that on/off in game and keeping the console. (It was only possible to turn debug mode off via console, but this also locked access to the console.) (At least that's how it worked around release I haven't played CK3 since then.)
There's some good mods that allow you to toggle debug mode on and off in-game as needed, such as "Debug Toggle (Less Invasive) 1.7".
 
  • 6
  • 1Like
Reactions:
Nice !
Althought the debug error about trade routes surprises me : is this an issue that the new USA cant remove it/ reduce it on its own ?

Cant wait to start playing... and then starting messing up by adding a bunch of releasable to... decentralize and free up my opponents. While creating red tape for my red tape for my red tape institutions ;)
 
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.
That's not really what I asked. Ok, let me clarify on what I meant:

So, I want to make a mod where almsot entire world is not colonized, but considering that there's probably no just empty land, I guess it would have to be filled with decentralized nations. But it's quite a hefty work to be done with this, at least manually. And my question was about what if I define only countris that I want to be present on the map? Would the game crash or automaticly create a decentralized nation for each state that has no history entry, besides population and culture?
 
Will localisation-only mods be non-Ironman compatable like they are in Rome and (afaik) CKIII? It was really annoying to not be able to have mods to add the Gregorian date or to change religion names or something while going for achievements.
 
Is there a quick way to turn every province into it's own state region so? By doing so we'd have migration stats per province and also can claim individual provinces in states. (I guess infamy, war cost and such will need to be weighed down).

This all coming at the cost of performance sure :)
 
  • 1Like
Reactions:
Nice !
Althought the debug error about trade routes surprises me : is this an issue that the new USA cant remove it/ reduce it on its own ?

Cant wait to start playing... and then starting messing up by adding a bunch of releasable to... decentralize and free up my opponents. While creating red tape for my red tape for my red tape institutions ;)
I would assume that the game just doesn’t create or does then deletes that trade route since it’s invalid. The error message is a heads up to let you know so you can fix it.
 
  • 2Like
  • 1
Reactions:
Will localisation-only mods be non-Ironman compatable like they are in Rome and (afaik) CKIII? It was really annoying to not be able to have mods to add the Gregorian date or to change religion names or something while going for achievements.
As the devs have said on the achievements DD,Ironman and a valid checksum are no longer necessary for achievements,precisely,among other things,for what you have mentionned.So no,localisation mods will no longer affects the ability to have achievements anymore.
 
  • 2
Reactions:
There's some good mods that allow you to toggle debug mode on and off in-game as needed, such as "Debug Toggle (Less Invasive) 1.7".
Of course, but it's still disappointing that once again we have to use mods to get close to functionality we had in older titles. Console is a great tool for roleplaying and fixing bugs and other issues on the fly, debug mode is a whole different (and intrusive) beast and the two shouldn't be permanently linked.
 
  • 3
Reactions:
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...
Vic3 lets nations/states be defined with more the one primary culture though, no? What happens if a state is defined with primary cultures that don't share a religion -Yankee and Japanese, for example?
 
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
While waiting if it is possible to block directly a culture to be converted, depending on how moddable the accepted cultures are (like can one create more layers that check not for one, but 2 traits) you could have a "human" trait and simply disable complete acceptance.

Althought would make it impossible to accept ghouls then on law level without having to make it accepted on state/tag level
 
From what I can see here, what determines the capital is not a specific province like in V2, but the state/region. Does that mean that if we wanted Independent Ohio's capital to be, for example, Cleveland, we'd need to create an all new state called North Ohio with Cleveland as the state's capital?
 
Looks like it should be pretty easy to get into modding this game. Another positive development.
 
  • 1Like
  • 1
Reactions:
Is it possible to create laws that are only available to one country? I'm thinking about making a mod in which the US still uses the Articles of Confederation, but can amend it to grant more power to the central government. It seems like the best way to represent it would be to have various laws that only the US has access to.
 
  • 2Like
Reactions:
About the debug mode - what about filthy cheaters like me? I sometimes like to play around with the console, but when I tried to to this in CK3 I was annoyed with the pink debug text everywhere without any option to turn that on/off in game and keeping the console. (It was only possible to turn debug mode off via console, but this also locked access to the console.) (At least that's how it worked around release I haven't played CK3 since then.)
There are mods that can enable/disable debug_mode without the -debug_mode parameter (Cough cough, my mod and it did have that functionality since release). So you don't get all the pink stuff.

You guys gave some mod teams early access to CK3. Are you guys thinking about doing the same for Vic3, if so where can I sign up? :p
 
  • 2Like
Reactions: