Modding Basics - A Guide to Stellaris Modding

  • Crusader Kings II Expansion Subscription

    Subscribe to the CK II Expansion and enjoy unlimited access to 13 major expansions and more!


  • Paradox Midsummer Sale has arrived! Up to 75% off!

    Enjoy some sun and song this Midsummer, but when the sun goes down, the fun doesn't have to stop! Paradox has a festive sale on plenty of games to keep your summer nights going!


    June 18th - June 30th
  • Crusader Kings III Available Now!

    The realm rejoices as Paradox Interactive announces the launch of Crusader Kings III, the latest entry in the publisher’s grand strategy role-playing game franchise. Advisors may now jockey for positions of influence and adversaries should save their schemes for another day, because on this day Crusader Kings III can be purchased on Steam, the Paradox Store, and other major online retailers.


    Real Strategy Requires Cunning

LastLeviathan

Captain
59 Badges
Apr 6, 2016
439
1.256
  • Magicka
  • Crusader Kings II: Reapers Due
  • Cities in Motion 2
  • Sengoku
  • Semper Fi
  • Europa Universalis IV: Res Publica
  • Hearts of Iron III Collection
  • Hearts of Iron III: Their Finest Hour
  • Hearts of Iron III
  • For the Motherland
  • Europa Universalis IV: Call to arms event
  • Europa Universalis IV: Wealth of Nations
  • Europa Universalis IV: Art of War
  • Crusader Kings II
  • Crusader Kings II: Charlemagne
  • Crusader Kings II: Legacy of Rome
  • Crusader Kings II: The Old Gods
  • Crusader Kings II: The Republic
  • Crusader Kings II: Sons of Abraham
  • Europa Universalis IV: Conquest of Paradise
  • Europa Universalis IV
  • Crusader Kings II: Sword of Islam
  • Crusader Kings II: Sunset Invasion
  • Stellaris: Humanoids Species Pack
  • Europa Universalis IV: Cradle of Civilization
  • Europa Universalis IV: Rule Britannia
  • Hearts of Iron IV: Death or Dishonor
  • Europa Universalis IV: Third Rome
  • Europa Universalis IV: Mandate of Heaven
  • Steel Division: Normandy 44
  • Stellaris - Path to Destruction bundle
  • Crusader Kings II: Monks and Mystics
  • Hearts of Iron IV: Together for Victory
  • Stellaris: Leviathans Story Pack
  • Stellaris: Digital Anniversary Edition
  • Europa Universalis IV: Rights of Man
  • Stellaris: Apocalypse
  • Hearts of Iron IV: Cadet
  • Stellaris Sign-up
  • Hearts of Iron IV Sign-up
  • Stellaris: Galaxy Edition
  • Stellaris: Galaxy Edition
  • Stellaris
  • Europa Universalis IV: Mare Nostrum
  • Europa Universalis IV: Cossacks
  • Europa Universalis IV: Common Sense
  • Crusader Kings III
  • Crusader Kings II: Way of Life
  • Europa Universalis IV: El Dorado
  • Warlock: Master of the Arcane
After the release of Stellaris I decided to challenge myself with building a map of the Star Wars galaxy, which slowly turned into the learning experience of making a full mod. I've come a long way, thanks to a lot of help from other modders and the various tools hidden around. I've had a few people ask advice for various things, although I'm far from an expert, I figured I'd share my knowledge for any people that might not know where to start. This guide is both me sharing my processes and meant to help organise the resources I've found whether in the wiki or the forums for easy access.

If you are a modder, feel free to post things you feel should be added or tips and tricks you have learned.

________________________________________________________
Useful Links
Making Your First Mod: A Guide For Primitives
This guide will take you over the steps of setting up your mod folder, image and getting it into the workshop.

Stellaris Wiki: Modding
The wiki page that goes over a number of different elements for modding and has links to a variety of other information on modding for the game from the Maya Exporter to Defines.

Stellaris Wiki: Species Modding

This article is about creating new species to add in addition to the ones already in Stellaris. It covers the processes of portrait design, folder arrangement and more.

Paradox's Rules for Mods
Thread by the devs about rules regarding modding the game.

Notepad++
A free and easy to use notepad that makes writing and editing code infinitely easier.

Stellaris Notepad++ Syntax
A compiled Stellaris Syntax Highlighting file for Notepad++

A Guide to Stellaris Modding
________________________________________________________
Contents
0-Introductory Tips and Tricks
1-Building a Custom Galaxy
2-Empires & Static Spawns
3-Events
4-Loading Screens and other Interface Modding
5-Music
6-Models

________________________________________________________


0-Introductory Tips and Tricks
  • When it comes to modding in things that aren't hard coded in Stellaris files, such as techs, ethos, etc. Do your best to make your own files rather than overwrite base files. This is to help avoid conflicts with other mods.
  • Keep your files organised, if you're working with larger mods especially it helps to have naming conventions like XYZ_ethics or whatever works for you.
  • Never replace or edit files in your actual Stellaris folder, copy/paste the file you want to change and put it into your mod folder. Playing with original files is a recipe for disaster.


1-Building A Custom Galaxy
________________________________________________________


Making the Map (1.3)
What drove me to start this was Retalyx's map generator, a wonderful tool, which I gave a try for a while when I started. But, I soon learned that if I had wanted to make a galaxy with over a thousand systems, it would be too difficult and accurately positioning a thousand planets by hand is simply insane. Asking around, I was invited by the great group of modders at STNW to ask questions and their map maker Osito gave me plenty of useful advice that set the base for my map.

Before I start, I'll go over how to actually create the map base. Below you'll see the difference between the normal RNG Stellaris map generator file and the custom galaxy one I've built. Note the differences in the starting code. An important note is that maps have a maximum grid size of 1000x1000.

static_galaxy_scenario = { }
#This is used as the outer code bracket for your galaxy, everything will go in this.
name = "X"
#The name of your galaxy
priority = 0
#priority decides in which order the scenarios are listed
default = yes/no
#This determines if your map is the default pick during game setup
num_empires = { min = X max = X }
#limits how many empires players can choose to spawn
num_empire_default = X
#This determines the default amount of empires at game setup
fallen_empire_default = X
#This determines the default amount of Fallen empires at game setup
fallen_empire_max = X
#limits the maximum of Fallen Empires that can spawn
advanced_empire_default = X
#This determines the default amount of advanced empires at game setup
colonizable_planet_odds = X
#Determines that default for the odds of colonization planets
random_hyperlanes = yes/no
#Do you want the game generate random hyperlanes?
num_nebulas = X
#Number of nebulas spawned
nebula_size = X
#Size of Nebulas
nebula_min_dist = X
#Distance between nebulas​

static_map.jpg


For my own map, I used an Excel spreadsheet, taking atlas coordinates and converted them so they could be used within the 1000x1000 size of the Stellaris maps. I inputted the x and y coordinates and used it to build the code I would use. By the end I would get something like this:
system = { id = "1" name = "Arami" position = { x = -351 y = 161 } [Initializer will go here]}

10fw5mx.jpg


Not only did this save me time, but it kept it organised for easy adjustments that were needed. I started off with about 2000 systems and as I built the hyperlanes, I went through the process of removing non iconic/essential planets not found on the hyperlane routes. It took hours of looking at the map in game with my spreadsheet and code on the side, deleting planets that were sitting around and ensuring all the planets were connected. Eventually some will not be connected, such as Rakata Prime, but for a basic map I wanted everything to be usable lest someone spawns there randomly and is stuck.

rwlzjt.jpg


Issues
It took me hours of playing around with code and bug fixing, and I ran into my fair share of issues.

Game crashing on map load because of broken hyperlane code
Often my game would crash because my hyperlane code was broken, usually because I misplaced a number and ended up with it outside of the brackets or with a classic "".

Spawning on random planets or black holes
Though my planets were all positioned nicely, my empires would spawn on random barren worlds or even a black hole once. POPs didn't seem to happy living on a Toxic world. This was fixed by adding in an event on startup that turned the capital of the empire into its ideal planet class. Which led to the next problem.

Preferred planet with no buildings
Although I got the ideal class working, no buildings were spawning. (Though space stations and such seemed to work) To fix this, I used another event on startup to spawn random tile blockers and buildings on the homeworld.

Planet Sizes
Another issue was the planet size was that of the original planet they spawned on. I put in code that added tiles for those who had smaller planets.

Randomly generated AI renaming planets
This is apparently a bug no one has been able to crack, I thought I fixed it by removing the homeworld and home system names from the name_lists, but it just makes it blank.

Sol and Other Special Systems Spawning
Sol always like to force himself into the galaxy, and I fixed that by removing the game.start.1 and .2 from triggering. To remove spawns like Sanctuary, I changed it so the chance of occurrence was 0.

FEs not spawning
Another problem with the random empire generator, they also don't seem to like static galaxies.

Going from 2000 to 1000
This was time consuming, perhaps the most because I had to scour through the galaxy atlas and sources to decide what planets had no info on them or were simply too cluttered. Often times I just deleted clusters and such because there was not enough space on the map.

Hyperlanes by hand, making them with confusing code
I had to build the hyperlane routes by hand, with a large amount of add_hyperlane = { from = "y" to = "x" } which will have to be organised better once I add in initializers.
 
Last edited:
  • 2
Reactions:

LastLeviathan

Captain
59 Badges
Apr 6, 2016
439
1.256
  • Magicka
  • Crusader Kings II: Reapers Due
  • Cities in Motion 2
  • Sengoku
  • Semper Fi
  • Europa Universalis IV: Res Publica
  • Hearts of Iron III Collection
  • Hearts of Iron III: Their Finest Hour
  • Hearts of Iron III
  • For the Motherland
  • Europa Universalis IV: Call to arms event
  • Europa Universalis IV: Wealth of Nations
  • Europa Universalis IV: Art of War
  • Crusader Kings II
  • Crusader Kings II: Charlemagne
  • Crusader Kings II: Legacy of Rome
  • Crusader Kings II: The Old Gods
  • Crusader Kings II: The Republic
  • Crusader Kings II: Sons of Abraham
  • Europa Universalis IV: Conquest of Paradise
  • Europa Universalis IV
  • Crusader Kings II: Sword of Islam
  • Crusader Kings II: Sunset Invasion
  • Stellaris: Humanoids Species Pack
  • Europa Universalis IV: Cradle of Civilization
  • Europa Universalis IV: Rule Britannia
  • Hearts of Iron IV: Death or Dishonor
  • Europa Universalis IV: Third Rome
  • Europa Universalis IV: Mandate of Heaven
  • Steel Division: Normandy 44
  • Stellaris - Path to Destruction bundle
  • Crusader Kings II: Monks and Mystics
  • Hearts of Iron IV: Together for Victory
  • Stellaris: Leviathans Story Pack
  • Stellaris: Digital Anniversary Edition
  • Europa Universalis IV: Rights of Man
  • Stellaris: Apocalypse
  • Hearts of Iron IV: Cadet
  • Stellaris Sign-up
  • Hearts of Iron IV Sign-up
  • Stellaris: Galaxy Edition
  • Stellaris: Galaxy Edition
  • Stellaris
  • Europa Universalis IV: Mare Nostrum
  • Europa Universalis IV: Cossacks
  • Europa Universalis IV: Common Sense
  • Crusader Kings III
  • Crusader Kings II: Way of Life
  • Europa Universalis IV: El Dorado
  • Warlock: Master of the Arcane
2-Empires & Static Spawns
________________________________________________________

Populating the Galaxy
This portion talks about my process of implementing custom starts within a static galaxy. The first step in this stage was deciding what I wanted to build. For now, the scenario is designed for equality such as if it were a normal game with parallel starts.

Once you have an idea on what you want your factions to be, you can start creating them, if they aren't already made. I find the best way to do this is to make them within the game and save them, causing them to spawn within your C:\Users\USER\Documents\Paradox Interactive\Stellaris under the file user_empire_designs. From there, you can just copy/paste them into a 00_prescripted_countries file within your mod folder. You can either keep the existing default races or remove them if you'd like.

15wj7e9.jpg

Untitled-2.jpg

The empires are built, but now to get them to spawn where they should be. Don't think the Hutts would appreciate living in the Maw, after all. Organised how you find it best, the process may seem overwhelming for one not experienced, but it is fairly easy to learn by yourself.


n69eae.jpg

Folders for easy locating of systems

Now you need to build your systems. If you take a look at steamapps\common\Stellaris\common\solar_system_initializers you'll find a file called example. This will outline all the pieces of an initializer with explanations and all. Here it is below, with one of my own for reference.

Tip: Systems can be named something different than their suns.

initexample.jpg

intit.jpg



Once a system initializer is made, you need to link the desired system and planet to the empire with flags. In addition, for it to spawn, you need to head to the map folder and add a spawn probability and the correct initializer to your system.

k9f5dx.jpg

An example of my early code where you can see some empire flags.​


Issues
Now you have your empires spawning where you want them! For this part the issues were minor, but still some things that are obvious but easily overlooked.

Ensuring flags are where they need to be.
As far I figured out, there are three locations you need your flags for it to work: in your custom empire code, in your map scenario code and in your initializer code.

Ensuring AI spawn as your custom empires, not random empires.
Certain time my empires weren't spawning due to the fact that in the empire code, it needs to be set to spawn_enabled= always not just spawn_enabled= yes.

System looking as it should, but no empire spawns.
Ensuring starting_planet = yes on the correct planet can make all the difference it seems.

There may be other ways to do much of this, either easier or more organised, but this worked well for me.

Other Resources
http://www.stellariswiki.com/Empire_modding
 
Last edited:
  • 3
Reactions:

Idhrendur

Keeper of the Converters
103 Badges
Feb 27, 2009
10.317
1.529
  • Crusader Kings II
  • Sengoku
  • Pillars of Eternity
  • Tyranny: Archon Edition
  • Europa Universalis IV
  • March of the Eagles
  • Victoria 2
  • 500k Club
  • Stellaris: Galaxy Edition
  • Hearts of Iron IV: Colonel
  • Shadowrun Returns
  • Imperator: Rome Deluxe Edition
  • Crusader Kings III: Royal Edition
  • Commander: Conquest of the Americas
  • Darkest Hour
Thanks for posting all of this! Guides like this are extremely helpful.
 

Kingtrin

Sergeant
11 Badges
May 31, 2012
68
12
  • Crusader Kings II
  • Crusader Kings II: Legacy of Rome
  • Crusader Kings II: The Old Gods
  • Crusader Kings II: Sword of Islam
  • Europa Universalis IV
  • Hearts of Iron III
  • Semper Fi
  • 500k Club
  • Stellaris
  • Hearts of Iron IV Sign-up
  • Stellaris - Path to Destruction bundle
Great info! its nice to see someone figuring out pieces of incomprehensible code :)

Oh and I suggest this as new player advice: syntax highlighter for notepad++. It's already in the master mod list but its too damn good for me to not mention it here as well.
https://forum.paradoxplaza.com/foru...ad-stellaris-syntax-highlighting-file.938758/

I have some limited experience in doodling with models and making some basic edits if you want some feedback on how to get started there. It's really idiosyncratic and I value the hours of work I put into banging my head into the keyboard just to realize how much of it is hardcoded. Even without advanced modeling tools you can still use visual studio and gimp to get by. I don't recommend the same for animated portraits though!
 

LastLeviathan

