Planet modding

Version

This article has been verified for the current PC version (3.1) of the game.

This guide is for adding and modifying Celestial bodies to the game. For guidelines on how to use them in solar systems, including adding modifiers and inhabitants, see System modding.

## Overview

Planet and star classes can be found in *common/planet\_classes*. Note that "stars" and "star classes" are two different things: individual stars are considered the same as planets in the game code, while star classes (found in *common/star\_classes*) refer to the classification of a solar system as a whole and will determine lighting, the system's icon in the galaxy map, and number of individual stars in a solar system. Information about modding star classes can be found here.

Creating a new planet class is easy: one simply chooses an internal name (ex: "pc\_volcanic") and defines how the planet will work in the context of the game. Is it a colonizable world? A star? An inhabitable megastructure? Etc. The internal name doesn't need to reflect the planet's "real" name; using localisation, the name visible to players can be whatever you want it to be.

## Planet rules

The following is a list of the different rules you can apply to a planet. The planet will not randomly spawn if these rules are not met, though they can sometimes be bypassed through system modding.

## Examples

A desert world:

```
pc_desert = {
	entity = "desert_planet"
	icon = GFX_planet_type_desert

	climate = "dry"
	initial = yes

	entity_scale = @planet_standard_scale

	atmosphere_color		= hsv { 0.50 0.2 0.8 }		#DONE
	atmosphere_intensity	= 1.0
	atmosphere_width		= 0.5

	min_distance_from_sun = @habitable_min_distance
	max_distance_from_sun = @habitable_max_distance
	spawn_odds = @habitable_spawn_odds

	city_color_lut = "gfx/portraits/misc/colorcorrection_desert.dds"

	extra_orbit_size = 0
	extra_planet_count = 0

	chance_of_ring = 0.2

	planet_size = { min = @habitable_planet_min_size max = @habitable_planet_max_size }
	moon_size = { min = @habitable_moon_min_size max = @habitable_moon_max_size }

	production_spawn_chance = 0.4

	colonizable = yes
	district_set = standard
	uses_alternative_skies_for_moons = no

	carry_cap_per_free_district = @carry_cap_normal
}

```

A toxic world:

```
pc_toxic = {
	entity = "toxic_planet"
	entity_scale = @planet_standard_scale
	icon = GFX_planet_type_toxic

	atmosphere_color		= hsv { 0.19 0.45 0.9 }		#DONE
	atmosphere_intensity	= 0.1
	atmosphere_width		= 1.2

	min_distance_from_sun = 60
	max_distance_from_sun = 110

	spawn_odds = 10

	extra_orbit_size = 0
	extra_planet_count = 0

	chance_of_ring = 0.2

	planet_size = { min = 12 max = 25 }
	moon_size = { min = 6 max = 10 }

	colonizable = no
	show_city = no
}

```

A habitable ringworld section:

```
pc_ringworld_habitable = {
	ringworld = yes
	entity = "ringworld_habitable_entity"
	preview_entity = "ringworld_01_damaged_full_entity"
	picture = pc_ringworld
	icon = GFX_planet_type_ringworld
	entity_scale = 1.0
	enable_tilt = no
	fixed_entity_scale = yes
	atmosphere_color		= hsv { 0.0 0.0 1.0 }		#DONE
	atmosphere_intensity	= 1.0
	atmosphere_width		= 0.5
	show_city = yes
	city_color_lut = "gfx/portraits/misc/colorcorrection_continental.dds"
	extra_orbit_size = 0
	extra_planet_count = 0
	chance_of_ring = 0.0
	planet_size = 10
	moon_size = 1
	colonizable = yes
	district_set = ring_world
	ideal = yes
	starting_planet = no
	orbit_lines = no
	has_colonization_influence_cost = no		# applies when within own borders

	is_artificial_planet = yes

	modifier = {
		planet_max_buildings_add = 12
	}

	carry_cap_per_free_district = @carry_cap_normal
}

```

A class-F star:

```
pc_f_star = {
	entity = "f_star_class_star_entity"
	entity_scale = 20.0
	picture = "pc_f_star"
	icon = GFX_planet_type_f_g_star

	atmosphere_color		= hsv { 0.6 0.3 0.6 }
	atmosphere_intensity	= 1.0
	atmosphere_width		= 0.5

	star = yes

	min_distance_from_sun = 0
	max_distance_from_sun = 0
	spawn_odds = 0

	extra_orbit_size = 0
	extra_planet_count = 0

	chance_of_ring = 0

	planet_size = { min = 20 max = 35 }

	colonizable = no
}

```

## Planet icons

Planet icons can be found in *gfx/interface/icons/planet\_type\_icons.dds*, and their sprites are documented in *interface/planet.gfx*. For reference, here is a list of which values to use for which icon:

## Terraforming

Terraforming is defined separately from planets in files found in *common/terraform*. These are relatively straightforward definitions, but do need to be defined for each individual link between two planet types. That means, for example, if a modder wishes to add a new planet type that can be terraformed into anything and have anything terraformed into it they will have to define two links for each existing planet type, one to transform a given type into the new one, and one to transform the new one into each existing type. A basic example of a terraforming link definition can be seen below:

```
   terraform_link = {
       from = "pc_continental"
       to = "pc_tropical"

       energy = 2000
       duration = 1800

       condition = {
           has_technology = "tech_terrestrial_sculpting"
       }

       ai_weight = {
           weight = 0
       }
   }

```

Each link definition starts with the header `terraform_link` and then is followed by arguments determining the starting and ending planet classes for the terraforming operation. After that it is followed by the cost of the terraforming operation as well as how long the operation will take to complete. Afterwards the link has a `condition` block. This is used to determine what requirements are needed before a terraforming operation can be performed, and is used to lock certain transformations behind technology or ascension perks. Lastly a terraforming link definition includes an `ai_weight` entry, which is used to determine whether or not an AI will perform a terraforming.

If desired there are some slightly modifications that can be performed on the basic format. One is to use a `potential` block. When used this will cause the terraforming option to only appear if the listed requirements are met. For example, this terraforming link definition

```
   terraform_link = {
       from = "pc_barren_cold"
       to = "pc_arctic"

       energy = 5000
       duration = 3600

       potential = {
           from = { has_modifier = terraforming_candidate }
       }
       condition = {
           has_technology = "tech_climate_restoration"
       }

       effect = {
           from = { remove_modifier = terraforming_candidate }
       }

       ai_weight = {
           weight = 5
       }
   }

```

Will only show up in the menu if the pc\_barren\_cold planet also has the terraforming\_candidate modifier, and will not be available otherwise.

A final note is that terraform\_link's also support `effect` blocks as well. These are operations that are performed immediately upon completion of the terraforming operation. For example, adding this block:

```
   effect = {
       from = { remove_modifier = terraforming_candidate }
   }

```

Will cause the "terraforming\_candidate" modifier to be removed from the terraformed planet upon completion.

**Modding**