Difference between revisions of "Useful Constants"

From Screeps Wiki
Jump to navigation Jump to search
Line 59: Line 59:
   
 
<code>upgradeController: 3, withdraw: 1};</code>
 
<code>upgradeController: 3, withdraw: 1};</code>
  +
|-
  +
|Maximum size of the default memory (per shard) in Kilobytes
  +
|2048
  +
|<code>const MEMORY_SIZE = 2048;</code>
  +
|-
  +
|Maximum size of an intetershard memory (per shard) in Kilobytes
  +
|1024
  +
|<code>const MEMORY_INERSHARD_SIZE = 1024;</code>
  +
|-
  +
|Maximum size of a rawMemory segment (per shard) in Kilobytes
  +
|1024
  +
|<code>const MEMORY_RAW_SEGMENT_SIZE = 1024;</code>
  +
|-
  +
|Maximum size of a rawMemory total (per shard, 10 active segments)
  +
in Kilobytes
  +
|10240
  +
|<code>const MEMORY_RAW_TOTAL_SIZE = 10240;</code>
  +
|-
  +
|Hits (Health/HitPoints) per power creep level
  +
|1000
  +
|<code>const POWER_CREEP_HITS_PER_LEVEL = 1000;</code>
  +
|-
  +
|'value' of plains terrain (Note: absence of value could always be
  +
considered a 'plains' since its 0)
  +
|0
  +
|<code>const TERRAIN_MASK_PLAIN = 0;</code>
 
|}
 
|}
 
[[Category:Development]]
 
[[Category:Development]]

Revision as of 03:43, 17 November 2020

This article is a stub. You can help Screeps Wiki by editing to add more information.

This page will list constants either useful because they are missing from the official constants or because they might be interesting to know when solving certain ingame problems.

Missing constants (hardcoded in engine)

Knowing "constant worthy" values that do not have a constant set up in the engine yet is important especially now that private servers get more and more modifiable. This list will be useful to users since they can just use values without having to look them up in the engine code, but it might also help request missing constants from the devs (in case changing these currently hardcoded values might make the game more moddable).

Description Value Code sample
Creep fatigue removal multiplier. It works like this in the engine:

newFatigue = Math.max(0, oldFatigue - ( MOVEparts * multiplier))

-2 const MULT_CREEP_FATIGUE_REDUCTION = -2;
Max bucket value. The CPU bucket fills up to 10000 10000 const MAX_BUCKET = 10000;
Hits (Health/HitPoints) per-part of a creep 100 const CREEP_HITS_PER_PART = 100;
username for the Invader NPCs 'Invader' const INVADER_USERNAME = 'Invader';
Rate at which energy (progress) is dropped from construction sties,

when stomped (moved onto) by creeps.

0.5 const CONSTRUCTION_SITE_STOMP_RATIO = 0.5;
Power of RANGED_MASS_ATTACK, dependent on range. { 1: 10, 2: 4, 3: 1} const RANGED_MASS_ATTACK_POWER = { 1: 10, 2: 4, 3: 1};
The max amount of CPU that can be used in one game tick, any

CPU over the user's assigned amount comes out of the bucket

500 const MAX_CPU_PER_TICK = 500;
The ranges creeps have to be within to execute certain actions. { attack: 1, attackController: 1,

build: 3, claimController: 1, dismantle: 1, generateSafeMode: 1,

harvest: 1, heal: 1, pickup: 1, pull: 1, rangedAttack: 3, rangedHeal: 3,

rangedMassAttack: 3, repair: 3, reserveController: 1, transfer: 1,

upgradeController: 3, withdraw: 1};

const CREEP_ACTION_RANGES = { attack: 1, attackController: 1,

build: 3, claimController: 1, dismantle: 1, generateSafeMode: 1,

harvest: 1, heal: 1, pickup: 1, pull: 1, rangedAttack: 3, rangedHeal: 3,

rangedMassAttack: 3, repair: 3, reserveController: 1, transfer: 1,

upgradeController: 3, withdraw: 1};

Maximum size of the default memory (per shard) in Kilobytes 2048 const MEMORY_SIZE = 2048;
Maximum size of an intetershard memory (per shard) in Kilobytes 1024 const MEMORY_INERSHARD_SIZE = 1024;
Maximum size of a rawMemory segment (per shard) in Kilobytes 1024 const MEMORY_RAW_SEGMENT_SIZE = 1024;
Maximum size of a rawMemory total (per shard, 10 active segments)

in Kilobytes

10240 const MEMORY_RAW_TOTAL_SIZE = 10240;
Hits (Health/HitPoints) per power creep level 1000 const POWER_CREEP_HITS_PER_LEVEL = 1000;
'value' of plains terrain (Note: absence of value could always be

considered a 'plains' since its 0)

0 const TERRAIN_MASK_PLAIN = 0;