Combat Overhaul: Spaceport Automation

Spaceport Overhaul and Automation
The ExO Spaceport Overhaul and Automation is available in two versions - as a standalone mod, i.e. ExOverhaul: Spaceport Automation, and as part of the Combat Overhaul mod. There are three significant differences between these two mods: Aside from these differences, all that follows applies for both mods
 * 1) The standalone mod uses the vanilla weapon scaling for its balance, whereas the combat overhaul version of spaceports uses our revamped component scalings.
 * 2) The Combat Overhaul mod has a Dreadnought shipsize as well as Dreadnought Assembly Yard module, the standalone mod has instead a special stardock module that gives extra ship build cost discount.
 * 3) Vanilla spaceports give a considerable amount of naval capacity, whereas spaceports in the Combat Overhaul mod give no naval capacity at all (see the entry on naval capacity for more details). Thus the standalone ExOverhal Spaceport Automation mod gives naval capacity, scaling slightly differently from vanilla to compensate for spaceports having 9 levels (level 2 gives 3 instead of 5, level 9 gives 12).

Spaceport Types
Spaceports have been reworked to have three types: economic, defensive and "stardock" types - each having a unique bonus. Each spaceport type appears as an "initial module", that is, a module you can pick when the player chooses which type of spaceport to build, with each of the spaceport types coming in 3 varients, corresponding to either the Mass-Drivers, Lasers or Missiles spaceport base weapon.

Economic Hub (i.e. economic spaceport) gives a special planet modifier that enhances mineral/energy/research tile production and increases the planet's border extrusion. This modifier is updated as the spaceport levels increase, giving

Level 1 gives +2% border extrusion, +2% minerals/energy/research (+2/+2/+2 in each research field), withs levels 2-8 giving +1% / +1% increase per level and Level 9 giving +2% / +2% for a full +10% border extrusion and +10% tile production

Stardock Spaceport gives its own special planet modifier, again scaling. This modifier increases the spaceport's Ship Build Speed (i.e. its universal ship building speed multiplier). This modifier scales from 15% on level 1 to 145% on level 9.

Planetary Fort (i.e. defensive spaceport) does not give a planet modifier, but instead has a modifier applied directly on the spaceport. Its difficult to find but you can see this modifier on the spaceport's tooltip in solar system view. This modifier includes bonuses to the spaceport's tracking, fire rate, armor, shield HP and shield regen.

It important to note each spaceport type's bonuses are unique and exclusive. Thus only the Stardock spaceport gives a ship build speed, and only the planetary fort gets armor, shield or a combat buff.

Spaceport Weaponry
Spaceports function differently from other stations or ships. They do not have components in the usual manner, although components are added to them. In vanilla this works like this: the "initial" spaceport modules, i.e. the missile, kinetic or laser modules you can pick when building a spaceport, have both a "section template" and a "component set" defined for them. In effect what they do is spawn the spaceport core section mesh (making it visible graphically), and populate it with special spaceport components that are hidden in the normal ship designer window. As a result of this, spaceport do not have shield in vanilla, and they scale not through changes in components but rather through a static modifier that is applied on the spaceport automatically. You can see this modifier in the tooltip that pops up when the pointer is on the spaceport in the solar system view.

All the core (i.e. initial) modules and the weapon modules use custom made weapon components that have unique weapon tags. These weapon tags are used to create custom/unique modifier that do not exist in vanilla, e.g. weapon_type_spaceport_plasma_damage and such like (you can see these if you look in the mod's static_modifiers folder and component_tags). The weapons themselves have been balanced respective of the normal t1 components of the same type. That is, spaceport lasers are identical to red lasers (S/M/L), Kinetic art. is identical to t1 kinetic art. and so forth.

Now, in order to make sure that spaceport weapon scale with technology, an event runs whenever a new tech is unlocked which adds unique modifiers to the spaceport based on the modules inside it. If you have lasers in your spaceport, and you unlock tier 2 lasers tech, the spaceport weapons will be almost immediatly buffed.

The same logic works with the defensive station's shields, although here both the tier of shield tech, and the level of the spaceport impact the modifiers applied.

Spaceport Automation
Spaceport automation is a key new and unique feature of both mods. There were two central reasons for creating this: How does it work? Well, there are a bunch of interlinked events and scripted triggers that make sure automation works smoothly. Basically modules are built using random lists, which have different weights attached to them - depening on all sorts of factors. For example, a machine empire will not get hydrophonic farm modules and has a higher chance of getting an orbital robotics facility, or if the player has a higher tier tech of weapon x, its module is more likely to be picked than weapon y, which has a lower level tech.
 * 1) This is a vast QoL improvement over vanilla, for the simple reason that automation takes away a lot of the unnecessary busy work, especially regarding sectors.
 * 2) The AI in Stellaris, including the sector AI, build spaceport modules only rarely, and the ai_weights on modules are notoriously buggy. As a result spaceports are one of the central weak spots of the AI. Spaceport automation is therefore a huge boost to the AIs performance and use of spaceports, which has a cascade effect on other aspects of the game.

