Flag modding:修订间差异

本页面部分全部内容上次核对于3.1版本
(merge from offical wiki)
 
(文本替换 - 替换“Category:Modding]]”为“Category:模组制作]]”)
 
第154行: 第154行:


{{ModdingNavbox}}
{{ModdingNavbox}}
[[Category:Modding]]
[[Category: 模组制作]]

2022年3月8日 (二) 02:37的最新版本


Editing empire flags[编辑 | 编辑源代码]

In a new game screen, using graphical interface, editing flag of an empire is easy, but to code this flag in .txt files – using default Paradox flag emblems, patterns and colors – you need to know code names for all those elements. This guide should make this task considerably easier.

Code from 00_prescripted_countries.txt[编辑 | 编辑源代码]

empire_flag = {
 	icon = {
 		category = "spherical"
 		file = "flag_spherical_21.dds"
 	}
 	background = {
 		category = "backgrounds"
 		file = "pattern_01.dds"
 	}
 	colors = {
 		"turquoise"
 		"indigo"
 		"null"
 		"null"
 	}
 }

That’s the question: how are you supposed to know what emblems is "spherical_21" or, if you are like the creator of this guide, how turquoise color looks like? This page lists code for all those things.

All following flag symbols are encoded as "flag_category_number.dds" except Domination emblems which are simply coded as "domination_number.dds".

Flag colors[编辑 | 编辑源代码]

Flag colors reference.png
An actual list of colours can be found at: ./flags/colors.txt

Flag backgrounds and emblems[编辑 | 编辑源代码]

Creating your own emblems[编辑 | 编辑源代码]

Emblems are simply squared images that the game sticks on top of a background to create a flag.[1]

For each emblem 3 texture files in the Direct Draw Texture format (.dds) are required: a default, medium-sized one; a big one, usually white and displayed only on the galactic map; and a small one displayed next to units.

It is recommended to add the emblems using mods instead of placing them directly in the game folder to avoid any possible problems. More information on how to create them and where are they can be found are under Mods.

The textures should follow these specifications:

  • All textures must be located in a subfolder of <mod_root>\flags\
  • All three textures should have the same file name, for example emblem.dds
  • The default texture should have a size of 128x128 pixels and should be in the folder <mod_root>\flags\<folder>\
  • The map texture should have a size of 256x256 pixels and should be in the folder <mod_root>\flags\<folder>\map\
  • The small texture should have a size of 24x24 pixels and should be in the folder <mod_root>\flags\<folder>\small\

There are a myriad of tools that can help you creating the textures for the emblems, among which there is:

  • GIMP: useful for editing images, as well as saving them in .dds format (with plugin).
  • Paint.NET: simple image editor with .dds format compatibility.
  • Krita: useful for editing images.
  • Inkscape: useful for editing vector images.
  • ImageMagick: useful for processing and converting images to .dds in batches.
  • Adobe Photoshop: useful for editing images, as well as saving them in .dds format (with the NVIDIA plugin).
  • Microsoft Visual Studio: useful for saving images in .dds.

Guide[编辑 | 编辑源代码]

  • Create a mod using the Stellaris Launcher.
  • Create a folder named 'flags’ in the root folder, and a subfolder that you can name however you want in it, this folder is where all the textures files will be placed.
  • Create 'usage.txt’ in the subfolder with the following contents, it will prevent AI empires from using the emblem in their flags (savegames will still work once you remove the mod):
random = no
show_in_designer = yes
  • Create a folder named 'localisation' in the root folder. You must place there localisation (.yml) files, otherwise the category you made for the emblem won't have a name! This is an example for the English translation, the name after 'FLAG_CATEGORY' must match the name of the new folder you created under flags:
l_english:
  FLAG_CATEGORY_new_flags:0 "New Flags!"
  • Create your emblem! Remember that it should be a square image and that it is best to create out your image with a transparent backdrop.
  • Now you need to generate the 3 texture files out of the image: the medium, large and small ones. Remember that they have to be .dds files and have to have determinate size each one. You can use GIMP with the .dds plugin, Photoshop with the NVIDIA plugin, ImageMagick, Paint.NET with the .dds plugin and others to convert your images to textures.
  • Now place the medium texture in the folder you created under flags, create the folders map and small and place the big and small textures in each one, respectively, the folder structure should be like this now:
new_mod/
├─── flags
│	└─── new_flags
│		├─── emblem.dds
│		├─── usage.txt
│		├─── map
│		│	└─── emblem.dds
│		└─── small
│			└─── emblem.dds
└─── localisation
	├─── new_mod_l_braz_por.yml
	├─── new_mod_l_english.yml
	├─── new_mod_l_french.yml
	├─── new_mod_l_german.yml
	├─── new_mod_l_polish.yml
	├─── new_mod_l_russian.yml
	└─── new_mod_l_spanish.yml
5 directories, 11 files

Special considerations:

  • Texture compression: Using DXT1 or DXT5 compression may introduce artifacts in the textures, use uncompressed textures (ARGB 8888) if this happens.
  • Remember that the game recolors your image when showing it. Some colors may be distorted when you view your flags from the galaxy map.

{{#evt: | service=youtube | id=BRIiIRTql6U | alignment=center | dimensions=400 | container=frame | description=A video tutorial on emblem creation.

}}

ImageMagick Helper Script[编辑 | 编辑源代码]

This batch script (.bat, Windows only) can help you generate the required textures to make emblems, it needs to have ImageMagick installed and its folder the PATH variable (enabled by default during install).

The script expects the images in PNG format under the folder "source", then creates the folder "textures", resizes the images and stores all three types of textures in the correct subfolders. Additionally it also whitens the map textures so you don't have to.

For creating the small emblems, the scripts uses blurring parameters picked for blurring a 512x512 image, pick one according to the size of yours.

FOR %%a in (source\*.png) DO (
		::default emblems
		magick convert  "%%a" -resize 128x128 ^
		-define dds:compression=dxt5 -define dds:cluster-fit=true -define dds:weight-by-alpha=true "textures\%%~na.dds"
		::small emblems
		magick convert "%%a" -fill black -colorize 100%% -background black -alpha background -channel RGBA -blur 32x32 -level 0,97%% ^
		"%%a" -composite ^
		-resize 24x24 ^
		-define dds:compression=none ^
		"textures\small\%%~na.dds"
		::map emblems
		magick convert  "%%a" -fill white -colorize 100%% ^
		-resize 256x256 ^
		-define dds:compression=dxt5 -define dds:cluster-fit=true -define dds:weight-by-alpha=true ^
		"textures\map\%%~na.dds"
	)

References[编辑 | 编辑源代码]

帝国 帝国思潮政府 • 国民理念 • 起源承诺议程传统 • 飞升天赋法令政策遗珍科技自定义帝国
人口 岗位派系
领袖 领袖领袖特质
物种 物种物种特质
行星 行星行星特征 • 轨道矿藏建筑 • 区划行星决议
星系 星系恒星基地巨型结构虫洞 • 星门地图
舰队 舰队舰船 • 部件
地面战 陆军轰炸姿态
外交 外交 • 联邦 • 星海共同体评价修正宣战理由 • 战争目标
事件 事件异常现象特殊项目考古遗址
游玩 游玩定义研究 • 经济游戏开局
动态修改 动态指令效果触发条件作用域修正变量AI
媒体/本地化 Maya 导出器图形肖像旗帜事件图片界面图标音乐本地化
Other 控制台命令存档编辑Steam 创意工坊模组制作教程