三小白角钢

角钢
分享不同类型角钢的相关知识
三好角钢-国内优秀角钢生产厂家与产品分享

钢铁雄心4开发日志 | 2/21 Performance and AI钢铁雄心4开发日志 | 1/30 IJN战报日志

更新时间:2021-10-14 16:46:09点击:

Groogy, DemiModerator

 

Hello! I’ve been drafted from EU4 to fight in the trenches together with the HOI4 team for a month and give some support on AI and performance. So I’m here to talk about those.

牧游社 牧有汉化翻译

 

大家好,我从EU4临时转到钢4队伍的战线,要与他们同甘共苦一个月,并提供一些对AI和性能上的技术支持。所以这次由我来讲解相关内容的日志。

HoI4 Dev Diary - The Imperial Japanese Navy (AAR)

Archangel85, Vice Deputy Content Lead HoI 4

AI

I’ve been mostly devoting my time into improving garrison orders to solve some really wonky cases that could happen. Like it placing two units on Magdeburg instead of Berlin letting the capital be completely exposed. But also focused on making the garrison work a lot better when you don’t have enough troops to cover every point in the order that needs it.

 

Hello, and welcome back to another Dev Diary from the frozen wasteland that is Sweden in January. Today, we will have another short AAR of a naval warfare scenario, similar to the one we did earlier about raiding and submarine warfare.

我花的大部分时间都用在改善驻军行为上,以免出现一些让人头疼的诡异情况。比如AI会把两个单位(师)部署在马格德堡以至于首都柏林完全暴露。在驻军没有足够多力量控制所有关键位置的情况下,我也花了心思让AI表现得更加出色。


First I implemented a new tool for HOI4 to let us programmers visually inspect what the unit controller is up to.

首先我为钢4的开发团队启用了一款新工具,让程序猿们来可视化检查单位的分配情况。

大家好,欢迎回到来自一月封冻废土瑞典的新一篇开发日志。今天我们会有一篇短的海战场面的战报,与之前我们关于掠袭和潜艇战的日志相似。

 

This was played as an MP game between me and Niall (@Ceebie), with me defending the Empire of Japan’s honor against Niall’s filthy American imperialists.

这次我将在多人游戏中对抗Niall (@Ceebie)扮演的肮脏的美帝国主义者,捍卫日本帝国的荣誉。

钢铁雄心4开发日志 | 2/21 Performance and AI钢铁雄心4开发日志 | 1/30 IJN战报日志(图1)

 

Starting as Japan, I immediately face a number of issues that should sound very familiar: I have very limited resources, particularly in terms of oil. This is now a much bigger issue as I can still happily build ships and airplanes and tanks, but I won’t be able to run them for free. However, if I want to upgrade my ships (and knowing Niall, I absolutely do), I will need naval experience, and China is unlikely to provide me with a lot of it. So I need to run training missions for my fleet, which gobbles up fuel at a rapid pace (I could only take out my main fleet units for a few brief weeks before the fuel situation became critical).

Province Weights
省份权重分级

钢铁雄心4开发日志 | 2/21 Performance and AI钢铁雄心4开发日志 | 1/30 IJN战报日志(图2)

State Weights
国内权重分级

作为日本,我在开局时便面对一系列应该听起来很熟悉的问题:我的资源非常有限,特别是石油类资源。在现在的版本中这是一个更大的问题:我仍然可以高兴地建造船只、飞机和坦克,但却不能免费地(不消耗燃料)使用它们。而且,如果我想升级我的船只(知道Niall也会升级他的船只,我当然也要这样),我需要海军经验,但是中国没法为我提供多少经验。所以我需要让我的舰队执行训练任务,但这会以极快的速度消耗燃料(在燃料状况变得严峻之前我只能让我的主力舰船单位进行短短几周的训练)。

After that came the big task, rewriting garrison order and how it assigns units. There’s been a lot of issues here and you’ve probably experienced them from time to time. Shuffling, units prioritizing the wrong states or provinces, the list goes on.
之后就是最重要的内容了,我们重新编写整个驻军的行为与部署脚本。之前就经常有许多玩家被这类问题折磨得死去活来:部队来回转移,单位对国家或省份内地区部署优先级错误评估,以及其他好些毛病。

