Flag modding

From Stellaris Wiki
Jump to navigation Jump to search


Outliner top.png
Please help with verifying or updating older sections of this article. At least some were last verified for version 3.1.

This article is for the PC version of Stellaris only.

Editing empire flags[edit | edit source]

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[edit | edit source]

 empire_flag = {
 	icon = {
 		category = "spherical"
 		file = "flag_spherical_21.dds"
 	background = {
 		category = "backgrounds"
 		file = "pattern_01.dds"
 	colors = {

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[edit | edit source]

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

Flag backgrounds and emblems[edit | edit source]

Creating your own emblems[edit | edit source]

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.
  • 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[edit | edit source]

  • 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 and make sure to save your localisation file with "UTF-8 with BOM" encoding otherwise it won't work:
  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:
├─── 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.
A video tutorial on emblem creation.

ImageMagick Helper Script[edit | edit source]

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 ^
		::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 ^

References[edit | edit source]

Empire EmpireEthicsGovernments • Civics • OriginsMandatesAgendasTraditions • Ascension perksEdictsPoliciesRelicsTechnologiesCustom empires
Pops JobsFactions
Leaders LeadersLeader traits
Species SpeciesSpecies traits
Planets PlanetsPlanetary feature • Orbital depositBuildings • DistrictsPlanetary decisions
Systems SystemsStarbasesMegastructuresBypassesMap
Fleets FleetsShips • Components
Land Warfare ArmiesBombardment stance
Diplomacy Diplomacy • Federations • Galactic communityOpinion modifiersCasus Belli • War goals
Events EventsAnomaliesSpecial projectsArchaeological sites
Gameplay GameplayDefinesResources • EconomyGame start
Dynamic modding Dynamic moddingEffectsConditionsScopesModifiersVariablesAI
Media/localisation Maya exporterGraphicsPortraitsFlagsEvent picturesInterfaceIconsMusicLocalisation
Other Console commandsSave-game editingSteam WorkshopModding tutorial