模组制作:修订间差异

本页面讲述的内容长期有效
无编辑摘要
无编辑摘要
第1行: 第1行:
{{version|Timeless}}
{{version|Timeless}}


'''模组制作''',或者制作 [[模组]], 是修改基本游戏(有时也叫''原版'')的行为,可能是用于个人用途,也可能是要发布给其他玩家,例如,通 过steam创意工坊 [http://steamcommunity.com/app/394360/workshop/ Steam Workshop].
'''模组制作''',或者制作 [[模组]], 是修改基本游戏(有时也叫''原版'')的行为,可能是用于个人用途,也可能是要发布给其他玩家,例如,通 [http://steamcommunity.com/app/394360/workshop/ steam创意工坊].


 在所有的P社游戏中, [[钢铁雄心4]]的模组制作可以涵盖很大的范围。模组开发者们的动力可能各有不同:更好的语言翻译和本地化,更多的事件或决议,更好的地图,或是一次巨大的改造,等等。
 在所有的P社游戏中, [[钢铁雄心4]]的模组制作可以涵盖很大的范围。模组开发者们的动力可能各有不同:更好的语言翻译和本地化,更多的事件或决议,更好的地图,或是一次巨大的改造,等等。
第17行: 第17行:
*'''使用好的文本编辑器'''(例如[http://notepad-plus-plus.org/ Notepad++] 或者 [https://www.sublimetext.com/ Sublime Text]) 来编辑文件并调查多个文件。
*'''使用好的文本编辑器'''(例如[http://notepad-plus-plus.org/ Notepad++] 或者 [https://www.sublimetext.com/ Sublime Text]) 来编辑文件并调查多个文件。
*'''尽量减少对原版文件的重写'''。通过添加分开的文件并尽可能地从文件夹中加载来改善模组的兼容性和可维护性。(你的文件可以使用任何名字,文件夹中的所有文件都会被游戏加载。所以选择一个酷酷的其他人都没有用过的文件夹名字。例如: coolmod_countries)
*'''尽量减少对原版文件的重写'''。通过添加分开的文件并尽可能地从文件夹中加载来改善模组的兼容性和可维护性。(你的文件可以使用任何名字,文件夹中的所有文件都会被游戏加载。所以选择一个酷酷的其他人都没有用过的文件夹名字。例如: coolmod_countries)
*'''使用正确的合并工具'''(例如 [http://winmerge.org/ WinMerge]),来 [[Merging guide|merge between folders]], and update modified vanilla files to a new vanilla patch.
*'''使用正确的合并工具'''(例如[http://winmerge.org/ WinMerge]),来 [[Merging guide|merge between folders]], and update modified vanilla files to a new vanilla patch.
*'''备份你的工作'''以避免丢失全部进度。Consider using a source control system like [https://git-scm.com/ Git] and a collaborative forge like [https://github.com/ GitHub] to manage team collaboration, or just make a copy of the file somewhere else.
*'''备份你的工作'''以避免丢失全部进度。Consider using a source control system like [https://git-scm.com/ Git] and a collaborative forge like [https://github.com/ GitHub] to manage team collaboration, or just make a copy of the file somewhere else.
*'''使用 UTF-8 编码'''编写文本文件。
*'''使用 UTF-8 编码'''编写文本文件。
第85行: 第85行:
Names for in-game items (e.g. the name for research categories or rules like can_create_faction) can be found in the game's localization folder, inside the localization files.
Names for in-game items (e.g. the name for research categories or rules like can_create_faction) can be found in the game's localization folder, inside the localization files.


==Image file formats==
== 图像文件格式==


Use DDS format for images. Most of the files are saved in 8.8.8.8 ARGB, 32 bit unsigned sub-format. Some files (like leader portraits) are saved using 1.5.5.5 ARGB 16 bit unsigned variant.  Event Image can also be of the .tga format. Flags are saved as 32bpp .tga files.
图像应使用DDS格式。大多数文件是以8.8.8.8 ARGB 32 位无符号格式保存的。一些文件(例如leader肖像)是1.5.5.5 ARGB 16 位无符号格式保存的。事件图片也可以使用.tga 格式。旗帜是32位像素深度的.tga 文件。


==Tools & utilities==
== 工具& 实用程序==
* [http://notepad-plus-plus.org/ Notepad++] - Powerful editor to change files.
* [http://notepad-plus-plus.org/ Notepad++] - 强大的文件编辑器。
* [https://forum.paradoxplaza.com/forum/index.php?forums/hearts-of-iron-4-user-mods.950/ Official Paradox Forum for mods.
* [https://forum.paradoxplaza.com/forum/index.php?forums/hearts-of-iron-4-user-mods.950/ P社官方论坛的mod版面
* [https://forum.paradoxplaza.com/forum/index.php?threads/information-and-faq.924764/ Maya exporter] - Clausewitz Maya Exporter to create your own 3D models.
* [https://forum.paradoxplaza.com/forum/index.php?threads/information-and-faq.924764/ Maya exporter] - Clausewitz Maya Exporter 创建你自己的3D模型。
* [http://steamcommunity.com/app/394360/workshop/ Steam Workshop] - The place for where you can share your creations with other players.
* [http://steamcommunity.com/app/394360/workshop/ steam创意工坊] - 你可以和其他玩家分享作品的地方。


==See also==
==See also==

2020年8月15日 (六) 19:00的版本


模组制作,或者制作 模组, 是修改基本游戏(有时也叫原版)的行为,可能是用于个人用途,也可能是要发布给其他玩家,例如,通过 steam创意工坊.

在所有的P社游戏中, 钢铁雄心4的模组制作可以涵盖很大的范围。模组开发者们的动力可能各有不同:更好的语言翻译和本地化,更多的事件或决议,更好的地图,或是一次巨大的改造,等等。

钢铁雄心4的mod文件默认位于以下位置:

  • Windows: C:\Users\<Username>\Documents\Paradox Interactive\Hearts of Iron IV\mod
  • Mac OS: ~/Documents/Paradox Interactive/Hearts of Iron IV/mod
  • Linux: ~/.local/share/Paradox Interactive/Hearts of Iron IV/mod

为了开始模组制作, you will want to create a mod structure in the mod directory.

指导原则

  • 永远不要修改游戏文件: 即使是小的修改也要通过mod文件来实现,永远不要直接修改Steam库里的钢铁雄心4文件夹中的游戏文件,因为你的改动可能在完全没有警告的情况下失败。
  • 使用好的文本编辑器(例如Notepad++ 或者 Sublime Text) 来编辑文件并调查多个文件。
  • 尽量减少对原版文件的重写。通过添加分开的文件并尽可能地从文件夹中加载来改善模组的兼容性和可维护性。(你的文件可以使用任何名字,文件夹中的所有文件都会被游戏加载。所以选择一个酷酷的其他人都没有用过的文件夹名字。例如: coolmod_countries)
  • 使用正确的合并工具(例如WinMerge),来 merge between folders, and update modified vanilla files to a new vanilla patch.
  • 备份你的工作以避免丢失全部进度。Consider using a source control system like Git and a collaborative forge like GitHub to manage team collaboration, or just make a copy of the file somewhere else.
  • 使用 UTF-8 编码编写文本文件。
  • 使用 UTF-8-BOM 编码编写localisation文件(.yml)。
  • 正确地缩进以快速找到未对应的花括号。原版游戏使用1个tab的缩进而不是空格。
  • 使用注释。用 # 符号注释本行以更好地想起编写难办的代码的逻辑。
  • 通过使用Debug模式高效地Debug。通过在Steam的游戏启动选项中添加-debug。这样可以启用error log。

模组结构

游戏模组位于:

  • 普通模组 \Paradox Interactive\Hearts of Iron IV\mod\
  • 工坊模组: \Steam\steamapps\workshop\content\394360\

.mod文件的名字必须不包含任何空格,否则它将不会被游戏启动器自动选择。

根据.mod文件的结构可以把模组分为三类,分别是小型模组大型模组次级模组。这些种类模组的总体结构将在下文中讲述。模组是小型、大型还是次级模组取决于模组的制作者。

模组缩略图

在新启动器发布之后,所有的缩略图都必须被命名为"thumbnail.png",并且应该放在你的模组的根目录中。

小型模组

最常见的模组类型就是小型模组,即仅仅改变游戏中的一小部分内容的模组。这种模组不需要新的存档或者图形文件,也不需要使用user_dirreplace_path,以保持与其他小型模组的兼容性。

 name = "Minor Mod"
 path = "mod/MinorMod"
 picture = "thumbnail.png"
 tags = { "Minor" "Mod" }

大型模组

大型模组可以典型地划分为两类——尽管可能并且时常重叠——改造模组和Total Conversion Mods。 改造模组使用user_dir来保证存档不能在此模组之外加载。 对于Total Conversion mods,replace_path可以用来完全忽略原版游戏的在此模组背景下不合理的内容(例如历史、旗帜等)。

 name = "Major Mod"
 path = "mod/MajorMod"
 user_dir = "MajorMod"
 replace_path = "history/states" 
 picture = "thumbnail.png"
 tags = { "Major" "Mod" }

次级模组

一个大型模组的次级模组使用dependencies以更精确地重写主模组内容。如果想要让次级模组正常运作这是必需的。

 name = "Sub Mod"
 path = "mod/SubMod"
 dependencies = { "Major Mod" }
 picture = "thumbnail.png"
 tags = { "SubMod" "Major Mod" }

Game data

Names for in-game items (e.g. the name for research categories or rules like can_create_faction) can be found in the game's localization folder, inside the localization files.

图像文件格式

图像应使用DDS格式。大多数文件是以8.8.8.8 ARGB 32位无符号格式保存的。一些文件(例如leader肖像)是1.5.5.5 ARGB 16位无符号格式保存的。事件图片也可以使用.tga格式。旗帜是32位像素深度的.tga文件。

工具&实用程序

See also

References


hoi4fr:Modding