钢铁雄心4开发日志 | 2/21 Performance and AI钢铁雄心4开发日志 | 1/30 IJN战报日志(图3)

So what did I do that is new. Instead of having the old logic setting up rules for where units should go I went with a thing I hate. Mathematics. The main difference is that each state will sort of calculate how “painful” it is to remove a unit from it now. This means as each state goes through this, they will be trying to find the least painful way to perform the garrison order and will eventually settle on a sort of equilibrium.

我采取的方法是一个新路子。旧算法会用我讨厌的数学规划的老旧逻辑来给各单位分配该去哪,所以我的方案就是启用新算法来代替。新方法的主要区别是每个国家都会一定程度上评估进行单位转移后所造成的“损失”。也就是说,各国在进行驻防单位运算时会采取损失风险最小的方法来进行规划,并且最终会找到一个合理的平衡点。

It’s given us a lot easier way to control where units should go in a garrison and where they end up will match a lot more in style of the weights you can see on the pictures above.
这使得我们能以简单得多的方法来控制各个单位该去哪驻防和他们最后呆在哪,基本符合上面那些图片所展现的规划方式。

A thing that we have been planning to do for a long time and finally got around to is to allow a more flexible way to control how the AI plays. We use a system we call “Ai Strategic Plans” for this. Its essentially telling Ai to act a certain way when it comes to national focuses and priorities based on scripted conditions. To put that in english I am going to hand over to @Bratyn for some examples:

At the same time, while I could trade for more oil, it will cost civilian factories which I desperately need to build up my own industry or to trade for steel to continue my military buildup. I decided to keep the trading for oil to a minimum in order to more quickly build up my industry and increase the size of my fleet.

另一个我们早就计划好而最近终于能开工的工作就是更灵活地控制AI行为。我们会用一个叫做“AI战略规划AI Strategic Plans”的系统来满足这个目标。该系统让AI在面对国策和预编好的脚本时能极其有效地以某种方式工作。让@Bratyn用人话来给大家举一些例子:

Some situations in which the new Strategy Plans have been useful is to ensure‘compatible’ AI behaviour in the case of an a historical Germany. A lot of the AI behaviours for the major European powers has been based on the assumption that Germany remains fascist and causes mayhem in Europe. This means that AI Italy would usually see Germany as an ally, and that AI France would eitheral ways go with the United Kingdom (if historic mode was turned on), or be so unpredictable that it was problematic for planning out and predicting alternate history scenarios.

同时,即便我能够从交易中得到更多的石油,这却会占用民用工厂,但我又迫切需要去建立工业,或是用来买入钢铁以继续建设军队。为了更快建立自己的工业并扩大我舰队的规模,我决定继续购买最低限度的石油。

新的战略规划系统在一些情况下非常有效地确保AI行为的“兼容性”,比如非史实德国。许多欧洲列强AI的行为是基于德国将维持法西斯统治并让战火席卷欧洲的情况。这意味着意大利AI会默认把德国视作盟友,而法国AI则要么一直跟英国搞好关系(如果选择史实模式的话),要么就会依照非史实剧本进行规划而最后变得相当疯癫。

Using strategy plans, we have made these AI nations partly behave more logical to the changing world scene, and partly ensure that the player will always havea challenging playthrough. Going democratic Germany, only to get your only enemy (Soviet Union) end up at war with both the Allies and yourself, is not avery fulfilling playthrough. Instead, a new strategy plan will now load for France upon German completion of the “Oppose Hitler” focus. This delays their pick of which political direction to head into until we have more information from the German player, essentially a ‘holding pattern’.

