维多利亚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.

大家好!我是Mike,一个专心于维多利亚3内容的游戏设计师,今天我们将要讨论模组的乐趣。

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.

在P社游戏中,模组构成了一个完整的世界。有些模组对本体进行了彻底的重做,有些只是简单的小调整。我看到过一些可爱小模组,比如只是在图标中加入了某人的宠物,甚至就在撰写这篇文章时,我还在钢铁雄心的创意工坊上看到了一个用离世不久的办公室猫猫代替约瑟夫·斯大林的模组。那里总是有各种各样的模组!同样地,希望你在读完这篇开发日志后,你也能知道如何开始为维多利亚3创建属于自己的模组!

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.

最初的最初:维多利亚3与十字军之王3、帝皇罗马的内核操作方式相似,但不完全相同,这是因为他们都来源于我们采用的Jomini引擎。如果你知道十字军之王3和帝皇罗马里的游戏脚本是怎样运行的,那你基本上知道了维多利亚3模组制作中90%的内容。如果不知道,我很乐意用十字军之王3来向你展示Jomini中游戏脚本是怎样运行的(见十字军之王3的开发日志#30、开发日志#37)。

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

按下“创建(Create)”按钮,启动器会在mod文件夹中自动创建一个新目录——mod文件夹就在你的savegames和其它类似文件存储的同一个储存目录下。在我的例子,以及绝大多数你们的情况中,这一路径大概在图示的位置。

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:

在模组的“common\country_definitions”文件夹中,需要创建一个被我随意命名为“ohio.txt”的小文件,打开它,像这样坏坏地把文本粘贴进去:

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

哇哦!我们已经定义了俄亥俄。现在让我们修改history文件,俄亥俄就会出现在游戏中。

Country control of a state is defined in a couple history files, found in the following directories:

国家控制的地区被定义在几个history文件中,可以在如下目录中找到它们:

common\history\buildingscommon\history\popscommon\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.

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

接下来开始建筑目录的介绍,我们需要在建筑文件中找到“STATE_OHIO”,建筑文件在“05_north_america.txt”文件中。复制该文件,将其放入模组的“history/building”文件夹中,打开并搜索STATE_OHIO,可以找到其中一节的开头是:

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

然后从那里继续。这里发生的事情是,我们已经声明,在俄亥俄州的地域内(即“s:state_Ohio”),应该有一个由美国控制的地区(“region_state:USA”)构成美国的俄亥俄地区。但我们正建立一个独立的俄亥俄,所以所有涉及美国俄亥俄地区的数据都是无用的,会让游戏弄混。我们要做的就是将“region_state:USA={”这一行行更改为“region_state:OSU={”,因此,这一节现在是这样的:

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.

在”common\history\pops”中也要进行同样的事情。复制05_north_america.txt文件,找到STATE_OHIO条目,将控制者由美国(USA)改为俄亥俄(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:

地区历史都保存在一个文件中,因此在common\history\states\中,只需复制整个00_states.txt文件,将其放入模组目录,然后再次打开该文件并搜索STATE_OHIO。在那里,可以找到以下条目:

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.

一个地区由省份组成,而表示省份的是x加上组成世界地图的省份地图中代表省份颜色的6位代码(用6个字符表示颜色)。在俄亥俄这样的地方,一个地域中只创建了一个地区,而在诸如德意志这样的地方则更加混乱,因为可以在一个地域中创建多个地区。不过为了方便理解还是别去想德意志了,先弄明白俄亥俄吧。

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.

首先我们需要在启动器中启用这个破玩意。打开启动器,创建一个新的播放集并取名为“ohio!”或者你自己想取的名字。

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

等等……好像有什么不对。我们先退出游戏——在Steam中点击维多利亚3,打开属性,然后将启动设置改为“-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.

请你阅读错误日志并修复其中的错误。这句话甚至不光是对未来的维多利亚3的mod制作者说的。求求你……读一下错误日志并且修复其中的错误吧。

Anyways! In our case, there's four sources to these errors:

不管怎样!在我们的案例中,有4个错误的原因:

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.

让我们再次运行维多利亚3,并且希望这些错误都能被正确修正。

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!

女士们先生们,俄亥俄出现了。虽然依旧没有脚本编写设定的国旗——你可以在这里阅读更多有关国旗的工作原理和编码方法的内容(开发日志#28)——但它已经是一个可以运行的国家了。如果你想的话,现在就可以选择俄亥俄开始游戏,或者也可以进一步精雕细琢,为其编写一些事件和任务日志。你可以创建人物角色,或者将俄亥俄所有的扬基人口换成你独家的俄亥俄文化(大家通常取名像是“巴德”或者“珍内特”那样的)。你可以探索游戏本身,以及驱动游戏运行的内在逻辑!

In our Dev Diary next week, Paul will be talking about Data Visualization!

在下期开发日志中,Paul将会介绍有关数据可视化的内容!

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

校对:三等文官猹中堂

欢迎关注UP主和主播小牧Phenix!

欢迎关注牧游社微信公众号和知乎专栏!微信公众号改版为信息流,欢迎【置顶订阅】不迷路,即时获得推送消息!

B站在关注分组中设置为【特别关注】,将会在私信内及时收到视频和专栏投稿的推送!

欢迎加入牧有汉化,致力于为玩家社群提供优质内容!组员急切募集中!测试群组822400145!   

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

Arty Huang - Yu Miaoyi[30P/32M]
2023-02-25
【Silverxhere】 Reika [12P 76MB]
2023-06-13
「Robin」Bimilstory Vol.02 - Big Boob Girl [96P1V-2.48GB]
2023-06-06
萌娘资源专业站点,致力于传播二次元文化,万物皆可萌
2023-05-19
根据日本经济新闻报道,索尼宣布了将要进军中国动画市场的消息。公司将在上海成立当地法人(跨国公司在某国设立公司时,根据该国法律设立的法人),与中国企业共同制作动画、贩卖角色周边。
2022-10-28
漫画《无能的奈奈》宣布了TV动画化决定的消息,有关本作动画的更多消息,还将于日后公开。
2022-10-28
[pixiv] 插画今日排行榜 2023年6月12日
2023-06-13
公孙瓒好像不太好用了,但我还会用下去公孙瓒数据随便发一下一个小箱子的开启一个平平无奇的木箱子
2022-10-13
【清易CG-65 剖面细管式温度传感器】不仅仅测量土壤剖面温度细管式温度传感器可以剖面测量土壤温度,产品展示
2022-10-12
萌娘资源专业站点,致力于传播二次元文化,万物皆可萌
2023-05-19