Map modding

Version

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

This article is for the PC version of Stellaris only.

The maps can be modded in two ways: either create new forms and sizes of generated maps or create a fully static & pre-scripted map.

### Directories & Files

Relevant directories and files are the following:

* `Stellaris/common/solar_system_initializers/*`
* `Stellaris/common/random_names/base/00_random_names.txt`
* `Stellaris/map/galaxy/*`
* `Stellaris/map/setup_scenarios/*`
* `Stellaris/prescripted_countries/*`

### **About Galaxy Modding**

You can modify default templates provided by Paradox or create static maps. Both, dynamic and static maps have some default limitations:

* Map radius (max 500)
* Default maximum amount of fallen empires (Vanilla only have 5 templates of fallen empires, so you shouldn't exceed 5)

Also creating too big maps (1000+ stars) can significantly reduce your performance, keep that in mind!

### Add new Galaxy Size

Adding a new galaxy size is the easiest form of modding the map. Simply copy one of the files in `./map/setup_scenarios/` (for example `huge.txt`) into your mods `map/setup_scenarios/` folder.
Rename the file to something else (unless you want to overwrite an existing map type. Now you can simply change the options given, which should be self explanatory.

```
setup_scenario = {
	name = "huge"
	priority = 4					#priority decides in which order the scenarios are listed
	num_stars = 1000
	radius = 450					#should be less than 500, preferably less than ~460
	num_empires = { min = 0 max = 30 }	#limits player customization
	num_empire_default = 15
	fallen_empire_default = 4
	fallen_empire_max = 5
	marauder_empire_default = 3
	marauder_empire_max = 3
	advanced_empire_default = 4
	colonizable_planet_odds = 1.0
	primitive_odds = 1.0
	crisis_strength = 1.5
	extra_crisis_strength = { 10 25 }   # You can put here more values, e.g. { 10 15 25 50 100 }

	cluster_count = {             # Amount of empire clusters if "clustered" type is enabled in map settings
		method = one_every_x_empire
		#method = constant
		value = 1
		max = 6
	}
	cluster_radius = 150           # Radius in which empires will be placed in cluster
	cluster_distance_from_core = 300

	max_hyperlane_distance = 50

	home_system_partitions = {     # How much systems have empire "systems cluster" and amount of hyperlanes which are leaving from them.
		max_systems = 15
		min_systems= 8

		min_bridges = 2
		max_bridges = 4

		method = breadth_first
	}

	open_space_partitions = {      # Like above, only these "systems clusters" are general
		max_systems = 10
		min_systems= 4

		min_bridges = 2
		max_bridges = 4

		method = depth_first
	}

	num_nebulas	= 10
	nebula_size = 60
	nebula_min_dist = 200       # Minimum distance between nebulas

	num_wormhole_pairs = { min = 0 max = 5 }
	num_wormhole_pairs_default = 1
	num_gateways = { min = 0 max = 5 }
	num_gateways_default = 1
	num_hyperlanes = { min=0.5 max= 3 }
	num_hyperlanes_default = 1

        # This is most important part, you need to define which shape will support this template of settings.
	supports_shape = elliptical
	supports_shape = spiral_2
	supports_shape = spiral_3
	supports_shape = spiral_4
	supports_shape = spiral_6
	supports_shape = ring
	supports_shape = bar
	supports_shape = starburst
	supports_shape = cartwheel
	supports_shape = spoked
}

```

### Add new Galaxy Shape

Adding a new galaxy form can be done by adding a new type in the `map/galaxy/galaxy_shapes.txt` . Only a few
options are available to actually change the output. Keep in mind that the background of a galaxy makes the core fairly bright, hiding stars there. So it might be good to change this, if a number of
stars are in the core. Core whiteness files are in:

```
./gfx/FX/galaxy_center.shader

```

```
./gfx/map

```

### Add a Static Galaxy

Adding a static galaxy is more involved and requires a number of steps. The most important part: generally if you are making a static galaxy, expect to define close to everything. The reason for this is,
that the galaxy generator will break things if some stuff is predefined and other things are generated. For example, a race spawned into a random home world might start with the wrong climate in said home world
making the pops very unhappy. To prevent this the home world climate and the climate of the generated world in the solar system initializer must match. Other problems: Fallen Empires doesn't spawn, Precursors doesn't work, most of the origins/starting systems, part of the events, end-game crisis will be broken.

A working example with everything what can be used:

```
static_galaxy_scenario = {
name = "MyGalaxy" # Name of Galaxy Preset - Listed when selecting the galaxy size in game.
priority = 10 # Where the preset will show in the galaxy size list.
radius = 500  # Max size is 500 (Specifically, the map in Stellaris is a box 1000x1000x10. From -500 to 500 but in a Z direction only from -5 to 5)
num_empires = { min = 10 max = 30 }
num_empire_default = 10
fallen_empire_default = 4
fallen_empire_max = 4 # This number CANNOT exceed 5, as there are only 5 hard coded Fallen Empires in the Stellaris base game.
marauder_empire_default = 3
marauder_empire_max = 3
advanced_empire_default = 1
colonizable_planet_odds = 1.0
primitive_odds = 1.0
crisis_strength = 0.75
extra_crisis_strength = { 10 25 }
num_wormhole_pairs = { min = 0 max = 5 }
num_wormhole_pairs_default = 1
num_gateways = { min = 0 max = 5 }
num_gateways_default = 1
random_hyperlanes = yes/no # If no you must add your own hyperlanes
core_radius = 0
system = { id = "0" name = "" position = { x = 148 y = 121 } initializer = my_initializer_1  }
system = { id = "1" name = "" position = { x = 148 y = 121 } initializer = my_initializer_1 spawn_weight = { base = 0 modifier = { add = 10 has_country_flag = my_country } } }
system = { id = "2" name = "" position = { x = { min = 150 max = 200} y = 121 } } # x and y can be placed in area
system = { id = "3" name = "" position = { x = 148 y = 121 z = 3} }
add_hyperlane = { from = "1" to = "2" }
add_hyperlane = { from = "0" to = "3" }
add_hyperlane = { from = "1" to = "0" }
nebula = { name = "Random Name" position = { x = 0 y = 0 } radius = 10 }
}

```

**Modding**