What you will complete in this lesson
This lesson has one practical goal: locate the room view, code editor, and Console, then connect the objects you see on screen with the names your JavaScript can read.
You will not move a Creep, change Memory, create a unit, or submit any other game action. Every Console example below is read-only.
The Screeps client can change over time. This guide therefore uses visible arrival checks — what you can see or do after opening each area — instead of promising a fixed button position.
Find and open the three work areas
The Screeps client can rearrange navigation over time, so use the destination checks below instead of relying on one fixed button position.
- Open the room view. From the game interface, open a Room you can currently see. You have reached the room view when the main game area shows the room grid, terrain, and game objects such as Sources, Creeps, structures, or a Controller.
- Open the code editor. Switch to the part of the Screeps client where your game script is shown. You have reached the editor when you can see JavaScript code and the modules or files that make up the script. Do not change code yet.
- Open the player Console. Open Screeps' in-game Console or log area, not the browser developer-tools console. You have reached the right Console when game log output and a command input are available. Run
Object.keys(Game.rooms); the expression evaluates to an array, and Room names appear when your script currently has vision.
Use each area for one job: observe the world in the room view, edit persistent game code in the editor, and run temporary inspection commands in the Console.
These are semantic arrival checks, not a claim about an exact 2026 button location or screenshot. If the client layout changes, the checks still tell you whether you opened the right area.
Find the core objects in your first Room
In the room view you just opened, look for these four object types. The Console checks below will tell you which Rooms and owned objects are available to your script in the current tick.
| Object | What to check in the room view | How code usually finds it |
|---|---|---|
Spawn | Its real name and whether it is idle or spawning. | Game.spawns or FIND_MY_SPAWNS. |
Source | Where the Energy deposit is located. | room.find(FIND_SOURCES). |
Controller | Its ownership, level, and position. | room.controller. |
Creep | Its exact name, body, Store, and remaining life. | Game.creeps or FIND_MY_CREEPS. |
Do not assume that your Spawn is named Spawn1 or that a Creep has a name used by an example article. Names are case-sensitive and must match the values in your own account.
If you do not currently own a Creep, do not invent a name and continue. This lesson can still identify the Room, Spawn, Sources, and Controller.
Run one read-only account inventory
State impact: read-only. This Console snippet reads the current tick and lists object names. It does not move a Creep, create a Creep, submit a structure action, or write to Memory.
const inventory = {
tick: Game.time,
visibleRooms: Object.keys(Game.rooms),
ownedSpawns: Object.keys(Game.spawns),
ownedCreeps: Object.keys(Game.creeps)
};
console.log(JSON.stringify(inventory, null, 2));
Game.spawns is keyed by the names of your Spawns, and Game.creeps is keyed by the names of your Creeps. Game.rooms contains Room objects that are visible to your script during the current tick.
Copy one real Room name from visibleRooms. Do not continue with a placeholder such as W1N1 unless that is actually your Room.
Inspect one visible Room safely
Replace the example value with a Room name returned by the first check.
const ROOM_NAME = 'W1N1';
const room = Game.rooms[ROOM_NAME];
if (!room) {
console.log(
ROOM_NAME +
' is not visible to your script on tick ' +
Game.time +
'.'
);
} else {
const sources = room.find(FIND_SOURCES);
const ownedSpawns = room.find(FIND_MY_SPAWNS);
const ownedCreeps = room.find(FIND_MY_CREEPS);
const controller = room.controller;
console.log(JSON.stringify({
tick: Game.time,
roomName: room.name,
sourceCount: sources.length,
spawnNames: ownedSpawns.map(function (spawn) {
return spawn.name;
}),
creepNames: ownedCreeps.map(function (creep) {
return creep.name;
}),
controller: controller ? {
id: controller.id,
my: Boolean(controller.my),
level: controller.level,
x: controller.pos.x,
y: controller.pos.y
} : null
}, null, 2));
}
This snippet checks that the Room exists before reading room.controller or calling room.find(). It uses arrays returned by Room.find() and converts owned object references into simple names that are easier to compare with the room view.
The example does not claim a particular Source count, Spawn name, Creep name, Controller level, or Console output. Those values must come from your own current game state.
Connect the Console result to the room view
- Match
roomNamewith the Room displayed in the client. - Select each owned Spawn and compare its name with
spawnNames. - Count the visible Sources and compare the result with
sourceCount. - Compare the owned Creep names with
creepNames. - Select the Controller and compare its level and coordinates with the
controllerobject.
The purpose is not to memorize property names. It is to understand that the picture in the client and the objects available to JavaScript describe the same current game state.
How to interpret common results
The Room is missing from Game.rooms
Game.rooms only contains Rooms currently visible to your script. A Room name stored in Memory or remembered from an earlier visit is not proof that a live Room object exists now. Use the dedicated Room visibility guide when this becomes a recurring problem.
Object.keys(Game.spawns) is empty
The current shard and tick contain no Spawn owned by your account. Confirm that you are viewing the intended shard and account state before running code that assumes a Spawn name.
Object.keys(Game.creeps) is empty
This is a valid empty result, not a JavaScript error. It means the current tick contains no Creep owned by you. Continue only with checks that do not depend on a named Creep.
The Console shows undefined
Some Console statements do not return a value. For example, console.log() can print the requested data while the overall expression still evaluates to undefined. Check the printed log and any error message before deciding that the inspection failed.
Visibility is not ownership
Game.rooms contains Rooms available to your script in the current tick. That does not mean every visible Room is yours. Game.spawns and Game.creeps list your owned Spawns and Creeps by exact name, while room.controller?.my tells you whether the visible Room Controller is owned by you.
For this lesson, keep the rule simple: first confirm that a live Room exists before reading deeper Room state, then check ownership on the specific object before a later lesson tries to act on it. If a Room disappears from Game.rooms, use the Room visibility guide for the deeper vision-loss and reacquisition cases.
Completion check
You have completed this lesson when you can do all of the following:
- open the room view, code editor, and player Console, and explain what each area is for;
- identify a Spawn, Source, Controller, and owned Creep in the room view;
- list current visible Rooms, owned Spawns, and owned Creeps;
- replace example names with real values from your account;
- explain why a missing Room or empty object list must be handled before reading deeper properties.
Continue to ticks and the game loop
The next lesson explains Game.time, module.exports.loop, and why Screeps actions and movement should be observed across later ticks:
Understand Screeps ticks and the game loop →
Return to the English beginner roadmap to see all twelve lessons, or use the glossary for short definitions of Room, Spawn, Source, Controller, Creep, and tick.