Screeps: Why Game.rooms[roomName] Is Undefined
Learn why Game.rooms[roomName] is undefined without current room vision, how to guard live Room reads, and why Memory.rooms does not prove visibility.
TOPIC · 12 GUIDES
Focused English articles connected to rooms, organized with the same filters used by the main article library.
Learn why Game.rooms[roomName] is undefined without current room vision, how to guard live Room reads, and why Memory.rooms does not prove visibility.
Use fill: 'transparent' for unfilled RoomVisual circles and rectangles, then add debug labels and target paths without confusing visuals with game results.
Read the previous tick's Room events, distinguish parsed and raw mode, filter event-specific data safely, match actor and target IDs when attribution matters, and keep optional history bounded.
Open a Screeps Room, switch to the code editor and player Console, then use read-only checks to match exact Room, Spawn, Creep, Source, and Controller data.
Bind the Claimer and Controller IDs, record only accepted reserve or claim calls, verify reserve events without inventing a targetId, and verify claims through exact next-tick ownership.
Combine three fixed beginner roles in one small loop, submit one validated Spawn request, keep Energy phases stable, expose failure statuses, and verify accepted commands on later ticks.
Resolve an exact Flag, validate its schema, bind saved object IDs to the Flag room and expected type, make fallback an explicit policy, and report configuration drift without mutating the Flag.
Save an ID with room and kind metadata, return explicit invalid, no-vision, missing, wrong-type, and ready states, and keep restoration separate from reselection and actions.
Separate room planning from exit-tile pathfinding, validate the first route step, use finite risk costs versus hard bans, and verify the border transition on later ticks.
Collect requests, choose one target per Observer, make one final observeRoom() call, store only that accepted target, read it next tick, and keep visibility attribution honest.
Use a one-time Memory request, validate a visible room and 0–49 coordinates, allow Road placement on natural wall terrain, reject an existing Road or Construction Site, respect MAX_CONSTRUCTION_SITES, disable before createConstructionSite(), and verify later.
Inspect a misplaced Construction Site, validate its identity, submit remove() once, handle return codes, and verify the result on the next tick.