牧游社 牧有汉化翻译
Imperator Development Diary - 8th of April Trin Tragula, Imperator
Hello and welcome to another Development Diary for Imperator Rome! 大家吼啊,欢迎来到新一篇帝皇:罗马开发日志!
Today we will be talking about how you can assign your units Objectives that they will perform for you, and how to mod these. We will also give a summary of the starting situation in the Balkans and Dacia. 今天我们会谈一谈如何为你的部队分配将为你执行的目标Objective,以及其如何通过mod修改。我们还会概述一下巴尔干半岛和达契亚的开局情况。
Unit Objectives 部队目标
As you may have noticed in our streams automation is now an integral part of playing the game, should you want to. Unit objectives are a way to outsource the management of some armies to the AI, essentially using the same things that the AI itself uses to control its armies and navies. You can at any time select an objective for each army or navy under player control (or several units at once, in which case the objective applies separately to each one currently), which enables AI for said unit, making it automatically take actions almost as if it was controlled by an AI country. 可能你已经从我们的直播中观察到了,现在只要玩家们有此意愿,我们的游戏组成就将包含自动操作部分。部队目标Unit Objective就是将部分军队的管理外包给AI,本质上其将使用与AI控制陆军与海军时所使用的相同逻辑。你可以随时为控制下的每一支陆军或海军选择一个目标(或者同时选择多个单位,此时目标将同时各自适用于当前部队),这样将为上述单位启用AI控制,使它们像AI国家控制一样的自动行动。
We don't see this as something you use for your main armies but it can be useful for any secondary armies or forces left behind to control or defend your country. Split/merging/consolidation/abilities are not used by objective units except specifically where it's a necessity. 俺们寻思这不是给你主力部队用的玩意,但这对置之不理或留在后方守家的二线部队非常有用。除非特别需要,不然拥有目标的部队不会使用拆分、合并、整合或部队能力。
The design goal with objectives to simplify the codebase on our end, expose unit behavior to modders in a modular fashion, and ultimately to provide the player with a greater amount of variation in NPC behavior. 目标机制的设计目的在于简化代码库,以模块化方式将部队行为表现给Mod作者们,并最终为玩家提供更大量的多样化NPC行为。(然后就能抄了)
While you may not want to sign away control of all of your armies to the AI the AI objectives makes it possible for you to let the AI handle some of your armies, while you focus on others. 虽然你可能不希望把全部军权移交给AI,但AI目标可以让AI处理你的部分军队,而你则可以专注于其他军队。
Available objectives
可用目标
Naval Landing: Functionally similar to EU4 auto transport. If there is at least one available navy which has had Naval Landing selected, clicking to an inaccessible city with an army will make this navy pick up that army and ship it to that city.
海军登陆:功能上类似EU4的自动运输。如果有至少一支可用海军选择了海军登陆,那么为军队点击一个不可进入的城市将使这支海军装载该陆军并将其运送到这座城市。
Independent Operations: Will turn on the regular army AI for this unit. Making it operate freely, attacking enemy armies, occupying enemy cities, etc.
独立行动:将为所选单位启用常规的陆军AI。这将使其自由操作,攻击敌军,占领地方城市等等。
Defend Border: Regular AI as above but stays within country's borders, effectively just doing defensive tasks.
防守边界:和上述相同的常规AI,但只会止步于国境线前,有效地执行防守任务。
Reconnaissance: Patrols across the country's borders reporting enemy movements.
侦察敌情:跨越边境进行巡查,并报告敌军动向。
Fight Rebels: Army will focus on destroying any armies owned by the Rebel tag (Slave Revolt stacks).
镇压叛乱:陆军会专注于消灭任何带有叛军标记的军队(奴隶起义军)。
Keep in Reserve: Avoid contact with enemies while staying within country borders. Mostly because a common experience is MP is forgetting troops you're currently not using and having them destroyed when looking elsewhere.
留作预备:留在国境以内避免接触敌军。这个功能存在的主要原因是多人游戏时人们总是会忘记有些当前不使用的军队,而在关注其他地方时这些部队就会白给而被摧毁掉。
Hunt Fleets: Search and destroy enemy fleets.
猎杀舰队:搜寻并摧毁敌方舰队。
Special Unit Objectives 特殊部队目标
There are also many Unit Objectives that you cannot pick but that you may still encounter. Disloyal Generals will make use of a specific unit objective where they essentially do what they themselves want to. Making you unable to order them around or do things like send them to a certain death. Likewise Mercenaries that you do not pay will stop taking your orders and operate on their own. 还有很多部队目标是你不能使用但仍然会遇到的。不忠诚的将军将使用特殊的部队目标以求不受君命。这会让你无法对其下令或者做一些诸如逼他们送死的事情。同样地,你不再付薪水的雇佣兵也将停止接受你的命令并独立运作。
There is also special logic for Slave Revolts, where rebel stacks will seek out the closest rich city to attempt to loot and set free more of their kin. 奴隶起义也有特殊逻辑,叛军将寻找最近的富裕城市,试图进行劫掠并释放更多他们的同志。
Another good thing about the Unit Objective AI system is how moddable it is. @Chaingun who created this system will now talk a bit about that before I then continue to summarize the last part of the map. 部队目标AI系统的另一个好消息是其非常容易MOD化。创建这个系统的@Chaingun现在会谈谈这些内容,然后我再继续概述最后的地图部分。
Modding 模组编辑
Internally, many behaviors such as rebels, disloyal generals and units trying to join up with the target unit of the Recruit to Unit action are also represented as objectives and thus moddable to a degree. 从内部来说,许多行为诸如叛乱分子、不忠将军和在征募到部队Recruit to Unit行动中试图与目标部队汇合的军队都将用目标机制来表现,所以它们在某种程度上是可模组编辑的。
Some objectives started out as hardcoded early in development and still are, but they are still present in the files so they can be tweaked by modders. We may in addition port non-objectives such as piracy, barbarian behavior to the objective system in the future, as well as e.g. subject stances from EU4. In fact, you could probably implement your own variation of subject stances in a mod already. 有些目标起始于开发早期的硬编码,而其现在依旧如此,但它们仍然存在于文件中,所以可让MOD作者进行调整。此外我们还可能将海盗、蛮族行为等非目标移植到目标系统中,就像EU4的附庸指令。事实上,你可能已经在Mod中实现了自己的多种附庸指令。
For those familiar with finite state machines, you may draw upon the comparison of a unit corresponding to a FSM and an objective to a state. Don't worry if this is unfamiliar, it's a very simple concept dressed in fancy words. What it means simply is, objectives are mutually exclusive and a unit will have precisely one at a time. Transitions from one objective to another can happen in these ways: 对于那些熟悉有限状态机的人,你可以利用对应于有限状态机的部队与对应于状态的目标之间的比较。如果你不熟悉也不用担心,它只是个看起来花哨的简单概念。简单来说,目标之间是互斥的,一个部队只能同时拥有一个目标。从一个目标到另一个目标之间的转变可以通过这些方式实现:
The player select a new objective from the GUI (requires interface_allow trigger to evaluate to true to be listed).
玩家从GUI中选择一个新目标(要求interface_allow触发器评估为true才能列出)。
The objective is automatically switched to due to having a priority above zero (requires allow trigger to evaluate to true).
由于优先级高于0(要求allow触发器评估为true),目标会被自动切换。
Code is hardcoded to switch to certain objectives (e.g. naval landings).
代码被硬编码切换到某些目标(例如海军登陆)。
Since I've started to mention various script features, let’s take a look at an example script: 由于我已经开始提到各种脚本功能,那就让我们来看一个示例脚本(感兴趣的读者请去原文页面阅读):
[color=inherit !important][backcolor=rgba(246, 246, 246, 0.88)]Imperator Development Diary - 8th of April​forum.paradoxplaza.com
interface_allow and allow have already been mentioned. If any objective should be possible, allow should evaluate to true. However, if it needs to be invisible and not selectable by the player, the interface_allow should evaluate to false. An objective with greater than zero priority will also be automatically switched to whenever allow evaluates to true and there is no higher priority objective that takes precedence. 我们在之前已经讲过interface_allow跟allow了。如果某项目标可行的话,allow则将评估为true。然而如果某项目标不能为玩家看见以及所选择的话,interface_allow则将评估为false。只要allow为true并且没有其他优先级更高的目标排在前面的话,将自动切换至任何优先级大于零的目标。
There is one very central concept that hasn't been explained yet: Weights/scores/values. These basically represent how much a unit wants to go to a certain city, or more accurately given the scale where higher scores are worse, how much it doesn't want to. For the AI inclined, this is basically a utility function. 我们还需要解释另外一项非常核心的概念:权重/分数/价值。总而言之,它代表的是一支部队前往某座特定城市的意愿程度,或者更准确地说,它能根据等级说明得分更高的城市其实(在AI看来)更加糟糕,即部队不愿意前往该地区的程度。对于有倾向性的AI而言,这基本上是一个效用函数。
So how do you mod the utility function? You can set the mode field to add your own value to the existing function (recommended) or replace for hardcore modding which completely ditches the existing function. Then, you can specify the weight per city with the weight field, where the not so aptly named scope: province represents the city being evaluated (the default scope is the unit). 所以你要怎样为这效用函数做MOD呢?你可以设定状态字段,并把你自己设定的值添加到现有的函数中(推荐这样做),或者弄个替代原本硬编码的模组,也就是说把现有的函数全盘替换。然后你就可以在权重字段中专门设定每座城市的权重了。函数里面命名得不是特别准确的scope: province代表着被估值的城市(默认作用域是部队)。
It should further be mentioned that there's a lot of hardcoded behavior behind the scenes by default, including hardcoded prioritization outside simple greedy value maximization. Quite often, to get sufficient control, it is necessary to set pure_weight = yes to disable this hardcoded prioritization if it doesn't fit with whatever behavior you intend to accomplish. Example of this prioritization is whether to decide to siege or initiate battle depending on certain circumstances that are orthogonal to the utility function's output. 值得进一步再提的是,默认设定中还有很多没有说明白的硬编码程序行为,包括除简单的数值最大化以外的硬编码优先级。通常而言,如果当前权限与任何玩家希望达成的程序行为不相符的话,玩家有必要把pure_weight设定为true以获取足够的权限,最终禁用此硬编码优先级。此优先级的例子包括到底选择围城还是发起战斗,这都取决于某些特定的与效用函数的输出数值成正相关的环境。
What does the utility function score mean? Currently, anything greater than or equal to one million means the unit will not go to the location. Peaceful movements typically lie in the range of one hundred thousand, whereas sieges are usually about fifty thousand, and battles around twenty thousand. 效用函数分数指的是什么呢?目前,所有大于等于一百万分数的都意味着部队不会前往这个地方。和平的、不涉及武力争端的移动通常分数在十万上下,而围城的分数约为五万,战斗大概是两万。
Be aware that the weight scale might be changed in a future version as the one in use heralds from EU4 and has some issues in relation to fixed point overflow in modding. 不过你们要留意,由于目前正在使用的权重等级将率先在EU4中使用,而且在制作模组时存在一些问题可能导致在固定点溢出,因此在未来的版本中,权重等级可能还会改动。
You can visualize the weight scale by typing "mapmode ai" into the console and selecting a unit of yours (please make sure you let game tick a day first or it may crash). It will result in a color coded map with a tooltip like this: 你可以通过在控制台输入“mapmode ai”,并选中一支你的部队(请确保你先让游戏时间走一天,不然的话游戏可能会崩溃),从而使得权重等级可视化。结果会出现这样一张带有工具提示条的用颜色进行区分的地图:
While at this, I should explain that the regular utility function's output aside from some other nonlocal factors will depend on what objective is currently is selected, whether the AI is enabled for the country (ai in console), and what role the army has been assigned by AI. A brief mention on unit roles: Armies are casually assigned as either siege armies or hunter killers where the latter will prioritize killing enemy armies more highly than besieging in the default configuration. 说到这里,我有必要解释一下,除其它一些非局部因子之外,常规效用函数的输出将取决于当前选择的是哪一目标、AI(控制台AI)对该国家是否可用以及AI把何种角色委以部队。稍微再提一下部队角色:部队会被随机指派为攻城部队和猎杀部队。在默认设置之下,相比于围城,后者将把重心更加放在击杀敌军之上。
There is another concept you will probably come across while modding unit AI: Threat, which can be checked with the unit_threat trigger. The threat value is an influence map (sorry, another AI term) calculation. Currently it can only be seen in the Release D version in Steam by typing "ai.map threat" in console (will sort this out, we have a problem with engine hiding most debug commands in release). A threat value of 1.0 is an enemy the same size as the unit is fairly close, a value of 10 that enemies nearby are 10 times as strong, etc. A screenshot I had lying around from an old version: 在做有关AI部队的模组时,你还可能会遇见另外一项概念:威胁度。它能通过unit_threat触发器得到检查。威胁度的数值是一张影响图(不好意思又在说人工智能专业术语了)的计算结果。目前你只能在Steam上的Release D版本中输入“ai.map threat”才能见到它(我们现在面临着一个问题,在公开发行的时候游戏引擎会把绝大部分debug指令隐藏掉,我们会尽快解决这个问题的)。1.0的威胁度指的是敌军的规模与己方规模相对接近,10的威胁度指的是敌军差不多10倍强于玩家。这是一张我从旧版本就保留下来的截图:
So what objectives does the AI currently use? Only objective_null (the default, represents having no objective at all and means the unit is player controlled or controlled by regular AI) and objective_naval_landing which is used for AI naval transport and player autotransport. Objectives linked to code like naval landing has a lot of hardcoded magic inside it and will probably be quite difficult to modify in a sensible manner other than minor tweaks to the utility function. 所以AI现在用的是什么目标呢?只有objective_null(默认的,代表根本没有部队目标,并且意味着部队由玩家或常规AI控制),和用于AI海上运输和玩家的自动运输的objective_naval_landing。与代码相关的目标里还包含着很多硬编码,相比于对效用函数小修小改,想要以正常的方式对其做改动应该是比较困难的。
Finally, a note on performance: When you script unit AI all bets are off whether you will be able to run it without causing performance degradation of the game. Tweaking the following defines can be useful: 最后是关于实际性能的介绍:如果你编写部队AI的脚本,我们也不知道到底会发生些什么,有可能你的脚本可以运行而不会导致游戏性能下降。将以下的定义稍加改动说不定会起到效果:
MAX_UNITS_PER_TURN = 200
TACTICAL_DEPTH = 60
Use the "timing show" and "ai.pawns" console commands to find out what is causing slowness and how responsive the unit AI is. The AI has an internal execution time allocation system to process important units more frequently than non-important ones (as by size, vicinity to human players, time since last processing, etc.) 使用控制台命令"timing show"可以找出使游戏运行缓慢的原因;使用"ai.pawns"可以检查部队AI的响应性。AI有一个内置的执行时间分配系统,这样它就可以更频繁地处理相对来说更加重要的单位(重要性根据单位的规模、距人类玩家的距离以及距上次处理的时间等因素判断)。
Thank you for listening. This is a merely a part of the AI and I haven’t touched into all details, but hopefully one that you will be able to create great mods despite the opaqueness. 感谢聆听。这里,我所说的只是AI系统的一部分,还没有讲到所有的细节,不过就算有这么多未知的细节,希望你们仍然可以做出很棒的Mod。
Dacia & The Balkans 达契亚与巴尔干
Lastly we turn to one of the last regions so far not covered by our Development Diaries. The Balkans! 终于我们来到了还没有在开发日志中介绍过的地区之一:巴尔干!
Much like many of the regions we have covered in these diaries the Balkans and the greater Danubian region in the time of Imperator was primarily dominated by tribal entities. This is a region with strong influences from both the Hellenic world, and subject to a great influx of Celts. More directly this is a region that would come under pressure from the expanding Roman Republic and which was the frequent scene for Macedonian excursions, first under Alexander and the Argeads, but also from the successor kings such as Lysimachos in Thrace. It was also through this region that the Celtic peoples that settled in central Anatolia, the Galatians, came migrating, clashing with both locals and greeks alike. 像我们之前的日志中介绍过的地区一样,在帝皇:罗马的时代,巴尔干地区和大多瑙河地区主要被一些部落实体所控制。这个地区既受到希腊化世界的强烈影响,又有大量凯尔特人涌入。更迫切的是,这个区域会受到不断扩张的罗马共和国的压力,这也是这一地区遭受马其顿入侵时的常态,先是亚历山大大帝和阿吉德王朝,再是继业者诸王例如色雷斯的利西马科斯Lysimachos in Thrace。有大量的凯尔特人移民,即最后定居在安纳托利亚中部的加拉太人经过这个区域,他们与本地人以及希腊人都产生了冲突。
The native inhabitants of the region, Illyrians in the west and Dacians in the east are divided into many smaller tribal states. As in other regions we have covered, a successful tribe may aspire to form a tribal federation, Dacia or Illyria. 这个地区的原住民有西边的伊利里亚人以及东边的达契亚人。他们被分为许多小型部落国家。与我们介绍过的其他地区相似,一个成功的部落会寻求建立一个部落联盟:达契亚Dacia或者伊利里亚Illyria。
Starting Countries:
起始国家:
Getia: The game's largest Tribal state of Getians. Comparatively strong in its region but less densely populated that some of the neighbors to its south.
基提亚:游戏中基提亚人最大的一个部落国家。在其所在的地区相当强大,但是与其南方的邻国相比人口较为稀疏。
Tyrgetia: Small Getian tribe on the river Tyras (right next to a Hellenic City on the estuary state mentioned in an earlier diary).
提拉戈提亚:提拉斯河River Tyras(今德涅斯特河)附近的一个小基提亚部落(它与之前日志中提到过的一个在提拉斯河口处的希腊城市相邻)。
Moesia: Settled tribe in Upper Thrace, medium power in the region and a potential danger to the kingdom of Thrace to its south and east. Not much is known about the Moesians before the end of this era when they encounter the Romans.
默西亚:上色雷斯地区的一个定居部落,是本地区的一个中等强权,是它东南方的色雷斯王国的潜在危险。我们对这个时代的默西亚人没有什么了解,直到他们后来与罗马人打交道为止。
Triballia: Settled tribe along the Danube. In frequent conflict with the Getians and the Macedonians, both before and after our era.
提里瓦伊:多瑙河畔的定居部落。在我们时代的之前以及之后,它都与基提亚人和马其顿人时常发生冲突。
Dardania: One of the stronger kingdoms of this region, Dardania has a history of meddling in the politics of all surrounding, including Macedon, which they have at times been a de facto had quite strong influence over. More recently however it has been a subject under Macedon. With Alexander’s death however Dardania is free and, like Taulantia to its south, quite likely to once again end up at odds with Macedon.
达尔达尼亚:这个地区最强大的王国之一。在史上,达尔达尼亚常常干涉周边国家的内政,包括马其顿。有时它对马其顿有着事实上的强大影响。然而在最近的一段时间里,它都是马其顿的一个附庸国。不过在亚历山大大帝去世之后,达尔达尼亚重归自由。与南边的陶兰提亚Taulantia一样,达尔达尼亚可能会再次与马其顿开启争端
|