维多利亚3开发日志#60 | 9/29 模组-雪花漫画

牧游社 牧有汉化翻译

Victoria 3 - Dev Diary #60 – Modding

Ofaloaf, Content Designer

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.

那么,让我们从头开始!当你启动维多利亚3时,游戏的启动器会出来迎接你。在启动器的左上方可以看到四个小选项:主页(Home)、下载内容(DLC)、模组(Mods)以及游戏设置(Game settings)。继续,你知道你想这么做。

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.

在模组菜单中,你会看到三个按钮。点击中间的“模组工具(Mod tools)”,如果你没有任何模组,你就会看到创建新模组的提示,否则就需要找到菜单上的按钮并点击,最后弹出创建新模组的提示。

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.


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


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!"

找到目录了吗?好,直接进去,你会发现一个名为“.metadata”的文件夹,里面有一个名为“metadata.json”的文件。启动器打开模组时需要读取和检查的所有数据都存储在这个文件夹和这个文件中,包括模组名、版本号(如果需要的话)等等。如果以后还想要修改这些内容,尽管去改,但我们今天不会触及这部分内容。回到主目录,可以发现这个模组的地址在“[...]\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.

让我开始定义Ohio吧。完全复制游戏本体中所用到的路径,这样游戏才能正确读取,这是模组设置中的关键。在维多利亚3中,国家定义文件被存储在“Victoria 3\game\common\country_definitions”中,因此需要在“It's Ohio!”目录中创建“common”文件夹,在这个文件夹中继续创建“country_definitions”文件夹。这参照了游戏本体的路径(即“Victoria 3\game”),所以当游戏读取这个模组并试图找出它与游戏本体的交互方式时,不会出现尖叫和死亡。

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:


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:



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.

所有这些都需要从游戏本体中将文件复制过来——很遗憾我们不能直接在新文件中添加新条目,因为还需要在上述文件中移除/替换与美国相关的数据。请确保在“It's Ohio”模组文件夹中复制了这些文件路径,就像在“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


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


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:


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

希望你已经理解了我们正在进行的改动的套路——这里我们再将“country = c:USA”改为“country = c:OSU”,这样整个STATE_OHIO一个就变成了:

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


Checking our work


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.


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!”

启动器会提示播放集为空,因此我们点击“添加mod”按钮,这样就能添加mod了,然后将“It's Ohio!”添加进去。

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


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".


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


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.

出现了错误!让我们在“...\Paradox Interactive\Victoria 3\logs\error.log”打开错误日志来看看其中的错误信息。当你在制作mod时,经常通过调试模式进入游戏并尽量解决错误日志中出现的问题,其有用性是如何强调都不过分的。

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.我没有给俄亥俄tag(OSU)设置本地化文本!我会在修复以下两条错误以后进行设定。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.没有对俄亥俄的初始人口繁荣度进行设定(在单独的“populations”文件)。

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.

国家历史包括了科技和政治。为了减轻工作量而非从头编写一切,我会将原版游戏中与俄亥俄情况非常相似的比利时的国家历史粘贴过来。我只需要从游戏中找到“common\history\countries\bel - belgium.txt”文件,将其粘贴到mod中的相同路径,重命名为“osu - ohio.txt”,然后就可以打开这个文件。其中包含一个以“c:BEL”开头的部分。这个部分通过多个效果设定了游戏开始时的法律和统治国家的利益集团。我只需要将c:BEL改成c:OSU,这样那些政治和科技的效果就会应用于OSU,最后保存并退出文件。

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.

另外一个需要添加的历史文件是人口文件。人口文件中编码了一些效果来为全国的初始人口设定健康程度和识字率。我们找到比利时对应的“common\history\population\bel - belgium.txt”。和国家历史一样,粘贴并重命名为“osu - ohio.txt”(只要名字不和已有历史文件重合,就不会错误覆盖掉其他文件,但保持统一有助于管理),然后在文件中将作用域c:BEL改为c:OSU,这样人口文件的效果就会应用在俄亥俄人上。

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

说到“俄亥俄人”,我们来搞定国名的事。游戏中的本地化文件储存在“Victoria 3\game\localization”中,并且按照游戏的语言进一步细分。我是说英语的,所以就默认设定在英语的文件中了。我们先在mod路径中创建一个英语本地化文件夹(也就是“It's Ohio!\localization\english”),然后再在其中创建自己的迷你本地化文件——为了扣题我们就叫ohio_l_english.yml吧。下面需要向文件中写入的就只有:

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.

一些具有mod制作经验的人可能会注意到,在原版的本地化文件中,通常在条目的冒号后面还会有一个数字(比如FRA:0 "France")。这些数字只是用来提醒我们和本地化小组每个条目何时经历了改动并且需要再次翻译的——除此之外没有实际意义,如果你只使用一种语言制作mod,并且没有考虑过像我们一样使用这种方法对你的mod进行翻译,那么就没有必要在冒号后面加上那个数字。

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


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!


翻译:格拉摩根伯爵 李勋回来了






本作品英文原文著作权属Paradox interactive AB所有,中文译文著作权属牧有汉化所有。 

Arty Huang - Yu Miaoyi[30P/32M]
【Silverxhere】 Reika [12P 76MB]
「Robin」Bimilstory Vol.02 - Big Boob Girl [96P1V-2.48GB]
[pixiv] 插画今日排行榜 2023年6月12日
【清易CG-65 剖面细管式温度传感器】不仅仅测量土壤剖面温度细管式温度传感器可以剖面测量土壤温度,产品展示