• 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:
This comment is reserved by the Community Team for gathering Dev Responses in, for ease of reading.


Faeelin said:


1) Can make buildings require alternative inputs, or alternative jobs? In other words, suppose I want a magic car factory that uses fewer resources if it has a magic job. Is that doable?
Scripting production methods is probably the route you'll want to take there. Production methods can change all sorts of inputs and outputs for production, along with required workers for the buildings.

2) Can you stop cultures from interbreeding? IE, Elves and Halflings, or mutants and humans?
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?

Bearjuden said:


Is the UI moddable? I, personally, don't like the look of the 3D portraits at all - didn'tlike them in the first PDX games with them, didn't like them when V3 revealed them, and they haven't grown on me by now. Is it possible for me to just hide them by removing all portrait elements of the UI, since character depictions don't really affect the game at all? Or is the UI off-limits?
I think it's doable- we used 2D images as placeholders way early on in development, so we had functionality at one point, but I'm unsure if it still exists in that form still. Otherwise, it's more or less the same sort of GUI scripting you can find in CK3- if it can be pulled off there, it very likely can be pulled off in V3.


Ekcrbe said:


Tag: OSU
Color: View attachment 883303

Did you think you would slip this past us unnoticed?


I'm surprised you didn't try to tell us Brutus is a classic Ohioan name too.
Frankly I'm surprised at how much they let me get away with when I write dev diaries like this.


ziad5241 said:


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

Click to expand...
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.

favourites said:


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?

TheBeetlejuice said:


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.


hide said:


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.


Inspecta said:


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.


Empty.Tree said:


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.


OwenCudja said:


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. :(


SeekTruthFromFx said:


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.


PatrykCXXVIII said:


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.


FranklyJustNess said:


I might be a bit hyped for Victoria 3, but this I am hyped for much more.
I'm now incredibly worried that I might disappoint, but we will see. I've got some time next week to polish up the dev diary.


letMeIn01 said:


Do you think it is possible to make a pollution mod, where combustion using production methods create global pollution (that accumulates and is not a "capacity") which lowers food production?

It's a mod I have been dying to make, and if it is impossible I would rather find out now.
There is likely a few backend systems you will find that will help you do such that with buildings and product methods. The difficulty I can think of is going to be how to create a global statistic that applies the modifier. Theoretically doable.
 
  • 4Like
Reactions:
I don't think I could mod the simplest thing if someone held my hand on the mouse and moved it for me. But it's great that Paradox is always so supportive of the modding community.
 
  • 19Haha
  • 10
  • 5Like
  • 1Love
Reactions:
This is cute, but also what you'd expect. A few questions for the team from a HOI4 modder:

1) Can make buildings require alternative inputs, or alternative jobs? In other words, suppose I want a magic car factory that uses fewer resources if it has a magic job. Is that doable?

2) Can you stop cultures from interbreeding? IE, Elves and Halflings, or mutants and humans?
 
  • 5Haha
  • 4Like
  • 1
Reactions:
Is the UI moddable? I, personally, don't like the look of the 3D portraits at all - didn'tlike them in the first PDX games with them, didn't like them when V3 revealed them, and they haven't grown on me by now. Is it possible for me to just hide them by removing all portrait elements of the UI, since character depictions don't really affect the game at all? There's also things like fonts that I' not a fan of in V3. Is the UI off-limits? How far am I going to get most likely? Since you only talked really about in-game changes.
 
Last edited:
  • 5
  • 4
  • 3Like
  • 1
Reactions:
1) Can make buildings require alternative inputs, or alternative jobs? In other words, suppose I want a magic car factory that uses fewer resources if it has a magic job. Is that doable?
Scripting production methods is probably the route you'll want to take there. Production methods can change all sorts of inputs and outputs for production, along with required workers for the buildings.
2) Can you stop cultures from interbreeding? IE, Elves and Halflings, or mutants and humans?
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?
Is the UI moddable? I, personally, don't like the look of the 3D portraits at all - didn'tlike them in the first PDX games with them, didn't like them when V3 revealed them, and they haven't grown on me by now. Is it possible for me to just hide them by removing all portrait elements of the UI, since character depictions don't really affect the game at all? Or is the UI off-limits?
I think it's doable- we used 2D images as placeholders way early on in development, so we had functionality at one point, but I'm unsure if it still exists in that form still. Otherwise, it's more or less the same sort of GUI scripting you can find in CK3- if it can be pulled off there, it very likely can be pulled off in V3.
 
  • 14Like
  • 11
  • 3
  • 1Love
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
 
  • 4Like
Reactions:
Tag: OSU
Color:
1664468671465.png


Did you think you would slip this past us unnoticed?

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".​
I'm surprised you didn't try to tell us Brutus is a classic Ohioan name too.
 
  • 15Haha
Reactions:
I can't believe you made Ohio even more cursed by giving the entire state to an Ohio State University.
 
  • 10
  • 7Haha
  • 1Like
  • 1
Reactions:
I have an idea to create a mod that adds a personal leaderboard that can be viewed either from the main menu (not sure if that's possible) or from within game, which would show every country you've played what the highest GDP, population, and standard of living you've achieved is, what date you played until, and maybe which player objects (economy, hegemon, egalitarian) you've completed. Is it possible to create a mod that tracks this kind of meta information? Everything I've seen about modding Paradox games has been adding or modifying in-game data, rather than something like this.
 
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?
 
  • 1
  • 1
  • 1Like
Reactions:
Can you create “seasonal” traits or production modifiers? I.e., wheat farm yields increase in the fall, or Siberia in the winter causes particularly severe wastage, etc.
I would describe the seasonal flooding of the Nile or Mekong rivers.
 
  • 4
  • 1Like
Reactions: