The Creep is one of the primary entities used in Screeps. Creeps are created at player spawns, and are made up of several body parts - each capable of performing various actions (e.g. - harvesting energy, moving around the room, building structures, and engaging in combat).
Creeps are composed of a sequence of one to fifty of the seven different body parts. These components each provide the creeps with 100 hit points and a corresponding ability. Each part has weight, which increases creep fatigue as it traverses terrain tiles, with the exception of the MOVE module; the more parts a creep bears, the more difficult it is for it to move.
|Body part||Build cost||Effect|
|MOVE||50||Moves the creep. Reduces creep fatigue by 2/tick. See movement.|
|WORK||100||Harvests energy from target source. Gathers 2 energy/tick.|
|Constructs a target structure. Builds the designated structure at a construction site, at 5 points/tick, consuming 1 energy/point. See building Costs.|
|Repairs a target structure. Repairs a structure for 100 hits/tick. Consumes 0.01 energy/hit repaired, rounded up to the nearest whole number.|
|CARRY||50||Stores energy. Contains up to 50 energy units. Weighs nothing when empty.|
|ATTACK||80||Attacks a target creep/structure. Deals 30 damage/tick. Short-ranged attack (1 tile).|
|RANGED_ATTACK||150||Attacks a target creep/structure. Deals 10 damage/tick. Long-ranged attack (1 to 3 tiles).|
|HEAL||250||Heals a target creep. Restores 12 hit points/tick at short range (1 tile) or 4 hits/tick at a distance (up to 3 tiles).|
|TOUGH||10||No effect other than the 100 hit points all body parts add. This provides a cheap way to add hit points to a creep.|
It is important to note that the order in which parts are added to a creep is important! The sequence of parts dictate which components will be damaged first when a creep is attacked. If a part takes 100 points of damage, it will be completely disabled - the creep may no longer use that part's ability.
Sequence of Actions
See http://support.screeps.com/hc/en-us/articles/203137792-Simultaneous-execution-of-creep-actions for more information.
Creeps will get several actions scheduled to execute per tick. These will then be executed in a fixed order. Not all actions can be executed, for example a creep can't heal and attack in 1 tick.
- heal or repair or build or attack or harvest
- rangedAttack or rangedHeal
Important to note is that rangedAttack is separate from attack and heal. A creep can therefore do both in 1 tick.
AI can order a creep to move. However, there are restrictions that might limit the creeps to be able to do so:
- A creep having fatigue will not move until its fatigue reaches 0
- Creep cannot walk into a wall, a structure (unless this is its own ramparts or a container), or into another creep (unless the other creep moves to another tile during the same tick)
- You can only control your own creeps. You cannot control creeps of other players.
- Creeps must have at least one active MOVE body part to be able to move. Creep cannot move, if it was spawned without MOVE body parts, or if its all MOVE body parts were destroyed by enemy.
- Creep's speed cannot be more than 1 per tick
Depending on proportion of number of MOVE body parts to other body parts which a creep has, and also on type of terrain the creep is stepping into, the creep might acquire non-zero fatigue. This would prevent the creep from making any further movements, until fatigue value drops to zero.
As a rule of thumb for the number of MOVE body parts to reach the maximum speed: a creep needs half the number of non-MOVE body parts travelling on road, the same number of non-MOVE body parts travelling on plain and 5 times the number of non-MOVE body parts travelling on swamp.
The initial fatigue value, which is acquired after move, could be calculated using the following formula:
F = 2 * (W * K - M) Where: F = initial fatigue value W = creep weight (Number of body parts, excluding MOVE and empty CARRY parts) K = terrain factor (0.5x for road, 1x for plain, 5x for swamp) M = number of MOVE parts
After that, with every game tick creep's fatigue is reduced by 2*M, until its value reaches zero. Creep can make next move at the same moment when its fatigue value has reached zero.
Minimum time between moves could be calculated using the following formula:
t = ceil(K * W / M) Where: t = time (game ticks) K = terrain factor (0.5x for road, 1x for plain, 5x for swamp) W = creep weight (Number of body parts, excluding MOVE and empty CARRY parts) M = number of MOVE parts
For example, when creep has 1 MOVE part and 1 WORK part, when stepping into plain:
F = 2 * (1 * 1 - 1) = 0 t = ceil(1 * 1 / 1) = 1
So after move, creep will not get any fatigue and it will be able to make next move in the next tick. Time between moves is 1 tick.
Another example: creep has 1 MOVE part and 2 ATTACK parts, stepping into plain:
F = 2 * (2 * 1 - 1) = 2 t = ceil(1 * 2 / 1) = 2
After move, creep will get 2 fatigue. Creep will not be able to move in the next tick. But in the next next tick fatigue will drop to zero and creep will be able to move. Time between moves is 2 ticks.
Another example: creep has 3 MOVE parts, 2 WORK parts, 3 ATTACK parts, 1 CARRY part, 0 energy, stepping into swamp:
W = 2 + 3 = 5 (CARRY with 0 energy does not count as weight) M = 3 F = 2 * (5 * 5 - 3) = 44 t = ceil(5 * 5 / 3) = 9
After move, creep will get 44 fatigue, which then with every tick will be decreased by 2*M=6. During the following 8 ticks creep will not be able to move, but it could move at 9th tick when fatigue value reaches zero. During these 9 ticks the creep will have the following values of fatigue: 44,38,32,26,20,14,8,2,0.
Creeps with the WORK body part can perform a variety of tasks.
Harvesting is performed on energy source tiles. Creeps are able to harvest energy at a rate of 2 energy/tick per WORK module. If a creep does not have any CARRY body parts, or it reaches its carrying capacity, it cannot hold the energy harvested, and will instead drop the energy to the ground.
Creeps can construct structures on construction sites, at a rate of 5 points/tick, costing 1 energy/point, per WORK module. If a creep does not have any CARRY body parts, it cannot provide the necessary energy to build the structure.
Repairing is done to target damaged structures. A creep can restore 100 points/tick to a target structure, spending 0.01 energy per hit point repaired, per WORK module equipped. If a creep does not have any CARRY body parts, it cannot provide the necessary energy to repair the structure.
- moveTo(target, [opts])
- transferEnergy(target, [amount])
- Screeps creep api https://docs.screeps.com/api/#Creep