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, so this guide focuses on what each area does rather than promising that a button will always remain in one exact position.
Find the three work areas
The room view
The room view shows terrain, resources, Creeps, structures, Construction Sites, and the Room Controller. Use it to observe what is happening: whether a Creep is moving, whether a Spawn is producing a unit, and which objects are present in the current Room.
The room view displays results. It does not replace the script that decides what your units and structures should attempt.
The code editor
The in-game code editor is where you write and save JavaScript. Screeps executes the active script during each game tick. Later lessons will use module.exports.loop here, but this lesson does not require you to replace or edit existing code.
For now, confirm that you can open the editor and identify the active code branch or module.
The Console
The Console is the fastest place to inspect live game objects, read console.log() output, and see runtime errors. It is useful for temporary checks that do not belong in your permanent main loop.
Simple distinction: the room view shows what the colony looks like, while the Console helps you inspect what the current JavaScript state contains.
Find the core objects in your first Room
Open a Room that you currently control or can see through your game objects. Look for these four object types.
| 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. - Click 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. - Click 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.
Completion check
You have completed this lesson when you can do all of the following:
- explain the difference between the room view, code editor, and Console;
- 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.