Unattended Sector Defense

On Serpulo, the game uses a system of calculations to determine whether a sector can defend itself when not actively played. These calculations are substantially different from actual gameplay and may be difficult and frustrating to understand. These calculations are referred to here as an unattended sector defense.

For example, unattended defense does not recognize things like:

* Special status effects like wet, burning, and area of effect damage.
* Special defensive effects like Plastinium Walls blocking beam weapons.
* The regeneration of enemy units.
* In general, the fact that Menders are only beneficial when they cover blocks actually being damaged.

A proper understanding of the unattended defense algorithm allows, making much more durable defenses and gives greater confidence in capturing sectors. On Erekir, it is impossible to switch to another sector on the same planet and so unattended sector defense is not manipulable.

## Mechanics

### The Algorithm

*The exact algorithm is derived from the source code file SectorDamage.java.*

* First the game calculates the path taken from the spawn point by a ground unit such as a Dagger to the player's Core, this is basically the path actually taken by enemy ground units, or at least the path they would take if they were not destroyed. In the special case where the map is air only, it is instead a straight line. If there is more than one spawn point, only one spawn point is considered. The path ends when it reaches the nearest corner of the Core.
* The game sums up the hit points of all blocks within 6 tiles of the attack path, for a corridor 12 tiles wide.
* All turrets within 4 + turret range of the attack path contribute to the player's total damage per second (DPS), the game does not care whether they are anti-air or anti-ground.
* All Menders and Mend Projectors within 4 + mender range of the attack path contribute to the player's total repair per second (regen).
* Note that the determinations of the above are a bit imprecise and "blocky" to increase performance. In borderline cases, it is hard to predict whether or not a block/turret/mender will be in range.
* All Units, regardless of where they are on the map, contribute their hit points, DPS, and regen.
* For the enemy wave, hit points and DPS are determined. The player's regen is subtracted from the enemy's DPS.
* Based on the respective hit points and DPS the game then basically calculates how long it would take the enemy to destroy all the blocks in the attack corridor, vs the player to destroy the enemy units, if the enemy units are destroyed first the player wins and takes damage based on how long the enemy wave survived multiplied by its DPS, otherwise the player loses the sector.
* If the player survives, then damage is repaired based on the regen multiplied by the time between waves, potentially repairing all damage.
* It should be noted that nothing will ever be produced or used up while unattended.

#### Particulars

* Turret DPS takes into account the damage (from the ammo) and the firing rate which includes the boost to attack rate from liquid and overdrive. While turrets need to have ammo and/or power to have their DPS calculated, the game makes no effort to determine the "supply quality" of power and ammo.
* If the turret is a piercing beam the game applies a 3x multiplier, if it arcs or frags it also gets some damage increase (x2.5 for Arc, + half the damage of the frag bullets to the base damage). However, areas of effect damage, piercing bullets, and special effects like burning are not accounted for.
* Mender regen is based on the heal percent of the mender, the healing cooldown (including overdrive), and the average hitpoint of blocks within the attack corridor, so if there are many more durable blocks such as thorium walls then menders will contribute a higher regen, but note that the block hit points are divided by the size for multiblock tiles, e.g. for a large thorium wall with 2400 hit points, it is 600 hit points. Importantly, the game makes no effort to determine whether the menders actually cover any blocks that could benefit from mending, as long as they are close enough to the attack path.
* Repair Points and Repair turrets are not classified as menders and do not contribute to regen. However, the game does not distinguish between blocks and units, meaning that regular menders and mend projectors can passively "heal" units.
* Unit regen is calculated based on the build speed of the unit and weapons that have repair percent. Repair effects analogous to repair turrets that only target friendly units are not counted.
* Each point of armor increases the hitpoint contribution of the unit by 5%.
* Suicide units have their DPS divided by 25.
* The enemy does not have a regen value calculated.
* Enemy guardians contribute 3x their DPS and hit points if the guardian is present on the map when the player quits; this is likely so that background calculations cannot be used to cheese a survival sector.
* Unit calculations do not include the boosting effect of Oxynoe's status field ability.

