Map

Each server (or server shard in the case of MMO) is defined by a world map that contains one or more rooms. Larger maps typically group these rooms hierarchically.

Maps may be rectangular in shape, but both the width and height must be even numbers. The maximum size of any Screeps map is 256x256 rooms, and the minimum size is 2x2.

The persistent world server (MMO) is divided into multiple shards, and each shard has its own map. Each of these maps is divided into four regions. Each region contains one or more sectors. Each sector is a square grid of rooms that is separated from the others by highway rooms.

Maps on private servers might not follow the same conventions. For example, they may consist of a single sector without any distinct regions/quadrants. They may not even contain a recognizable sector. By default, private server maps consist of a single 9x9 sector of rooms bordered by highway rooms. Mods are typically required to change this.

Region

A region (or quadrant) is a group of sectors and highway rooms. On MMO, the map is divided into four areas of uniform size and labelled by ordinal direction (northwest, northeast, southeast, southwest).

A room's name indicates the quadrant it is in. For example, W5N5 is in the northwest quadrant (5 rooms north and 5 rooms west of W0N0).

Sector

An example of a sector, bordered by shared highway rooms to other sectors. Inside blue are the 'claimable' rooms, inside red are the unclaimable source-keeper rooms, inside the gold at-center is the center room.

A sector is a 9x9 block of rooms bordered by highway rooms. They contain 72 controller rooms that can be claimed/reserved by users, eight Source-Keeper rooms and, one center room.

Room

A room is the main play field of Screeps. It is a 2-dimensional plane that is subdivided into a 50x50 square grid (2,500 discrete positions). Room width and height are both hard-coded into the engine in several places, so this convention is unlikely to change in the foreseeable future.

The central 2x2 grid of rooms is named W0N0, E0N0, W0S0, E0S0 from top-to-bottom, then left-to-right.

The X/Y origin ({ x: 0, y: 0 }) of each room is the top-left corner. { x: 49, y: 49 } is the bottom-right corner. Each position/tile has an associated terrain type (plain, swamp, or wall).

Rooms connect to each other along their edges via exits. In a well-formed map, any position on the edge of a room that is not a wall should be an exit position that connects to the adjacent room.

Every object in a room occupies exactly one position or tile at any given time. Creeps may move at most one position per turn.

Any given position/tile can neighbor up to 8 other positions (any cardinal or ordinal direction). Chebyshev distance is used for all range measurement (as opposed to Manhattan or Euclidean distance). This has two important implications:

  • Creeps can cover ground more quickly when moving along a diagonal
  • Diagonally-arranged corridors or hallways of structures allow room objects to be adjacent to more structures than an equivalent vertical/horizontal arrangement.

RoomPosition

A RoomPosition is an object that uniquely defines the location of a single "tile" or square (X/Y coordinates within a room, and the room's name). Since these objects do not have shard name properties, they are ambiguous if shared across shards. All room objects expose their current position via the pos property.

RoomPosition objects can be instantiated directly via their constructor, or indirectly via Room.getPositionAt.

Room position objects are not interned, so they should never be compared by reference, and care should be taken if attempting to extend the RoomPosition prototype with memoized properties.

Global Positions

The RoomPosition class has various methods for measuring distance/range between two positions, but it should be noted that these methods are useless when comparing positions in separate rooms (ex: getRangeTo returns Infinity). The hidden '_packedPos' number property can be used for an efficient workaround to this limitation. The property encodes the position's X/Y coordinates and the room's X/Y coordinates. These can be used to map a position to the global coordinate space:

// Where `pos` is a RoomPosition instance and `50` is the room width and height:
const globalPos = {
  x: (pos.__packedPos >>> 24) * 50 + pos.x,
  y: (pos.__packedPos >>> 16 & 0xff) * 50 + pos.y,
};

See the engine code for implementation details. Note that __packedPos is not part of the public API, and it is subject to change without warning.

Room Types

Controller Room

A Controller room, exit tiles shown left, spawn 'walls' shown right. These happen over exit tiles, when the room borders a respawn/novice zone.

The main type of room in Screeps, these rooms have a controller that can be claimed by a user with enough spare GCL and allow for the building of owned structures. They can also be reserved by a user using a creep with claim parts. These rooms come with between one to two sources, which if unclaimed start at 1500 energy and claimed/reserved boost to 3000. Each room will also have one type of mineral. These rooms' controller can be upgraded in level from zero (unclaimed/reserved) to eight by having a creep pump energy into the controller using upgradeController and allow for more owned structures and better defenses to be built. A player must start in one of these rooms by placing a spawn, if a player has no rooms of this type left they are 'dead' but can respawn elsewhere.

Highway Room

Highway rooms are any room with an East/West or North/South coordinate that is divisible by 10 (ex: 'E50N20' or 'W5S0'). These lines of open-ended and mostly-featureless rooms form a border around each sector.

Highway room terrain is mostly plains and border walls, though small patches of swamp and islands of wall can be found from time to time.

These rooms have no room controllers and cannot be claimed or reserved. However, they may contain several things of interest:

  • NPC terminals: invulnerable, unowned terminals that serve as the source of NPC-generated market orders
  • Deposits: harvestable room objects that provide resources used to produce commodities (which can be sold to NPCs for credits)
  • Power Banks: these structures provide a valuable resource called Power if they are destroyed before they expire

Highway Intersection / Crossroad Rooms

Intersection / crossroad rooms occur at the corner of each sector (i.e. rooms with X and Y coordinates that are both divisible by 10).

On a conventional map (e.g. MMO), the central 2x2 grid of rooms are all intersection rooms, and a highway two rooms wide divides each quadrant.

In addition to the usual highway room features, crossroad rooms on MMO contain stable portals that connect to other shards.

Source-Keeper Room

These rooms do not have a controller and surround the center room in a sector. They have three high-yield sources (4,000 energy) and one mineral with a public extractor.

Each source and mineral in this room is located next to a corresponding Source Keeper Lair. These lair structures periodically spawn Source Keepers creeps to guard these resources. These powerful Invader variants attack any player-owned creep that gets too close to them, but they will not chase distance creeps.

After enough energy is harvested from a source keeper room, invasions will occur. The invaders that spawn in these rooms are significantly more powerful than the ones that spawn in claimable rooms.

Strongholds (powerful Invader-controlled bunkers) may occasionally spawn in these rooms as well. This occurs regardless of whether or not energy is being harvested from the room, and each sector can only contain one stronghold at a time.

Center-Sector Room

These rooms occur at the center of each sector (i.e. rooms with X and Y coordinates that are both divisible by 5 but not 10).

Like source keeper rooms, these rooms contain three high-yield sources and a mineral with a public extractor. Unlike source keeper rooms, they do not contain source keeper lairs.

Occasionally, transient portals will spawn here. These portals connect to another sector center room on the same shard, and they disappear after a number of ticks. These portals provide unique opportunities to explore, expand, or even attack far beyond a player's usual range.