利用战略规划系统,我们让这些AI的行为能在某种程度上符合世界线变动的逻辑,并且在一定程度上确保玩家总会有充满挑战性的游戏体验。之前走民主路线的德国玩家只需要面对唯一的敌人(苏联),苏联会和同盟国与德国交战,这让游戏体验变得很难令人满意。但新的战略规划系统会让法国在德国进行“公审希特勒”的国策分支上有所变通,让其对政治路线的选择延缓一段时间,直到AI从德国玩家那里得到更多信息,本质上来说就是一个所谓的“观望模式”(holding pattern是航空术语,指飞机等待调配降落时会在等待空域的特定航线飞行)。

If Germany revives the Kaiserreich and chooses “Focus on the True Enemy”, France is released from the holding pattern and will go with Britain, forming a counter-reaction to rising German colonialism. Essentially, in this playthrough not much will change other than Germany being unaligned rather than fascist. The war will likely develop in a similar matter (though not on a similar timeline), with one war with the Allies, and one war with the Soviet Union.

如果德国恢复了帝制并选择“专注于真正的敌人”国策树路线,法国便会脱离观望模式的状态并和英国结盟,组成一个反帝制的联盟以处理日渐壮大的德国殖民主义浪潮。基本上在这局游戏中,除了德国成了君主制国家而不是法西斯以外结局没啥区别。战争的总体进程还是很相似的(虽然时间线上会魔幻一些),一方面与同盟国抗争,一方面与苏联交战。

钢铁雄心4开发日志 | 2/21 Performance and AI钢铁雄心4开发日志 | 1/30 IJN战报日志(图4)

My first target is, of course, China, and we start the war with them in the middle of 1937. It quickly becomes apparent that I underestimate the Chinese. Fighting rages hard along the border for several weeks, and a number of naval landings that attempt to force the AI to draw troops away from the main front are quickly contained by local garrisons, but at least not pushed back into the sea. Part of the problem is that the fleets tasked with invasion support contain some of my battleships, which eat up absurd amounts of fuel, and my attempts to turn the tide through prolific use of air support eat into my fuel supplies even more.

我第一个目标自然是中国,我们在1937年的年中对中国发动战争。我很快就明白我低估了中国。战火在边界肆虐了几周的时间,一些试图迫使AI将前线主力调离的两栖突击很快被当地守军所遏制,但至少没有被推回海里。一部分问题在于,入侵计划的舰队需要一些战舰支援,而这消耗了我可怕数量的燃料,我通过空中支援来扭转局势的尝试又消耗了更多燃料。

 

If Germany revives the Kaiserreich and chooses “Expatriate the Communists”, these communists will head to France and give them a communist drift national spirit. France is released from the holding pattern and will go communist, choosing to side closer with the USSR so that both powers can stand against the new Anglo-German alliance.

如果德国恢复了帝制并选择“驱逐共产主义者”,这些共产党就会流亡法国并使其获得一个转向共产主义的国家精神。法国会脱离观望模式的状态并走向共产主义路线与苏联关系更密切,这样双方能共同面对新崛起的盎格鲁-日耳曼同盟。

If Germany goes democratic, France is released from this holding pattern and will choose to Revise Versailles. Which direction they pick next is up to the AI, ensuring some unpredictability. France may go Communist and start their own faction, or join the Soviet Union, ensuring a two-front war if Germany goes to war with the USSR. Alternatively, the French may go fascist. They then will go for “Woo Italy”, creating a new semi-powerful Fascist faction in south-west Europe. Similar strategy plans for Italy (and liberal application of AI strategy values…) ensure this alliance is stable. A new focus for france “Dismantle the Democracies” becomes available if Germany is democratic, and the AI has a high likelihood of taking this when the Germans are already at war with the USSR. This makes gameplay more dynamic, and ensures Germany will have ample enemies to fight against even if they elected to go democratic.

By early 1938, we are slowly grinding forward and have managed to inflict serious casualties on the Chinese, but my fuel stockpile has shrunken to just 30 days of current use. I curtail air support to only support my main thrust and send the naval forces providing shore bombardment back to port. Progress slows, but eventually we link up with the landing forces, at least saving me from an embarrassing early defeat. The massive amounts of Land XP also allow me to run through the doctrine tree quite a bit faster than Niall could ever hope to. Sadly the war in the Pacific will not be fought on land.