## Strategy

Unattended sector defense is prone to being gamed, feel free to use these principles to either boost your "normal" defenses so they do not mysteriously collapse, or go crazy making unbreakable defenses that make no sense when in-game.

* Hit points is a matter of having a lot of blocks within the 12 tiles wide attack corridor, so forcing the enemy units to walk along a passage enclosed by highly durable walls is the way to maximize hit points. Units are also good for contributing hit points since they don't have to be within the attack corridor.
	+ That being said, DPS and regen should be prioritised; only enough hitpoints to survive each wave is necessary.
* DPS is boosted best by turrets with high direct single-target damage or multi-shot damage, such as the Scorch and Lancer. turrets which are valued for dealing large amounts of area of effect damage, applying special effects, or being economical in use of ammo are not going to be the most cost-effective for boosting DPS.
	+ Because turrets only need to have ammo in them at any point to be factored in, Salvos firing Thorium ammo with the +150% attack rate from an Overdrive Dome will contribute a great deal to attack even though they consume too many items in-game.
	+ It is difficult to predict how much DPS a turret will contribute, for example, a Scorch firing Pyratite contributes nearly the same DPS as a Spectre firing Thorium, as the game doesn't recognize piercing bullets or range. However, piercing beams: Lancer and Meltdown, do get a 3x multiplier.
	+ Turrets that happened to be particularly favored by the algorithm include Scorch for its high raw DPS and Arc, Lancer, and Meltdown because they get a high multiplier to their DPS.
	+ Turrets that happen to be particularly disfavored by the algorithm include Hail, Ripple, and non-damage turrets.
* Regen can be contributed from Menders or any unit capable of building or repairing regardless of whether it has an appropriate AI. Spamming cheap "green" units is a great way to massively boost regen.
	+ Prior to version 143.1 units did not meaningfully contribute repair, so the best strategy in those older versions is to spam menders anywhere along the attack path. Small menders are slightly more effective per-tile than large menders, provided they are within range of the attack path.

##### Common Mistakes

* Not having enough regen. This is harder as of patch 143.1 if you use repair aircraft, but if you only have a few aircraft to patch up walls there may not be enough regen.
* Having only a relatively thin layer of walls within the 12 tile wide attack path. A very "wide" concave defense protected by walls that actually block bullets in attended defense would contribute poorly to unattended hit points. If there aren't enough hitpoints to absorb an enemy attack you will insta-lose. Having a lot of very durable wall tiles, notably Thorium Walls, also increases mender regen by increasing the average block hitpoints.
* Using overly "fancy" defenses or relying overly much on turrets that the algorithm does not value highly, for example Spectres and Foreshadows contribute much less DPS than Meltdowns.

#### Cheese Strategies

* Making a Core schematic consisting of some highly valued turrets like Arcs/Lancers and some menders then leaving the sector for it to be taken in the background.
* Spamming out some tier 1 or tier 2 repair units then leaving. Because these units contribute DPS, hitpoints, and regen you often don't need anything else.
* Boosting Overdrive manually right before leaving,
	+ Using a Logic Processor to deactivate all blocks that passively consume items, and then activate them before leaving, will provide a similar effect.
* Quitting before the guardian wave to cheese guardians that may be able to streamroll or bypass your defenses.
* Spamming Scorch with Pyratite, which has extremely high DPS, other good choices are Arc and Lancer due to their high multipliers and lack of ammo requirement.
* Quitting when units like fliers or Crawlers have slipped past your defenses and are going to destroy your Core, this is harder with an on-map guardian because of the huge multiplier but if your sector scores well enough in DPS and regen even an on-map guardian can be defeated, especially if that guardian's main claim to fame is massive regeneration capabilities.