Automation though is not completely autonomous - there are 5 new policies that the player or the AI can choose (the AI is preconfigured to use a specific combination), which allow for configuraiton of how automation works:

Spaceport Automation: In this policy the player can choose what type of automation to use. "Full Spaceport Automation" automated both the core worlds and sector spaceports completely. "Selective Spaceport Automation" automates sector spaceport module development while unlocking special planetary edicts for the core worlds. These edicts allow the player to activate automation as he/she wishes, or to disable it. "Sector Only Automation", automated only sectors, and "Automation Disabled" disables automation for all owned planets, including sectors. The AI is preconfigured to use the Selective Spaceport Automation, and it has weights governing which edicts to use at different stages of the game.

Module Replacement Policy: In this policy the player can choose if and where spaceport modules are scraped when spaceports are auto-converted between types. If set to Scrap Modules (All), all redundant modules (for the specified automation type), will be scrapped when spaceport are converted for both the Core Worlds and Sectors. Scrap Modules (Sector), will limit module scrapping only to sectors. Module Scrapping Disabled, will completely turn off scrapping.

Core Module Development: This policy is available only when choosing Full Spaceport Automation from the previous category, and it allows the player to configure what types of spaceports to build in the core worlds. These are the different options:

Economic Specialized

Specializes all core planet spaceports as Economic Hubs spaceports. All Planetary Forts and Stardocks are automatically converted to Economic Hubs, scraping any non-econonmic spaceport modules and reimbursing the empire with 33% of their base mineral costs.

Stardock Specialized

Specializes all core planet spaceports as Stardock spaceports. All Planetary Forts and Economic Hubs in the core planets will be automatically converted to Stardocks, scraping any non-stardock spaceport modules and reimbursing the empire with a % of their base mineral costs.

Defensive Specialized

Specializes all core planet spaceports as Planetary Fort spaceports. All Economic Hubs and Stardocks in the core planets will be automatically converted to Planetary Forts, scraping any non-defensive spaceport modules and reimbursing the empire with a % of their base mineral costs.

Mixed (Economic Emphasis)

Core planet spaceports will use a mix of defensive and economic modules, with a higher chance (75%/25%) for economic modules to be picked. All Planetary Forts and Stardocks in the core planets will be automatically converted to Economic Hubs, scraping any stardock modules and reimbursing the empire with a % of their base mineral costs.

Mixed (Defensive Emphasis)

Core planet spaceports will use a mix of defensive and economic modules, with a higher chance (75%/25%) for defensive modules to be picked. All Economic Hubs and Stardocks in the core planets will be automatically converted to Planetary Forts, scraping any stardock modules and reimbursing the empire with a % of their base mineral costs.

Note: Stardocks are highly specialized spaceports, as a result automation does not allow for mixed Stardocks.

Following this policy there is also the policy Sector Module Development, which governs how spaceports are developed in sectors. It is identical to the previous category with one exception - you cannot choose to auto develop stardock spaceports in sectors. This option is horrible for the AI, and frankly - quite bad for the player as well.

The last two policy categories are Spaceport Mineral Policy and Spaceport Weapons Preference. In the Spaceport Mineral Policy the player/AI can choose the minimal mineral reserve for automation to take place. This is meant to prevent a situation in which automation hurts the player/ai economically because it depletes the mineral reserve. The AI is preconfigured to use the 500 mineral reserve policy option, which means it will need to have at least 500 minerals in order for automation to occur. The Spaceport Weapons Preference affects the weights of weapon modules being picked by automation. The impact of the picked policy is significant, but other factos such as the respective level of weapons' tech are also important. Thus if the player chooses to focus his/her spaceports on explosives (missiles), but he/she has significantly higher tier kinetics, these will still have a higher chance to appear. The "Mixed" weapons policy means that no weapon preference weights are attached.

Final Note: once you activate automation you will see that all empty spaceport slots in the affected spaceport(s) are filled with a graying construction icon. These are place holder modules meant to prevent an exploit in which the player both builds modules manually, while also benefiting from automation. This also screws up automation. Automation in turn works only 1 module at a time, and you will see a yellow "under construction" module replacing the gray automation module when a module is being auto built. If you don't see the yellow icon, this probably means you don't have enough mineral for automation to occur.