到1938年初,我们正在缓慢向前推进,并成功地给中国造成了严重的伤亡,但是我的燃料库存按目前的消耗只够使用30天了。我削减空中支援,只用在主攻方向上,又把海军的岸基轰炸机送回港口趴窝。虽然进展缓慢,但最终我们还是与登陆部队成功会师,这至少让我免受在游戏开始没多久时便战败的尴尬。大量的陆军经验也让我能比Niall更快点亮陆军学说树。但是非常遗憾的是太平洋战争不可能在陆地上进行。

如果德国选择民主路线,法国则会脱离观望模式的状态并选择修订凡尔赛条约。下一个方向朝向哪里则取决于AI,以确保一定的随机性。法国可能走向共产主义并建立其自己的阵营,或者与苏联结盟使德国在对苏战争时要面对两线的压力。另外,法国还可能成为法西斯国家。之后他们会选择“啊!意大利Woo Italy”并在欧洲西南建立一个近乎强权的法西斯阵营。意大利也有类似的战略计划(和其在AI战略参数上毫不受限的应用)以确保联盟的稳定。当德国选择了民主路线时,在法国的国策树中出现名为“驱除皿煮分子Dismantle the Democracies”的国策,而当德国与苏联正处于交战状态时,AI会有很高几率采取该国策。这会让游戏体验更刺激,并确保德国哪怕在民主路线下也有足够多的对手。

We also used AI strategy plans to teach the Chinese AI how to handle the Inflation mechanic and do things like making the PRC AI keep the peace in China when they are going for the peaceful takeover through the political struggle. All in all, to myself and @Archangel85, this has been (and will continue to be) an invaluable tool for ensuring believable and, most importantly, fun playthroughs for each a historical paththat one can take. We hope to continue building upon this basis and make nations ‘smarter’ in dealing with alternate history situations, or just general oddities that arise in the state of the world over the course of a playthrough.
我们同样也利用AI战略规划系统来让国民政府AI学会如何处理通货膨胀机制,以及在毛先生准备用政治斗争的手段和平建国时让PRC AI保持国内和平。总而言之,对于我和@Archangel85来说,这个系统带来的价值(和长久的贡献)难以衡量,它能确保许多非史实路线的确可靠,而且更重要的是让游戏体验更加有趣。我们希望在这个系统的基础上继续迈进,并让各国AI能在应对非史实路线情况时能更“聪明”一些,或者在一局游戏里的世界发展中表现得不那么古怪。


Modders I am sure are going to like this a lot, so for you guys check out the example below for how it can be set up (regular humans without modding superpowers can safely ignore).
我很确定Modder们会喜欢这个系统,所以各位可以看看我们下面举的该如何设定的例子(没有制作Mod这项超能力的平常人各位可以毫不担心地无视)。

钢铁雄心4开发日志 | 2/21 Performance and AI钢铁雄心4开发日志 | 1/30 IJN战报日志(图5)

It would take until early 1941 for the Chinese to fall, even though the writing is on the wall by the middle of 1940. I blame the poor infrastructure and awful terrain in China - my leadership is, after all, beyond any reasonable doubt.

尽管1940年初,中国看上去就已经摇摇欲坠了,它直到1941年初才投降。我把这归咎于中国糟糕的基础设施和糟糕的地形——毕竟,我的操作是无可置疑的。

 

钢铁雄心4开发日志 | 2/21 Performance and AI钢铁雄心4开发日志 | 1/30 IJN战报日志(图6)

In the meantime, Niall has been quietly modernizing his fleet and has started his rearmament. While a good amount of his effort is spent on helping out the British in Europe, I have no doubt that he has something in store for me. While I was deeply engaged in managing the war in China, I received some out-of-game intelligence (Niall bragging in the kitchen that his destroyer swarms would annihilate me) that makes me realize that my fleet lacks some key capabilities. The starting Japanese light cruisers are fairly mediocre, most have been built during the 20ies and are not up to the task of winning a firefight against the likes of a Brooklyn Class cruiser with no less than 3 light cruiser battery modules. What I do have is a lot of torpedoes, and I invest a little into researching upgraded torpedoes and better launchers. The Japanese Long Lance national spirit gives me another perk, as it negates the enemy screening to an extend, which means that my torpedoes can hit his capitals even through 100% screening.

