Flag modding

本頁面部分全部內容上次核對於3.1版本


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 創意工坊模組製作教程