Invader
The hostile Non-Player Characters (NPCs) of Screeps. Their forces are built up primarily of creeps, however instead of a user's round shape they take on a more angular one colored red with a darker red outline. They have a body the same as a normal creep made up of the same parts. They are immediately hostile to any user's creeps but will only attack/peruse in the room they were created, they can not use exit-tiles and walk over them as normal tiles without being transported.
Room Invasions
The most common Invader based attack a user will encounter is a room invasion. When any player creep harvests energy in a room, it is added to a background counter for that room known as invaderGoal
. Once the counter reaches ~100,000 energy plus a random off-set (See: Engine Code) and a stronghold is present in in the sector (as-of stronghold update, See: Engine code) the invaders will attempt to spawn on an exit tile in the room. Invaders may only spawn on exit tiles from adjoining neutral rooms which are connected by exit-tiles, such as a Highway room, Source-Keeper room, or a Controller room that does not have an active user Claim/Reservation. If there is no viable exit tile for them to use or stronghold in the sector, they will not spawn. Invasions can happen in any room that energy harvesting is happening, even in Source-Keeper & Center Sector rooms where they will normally attack in greater strength.
Once spawned, the Invader(s) will seek out and attack user creeps it can path to. It will avoid attacking structures unless it is blocking its access to the user's spawn (Such as built walls & ramparts). In non-claimed rooms where there is no spawn, as long as one Invader remains with attack parts they will wait in-room till they die naturally or are killed.
The invader(s) will not stop attacking until:
- They die of natural causes (their
TicksToLive
by default 1500, reaches 0). - All Attack-based Invaders die (Healer invaders will
suicide()
if no attack-based body type invaders remain) - They succeed in killing all the user's creeps in a room and can reach the spawn. (If they can reach (path) to the spawn & there are no active room creeps, they
suicide()
, only applies to rooms with a controller & level (owned room)) - Their HP (
hits
) are brought to 0 by the user's creeps or towers.
Their body makeup and number of Invaders spawned during an invasion varies first by the presence/absence of a controller. Rooms with a controller will scale based on its level
while rooms without a controller (SourceKeeper/Center Sectors) will always spawn a 'raid' or larger group of invaders (See: Engine Code), controllers with a level greater or equal to four also have a chance to spawn raids. They will occasionally be boosted, and on-death will drop energy & boosts according to their body makeup in a tombstone which a user can withdraw from, and when the tombstone decays will drop to the ground and begin to decay as well.
Dealing with Room Invasions
Room invasions are one of the first tower-to-creep & creep-to-creep combat a user partakes in. In an owned room RCL 3 or greater, a tower can be use to attack and destroy the Invaders providing that they do not out-match the towers damage (rare, but can happen with boosts & raids at later RCLs depending on their positioning). In remote harvesting rooms, where a user does not have owned objects like towers creeps are normally employed. They can be 'retained' by renewing and renewed at a spawn until they are needed & deployed to a room (sometimes energy expensive) or spawned on-demand by the user's spawn system to deal with the attack (takes time to spawn). Generally, you will need:
- A System or Systems to detect an invader has spawned in the room
- A System or Systems to deploy your countermeasure creep (either spawned deploying mission, or call spawning for it)
- Logic to out-match the size of the invader (greater attack & healing or just attack)
- Logic to guide the combat creep to the target & to destroy the target.
Once mission complete, if reusing the creep I needs to be healed up and renewed, if not, it can be repurposed for other attack missions, or recycled for a return of its energy, or what-ever other task the user desires.
Spawning Invaders
Though use of the Screep's GUI it is possible to spawn invaders of approx. desired size and with or without boosts by using the menu, then clicking on an exit tile. These Invaders will behave exactly like their normally spawned counterparts, but should have no effect on the background counter and do not drop energy/boosts when killed. The damage they can do to creeps however, is still very real. This is mainly mean to test defenses, and can not be done when hostile user creeps are in the room (creeps different from other user's creeps).
Source-Keepers
Source keepers are special invaders found in Source-Keeper rooms towards the center of a sector. They spawn from eternally from keeper-lairs, the process begins as soon as the creep hits low HP or dies of natural causes.
Each source-keeper seeks out and defends the nearest source or mineral from its spawn location and defends it. Unlike regular invaders, they will not chase a user's creeps but instead will attack anything in range and stay to guard the source.
Strongholds & Stronghold Invaders
Strongholds are Invader bases that periodically spawn in an Source-keeper room in a sector. Only one can be spawned at a time, and they vary in level 1 - 5. While they are quite a challenge to take down, they contain many valuable resources.
Invader Core
The primary core of an invader base, it acts as a spawn & brain for invaders stationed at the base. If the core dies, any invaders created by the base stop functioning and no invasions can happen in the sector for a limited time.
The stronghold will also spawn proxy invader cores which will attempt to reserved the controller of the room they are spawned in, causing problems for harvesting in that room.