与此同时,Niall已经悄悄地现代化了他的舰队并且开始重整军备。尽管他相当多的努力都花费在援助欧洲的英国上,但我毫不怀疑他准备了一些东西来对付我。在我深陷中国战场时,我得到了一些游戏之外的情报(Niall在厨房里吹嘘说他的驱逐舰虫群会把我粉碎),让我意识到我的舰队缺乏一些关键能力。游戏开始时的日本轻巡洋舰十分平庸,大部分建造于20年代,不足以在对抗像是拥有不少于三个轻巡炮台模块的布鲁克林级巡洋舰的炮战中取胜。我所拥有的是大量的鱼雷,并且我也投资了一点海军经验用于升级鱼雷和更好的发射器。日本的民族精神长枪鱼雷Long Lance让我得到了另外的优势,最大限度地降低了敌人的辅助舰对主力舰的护卫效率,这意味着即便他的护卫效率有百分之百,我的鱼雷仍然可以击中他的主力舰。

钢铁雄心4开发日志 | 2/21 Performance and AI钢铁雄心4开发日志 | 1/30 IJN战报日志(图7)

So while I was slowly grinding my way across China, I also decided on my buildup strategy:

因此我在中国缓慢推进的同时,也决定了我发展海军军备的策略:

钢铁雄心4开发日志 | 2/21 Performance and AI钢铁雄心4开发日志 | 1/30 IJN战报日志(图8)

No new battleships, since they eat up a lot of fuel and I have enough to cover my carriers. However, I did later decide to build at least one Yamato-class as an insurance against Niall developing modern battleships.

不再新建战列舰,因为它们会消耗掉大量的燃料,而我需要有足够的燃料提供给我的航母。然而我最终决定建造至少一艘大和级,作为针对Niall发展现代战列舰的保险措施。

 

PERFORMANCE

A force of 4 light carriers. Japan starts with two (Ryujo and returning fan favourite Hosho), with two Zuhio class building. While these only carry 40 planes each, they will be used to provide cover for operations in and around the Dutch East Indies.

性能

拥有一支4艘轻型航母的编队。日本开局拥有两艘轻航(龙骧号和我最喜欢的凤翔号),还有两艘瑞凤级在建。即便每艘轻航仅搭载40架飞机,它们也能为在荷属东印度群岛的行动提供掩护。

 

A force of 4 fleet carriers, with another force of 4 joining later. Akagi and Kaga will be joined by 2 more Soryu class carriers and form the main strike force in the Central Pacific.

拥有一支4艘舰队航母的编队,而另一支4艘航母的编队稍后加入。赤城和加贺加上另外两艘苍龙级航母将成为太平洋中部的主要打击力量

 

Late game performance have always been a tough nut to crack for us on our games. For Cornflakes we rolled up our sleeves and got elbow deep into the code to improveit the best we could.

 

游戏后期的性能一直是我们试图攻克的难关。对于1.5版本号玉米片Cornflakes来说,我们撸起袖子加油干,深入代码层面以最大的努力解决这一问题。

A heavy emphasis on air defense and torpedoes. After researching dual purpose main armaments, I design a new destroyer class with improved AA and better torpedo armament. These are joined by a quartet of light torpedo cruisers from the Japanese focus.

 

In order to measure performance and see where it goes bad to better pinpoint what causes the slowdown I write a little script that generates this super sexy graph for us.

为了测试性能并且找到它是在哪变慢的,我写了一个小脚本,生成了这个超性感的图表。

钢铁雄心4开发日志 | 2/21 Performance and AI钢铁雄心4开发日志 | 1/30 IJN战报日志(图9)

The fleet’s main objective, however, is to provide support for landings to seize resource rich a