Captain
59 Badges
Apr 6, 2016
439
1.256
  • Magicka
  • Crusader Kings II: Reapers Due
  • Cities in Motion 2
  • Sengoku
  • Semper Fi
  • Europa Universalis IV: Res Publica
  • Hearts of Iron III Collection
  • Hearts of Iron III: Their Finest Hour
  • Hearts of Iron III
  • For the Motherland
  • Europa Universalis IV: Call to arms event
  • Europa Universalis IV: Wealth of Nations
  • Europa Universalis IV: Art of War
  • Crusader Kings II
  • Crusader Kings II: Charlemagne
  • Crusader Kings II: Legacy of Rome
  • Crusader Kings II: The Old Gods
  • Crusader Kings II: The Republic
  • Crusader Kings II: Sons of Abraham
  • Europa Universalis IV: Conquest of Paradise
  • Europa Universalis IV
  • Crusader Kings II: Sword of Islam
  • Crusader Kings II: Sunset Invasion
  • Stellaris: Humanoids Species Pack
  • Europa Universalis IV: Cradle of Civilization
  • Europa Universalis IV: Rule Britannia
  • Hearts of Iron IV: Death or Dishonor
  • Europa Universalis IV: Third Rome
  • Europa Universalis IV: Mandate of Heaven
  • Steel Division: Normandy 44
  • Stellaris - Path to Destruction bundle
  • Crusader Kings II: Monks and Mystics
  • Hearts of Iron IV: Together for Victory
  • Stellaris: Leviathans Story Pack
  • Stellaris: Digital Anniversary Edition
  • Europa Universalis IV: Rights of Man
  • Stellaris: Apocalypse
  • Hearts of Iron IV: Cadet
  • Stellaris Sign-up
  • Hearts of Iron IV Sign-up
  • Stellaris: Galaxy Edition
  • Stellaris: Galaxy Edition
  • Stellaris
  • Europa Universalis IV: Mare Nostrum
  • Europa Universalis IV: Cossacks
  • Europa Universalis IV: Common Sense
  • Crusader Kings III
  • Crusader Kings II: Way of Life
  • Europa Universalis IV: El Dorado
  • Warlock: Master of the Arcane
Great info! its nice to see someone figuring out pieces of incomprehensible code :)

Oh and I suggest this as new player advice: syntax highlighter for notepad++. It's already in the master mod list but its too damn good for me to not mention it here as well.
https://forum.paradoxplaza.com/foru...ad-stellaris-syntax-highlighting-file.938758/

I have some limited experience in doodling with models and making some basic edits if you want some feedback on how to get started there. It's really idiosyncratic and I value the hours of work I put into banging my head into the keyboard just to realize how much of it is hardcoded. Even without advanced modeling tools you can still use visual studio and gimp to get by. I don't recommend the same for animated portraits though!

Oh wow, I haven't seen this until now, will add it to the top!
 

JusticiarIV

Corporal
45 Badges
Mar 13, 2016
39
5
  • Europa Universalis IV
  • Stellaris: Synthetic Dawn
  • Europa Universalis IV: Third Rome
  • Cities: Skylines - Snowfall
  • Europa Universalis IV: Cossacks
  • Cities: Skylines - After Dark
  • Europa Universalis IV: Pre-order
  • Majesty 2 Collection
  • Europa Universalis IV: Call to arms event
  • Europa Universalis IV: Wealth of Nations
  • Europa Universalis IV: Conquest of Paradise
  • Europa Universalis IV: Art of War
  • Europa Universalis IV: Res Publica
  • Europa Universalis IV: Dharma
  • Cities: Skylines - Green Cities
  • Stellaris: Federations
  • Europa Universalis IV: Cradle of Civilization
  • Stellaris: Humanoids Species Pack
  • Stellaris: Apocalypse
  • Europa Universalis IV: Rule Britannia
  • Cities: Skylines - Parklife Pre-Order
  • Cities: Skylines - Parklife
  • Stellaris: Distant Stars
  • Surviving Mars: First Colony Edition
  • Stellaris: Megacorp
  • Cities: Skylines - Campus
  • Stellaris: Ancient Relics
  • Stellaris: Lithoids
  • Surviving Mars
  • Cities: Skylines
  • Europa Universalis IV: El Dorado
  • Europa Universalis IV: Common Sense
  • Europa Universalis IV: Mare Nostrum
  • Stellaris
  • Europa Universalis IV: Rights of Man
  • Stellaris: Digital Anniversary Edition
  • Stellaris: Leviathans Story Pack
  • Cities: Skylines - Natural Disasters
  • Stellaris - Path to Destruction bundle
  • Cities: Skylines - Mass Transit
  • Europa Universalis IV: Mandate of Heaven
  • Age of Wonders III
  • Cities: Skylines Industries
  • Surviving Mars: First Colony Edition
  • Crusader Kings II
