Screeps Wiki
Advertisement

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

Body Parts

Creeps are composed of a sequence of one to thirty 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 1/tick. See movement.
WORK 20 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 5 energy/tick. See building Costs.
Repairs a target structure. Repairs a structure for 15 hits/tick. Consumes 0.1 energy/hit repaired.
CARRY 50 Stores energy. Contains up to 50 energy units. Weighs nothing when empty.
ATTACK 100 Attacks a target creep/structure. Deals 30 damage/tick. Short-ranged attack (1 tile).
RANGED_ATTACK 150 Attacks a target creep/structure. Deals 15 damage/tick. Long-ranged attack (1 to 3 tiles).
HEAL 200 Heals a target creep. Restores 10 hit points/tick.
TOUGH 5 No effect. Provides cheap hit points to creep body.

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.

Movement

Creep movement is dictated by its fatigue property. When a creep moves, it becomes fatigued, and cannot move again until its fatigue level returns to 0. The amount of fatigue generated every time a creep moves depends on several factors: creep weight (body parts), terrain traversed, and the number of MOVE body parts.

Creeps are required to have at least one MOVE body part to be capable of movement (e.g. - even with 0 fatigue, such as an empty CARRY part, the moveTo() action will fail with ERR_NO_BODYPART).

Each body part (with the exception of the MOVE part, and an empty CARRY part) weighs the creep down, adding 1 additional fatigue per component. Crossing plain terrain incurs a 2x movement cost multiplier for fatigue, while traversing swamp terrain costs a whopping 4x movement cost multiplier. Roads, however, can reduce the movement multipliers by 2x. Each MOVE module reduces fatigue by 2 points. Thus, fatigue can be calculated as follows:

Fn = Fc + (W x (Tf / Rf)) - (2 x M)

Where:

  • Fn = new fatigue
  • Fc = current fatigue
  • W = creep weight (Number of body parts, excluding MOVE and empty CARRY parts)
  • Tf = terrain factor (2x for plains, 4x for swamp)
  • Rf = road factor (2x with road, 1x without road)
  • M = number of MOVE parts

Therefore, to maintain the maximum movement speed of 1 tile/tick over plain terrain, a creep must have at least as many MOVE parts as all the other body parts combined. Note that fatigue may never be reduced to below 0. If a creep has fewer MOVE parts than its weight dictates, its movement speed will be slowed accordingly, as seen by the increased number of ticks needed to recover from its fatigue.

Using the formula above with  [ATTACK, ATTACK, TOUGH, MOVE, MOVE], crossing a plain terrain tile:

Tick 1, move 1 tile: Fn = 0 + (3 x (2 / 1)) - (2 x 2) => 0 + 6 - 4 => 2 fatigue
Tick 2, fatigued: Fn = 2 + (0 x (2 / 1)) - (2 x 2) => 2 + 0 - 4 => -2 => 0 fatigue
Tick 3, move 1 tile: ...

Some other examples:

[WORK, MOVE]: 1 tile/tick.
[WORK, CARRY, MOVE]: 1 tile/tick if not bearing energy, 1 tile/2 ticks if loaded.
[ATTACK, ATTACK, MOVE, MOVE]: 1 tile/tick.

Doing Work

Creeps with the WORK body part can perform a variety of tasks.

Harvesting

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.

Construction

Creeps can construct structures on construction sites, at a rate of 5 points/tick, costing 1 energy/tick, per WORK module. If a creep does not have any CARRY body parts, it cannot provide the necessary energy to build the structure.

Repair

Repairing is done to target damaged structures. A creep can restore 15 points/tick to a target structure, spending 0.1 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.

API

Methods

  • attack(target)
  • build(target)
  • dropEnergy([amount])
  • getActiveBodyParts(type)
  • harvest(target)
  • heal(target)
  • move(direction)
  • moveTo(x,y)
  • moveTo(target, [opts])
  • pickup(target)
  • rangedAttack(target)
  • repair(target)
  • suicide()
  • transferEnergy(target, [amount])

Properties

  • id
  • name
  • owner
  • room
  • pos
  • memory
  • my
  • spawning
  • body
  • energy
  • energyCapacity
  • hits
  • hitsMax
  • ticksToLive
  • fatigue

References

Advertisement