Creeps Overview - rfsjim/Screeps-Nooby-Typescript-Code GitHub Wiki
Creeps
Energy
- General creeps max cost will be 3.2k energy
- Starting from RCL 7 this can be used with 2.4k energy left over
- Restricting maxEnergy to only the full room capacity size is wasteful at higher RCL due to lost time for maxEnergy to max out at max general creep size
Max Size
- The "body" of a new creep is built out of 7 available body part types,
WORK – ability to harvest energy, construct and repair structures, upgrade controllers.
MOVE – ability to move.
CARRY – ability to transfer energy.
ATTACK – ability of short-range attack.
RANGED_ATTACK – ability of ranged attack.
HEAL – ability to heal others.
CLAIM - ability to claim territory control.
TOUGH – "empty" part with the sole purpose of defense.
- The resulting body being a sequence up to 50 parts.
Movement
- Each body part (except
MOVE) generates fatigue points when the creep moves: 1 point per body part on roads, 2 on plain land, 10 on swamp.
- Each
MOVE body part decreases fatigue points by 2 per tick. The creep cannot move when its fatigue is greater than zero.
- Empty
CARRY parts don't generate fatigue.
- Creep [
CARRY, WORK, MOVE] will move 1 square per tick if it does not bear energy, and 1 square per 2 ticks if loaded.
- Creep [
TOUGH, ATTACK, ATTACK, MOVE, MOVE, MOVE] will move at maximum speed of 1 square per tick.
- Creep [
TOUGH, ATTACK, ATTACK, MOVE, MOVE] will move 1 square per 2 ticks because of rounding up.
Creep Build Considerations
- Miner - Five
work parts will empty a source in the refresh timeframe spawnCreep([WORK, WORK, WORK, WORK, WORK, MOVE], 'miner' + Game.time, creepMemory) == 0)
- Lorry -
Lorry has twice the move parts to carry parts numberOfParts = Math.floor(energy / ((BODYPART_COST["carry"]) + BODYPART_COST["move"]*2)) make sure that the lorry isn't too big (considering max size of 50 parts) numberOfParts = Math.min(numberOfParts,Math.floor(50/3)); then build Lorry
let body = [];
for (let i=0;i<numberOfParts;i++) {
body.push(CARRY);
}
for (let i=0;i<numberOfParts * 2;i++) {
body.push(MOVE);
}
WORK,CARRY,MOVE, MOVE General Creep - Create a balanced creep as big as possible with the given energy, min parts group is a WORK MOVE MOVE CARRY
let minFloorRequiredEnergy = (BODYPART_COST["work"] + ( 2 * BODYPART_COST["move"]) + BODYPART_COST["carry"]);
let numberofParts = Math.floor(energy / minFloorRequiredEnergy);
numberofParts = Math.min(numberofParts, Math.floor(50/4));
let body = [];
for (let i=0;i<numberofParts;i++)
{
body.push(WORK);
}
for (let i=0;i<numberofParts;i++)
{
body.push(CARRY);
}
for (let i=0;i<numberofParts;i++)
{
body.push(MOVE);
body.push(MOVE);
}
// create a creep with created body part for the given role
let creepMemory = { memory: {role: roleName, working: false}};
if (spawnCreep(body, roleName + Game.time, creepMemory) == 0)
{
return;
}