any eta on the next part of the guide? i'm specifically interested in making events for my first mod, and would love to see some helpful information
 

Reichadler

Corporal
69 Badges
Nov 15, 2005
40
2
www.our-world.org
  • BATTLETECH
  • Stellaris
  • Hearts of Iron IV: Cadet
  • Hearts of Iron IV: Colonel
  • Tyranny: Archon Edition
  • Tyranny: Archon Edition
  • Tyranny: Gold Edition
  • Stellaris: Digital Anniversary Edition
  • Stellaris: Leviathans Story Pack
  • Hearts of Iron IV: Together for Victory
  • Stellaris - Path to Destruction bundle
  • Steel Division: Normandy 44
  • Cities: Skylines - Mass Transit
  • Crusader Kings II: Conclave
  • Hearts of Iron IV: Death or Dishonor
  • Stellaris: Synthetic Dawn
  • Tyranny - Tales from the Tiers
  • Tyranny - Bastards Wound
  • Age of Wonders III
  • Steel Division: Normand 44 - Second Wave
  • Cities: Skylines - Green Cities
  • Hearts of Iron IV: Expansion Pass
  • Stellaris: Humanoids Species Pack
  • Stellaris: Apocalypse
  • Steel Division: Normandy 44 -  Back to Hell
  • Stellaris: Necroids
  • Europa Universalis IV
  • Crusader Kings II
  • Crusader Kings II: Charlemagne
  • Crusader Kings II: Legacy of Rome
  • Crusader Kings II: The Old Gods
  • Crusader Kings II: The Republic
  • Crusader Kings II: Sons of Abraham
  • Crusader Kings II: Sunset Invasion
  • Crusader Kings II: Sword of Islam
  • Diplomacy
  • Europa Universalis III
  • Europa Universalis III: Chronicles
  • Divine Wind
  • Cities in Motion 2
  • Hearts of Iron III
  • Heir to the Throne
  • King Arthur II
  • Sengoku
  • Victoria 2
  • 500k Club
  • Cities: Skylines
  • Cities: Skylines Deluxe Edition
  • Pride of Nations
  • Crusader Kings II: Way of Life
Is there a trick to getting static galaxies in game, it seems completely random if they appear in the menu. Even galaxies I download from STEAM do not appear as selectable. I have even rebuilt my game files thinking maybe it was an internal issue.
 

Fisk

Captain
16 Badges
Apr 7, 2017
440
0
  • Stellaris: Galaxy Edition
  • Stellaris: Synthetic Dawn
  • Stellaris
  • Stellaris: Galaxy Edition
  • Stellaris: Galaxy Edition
  • Stellaris: Digital Anniversary Edition
  • Stellaris: Leviathans Story Pack
  • Stellaris - Path to Destruction bundle
  • Stellaris: Humanoids Species Pack
  • Stellaris: Apocalypse
  • Stellaris: Distant Stars
  • Stellaris: Megacorp
  • Stellaris: Ancient Relics
  • Stellaris: Lithoids
  • Stellaris: Federations
  • Stellaris: Necroids
Forgot about this thread. I could write up a quick thing when I get time. Unless some other helpful person can whip one up.
Since that post is from April, is it safe to assume you've forgotten about this thread again? If such is the case, consider this a reminder, because I too want an event guide.