Flag modding

From Stellaris Wiki
Jump to: navigation, search

Version

Outliner top.png
This article may contain outdated information that is inaccurate for the current version of the game. It was last updated for 1.6.

Editing empire flags[edit]

In a new game screen, using graphical interface, editing flag of an empire is easy, but to code this flag in txt - 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]

empire_flag = {
         icon= {
           category = "spherical"
           file = "flag_spherical_21.dds"
       }
       background= {
       category = "backgrounds"
           file = "pattern_01.dds"
       }
       colors={
           "turqouise"
           "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 turqouise 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]

Flag colors reference.png

Flag backgrounds and emblems[edit]

Creating your own emblems[edit]

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

Custom Flag Example

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. Here's more information on how to create them and where are they can be found.

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 128 X 128 pixels and should be in the folder <mod_root>\flags\<folder>\
  • The map texture should have a size of 256 X 256 pixels and should be in the folder <mod_root>\flags\<folder>\map\
  • The small texture should have a size of 24 x 24 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 a plugin).
  • 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]

  • 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 back drop.
  • 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.


Custom Flag Video Tutorial

A good tutorial video on emblem creation can be found here Custom Flag Video Tutorial

ImageMagick Helper Script[edit]

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"
   )

More complex scripts can be found here: https://gitlab.com/unduthegun/stellaris-emblem-lab

References[edit]


Modding
Static modding DefinesStatic modifiersMapSpeciesTraitsEthosGovernmentsEmpiresPoliciesEdictsTechnologyBuildingsShipsFleetsEventsCrisisAnomaliesAgenda
Dynamic modding EffectsConditionsScopesModifiersGameplayDecisionsObjectivesAI
Media/localisation Maya exporterGraphicsPortraitsFlagsEvent picturesEvent soundsInterfaceIconsMusicLocalisation
Other Console commandsSave-game editingSteam Workshop