Screeps Game.getObjectById(): Resolve Saved Targets Safely
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.
ARTICLE LIBRARY
Browse 81 published guides by system, difficulty, content type, or topic. Start with What Is Screeps? A Programming Strategy Game or follow the beginner sequence through How to Combine Your First Screeps Room Loop.
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.
Cache derived IDs and plain data in global, rebuild after resets, invalidate with explicit versions, and keep callers correct when the cache is missing or stale.
Keep one main loop, export small functions, pass current game objects into modules, validate role contracts once per runtime, isolate per-Creep failures, and keep durable state out of module scope.
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.
Request active Segment IDs once, read them on a later tick, distinguish unavailable from empty, validate versioned JSON, and write only after a successful read.
Enter acquire at zero Energy, enter work when full, preserve the previous phase at partial values, initialize explicitly, and keep state selection separate from actions and outcomes.
Inspect one Creep's active WORK, CARRY, and MOVE parts, then use its action result, Store, fatigue, and damage to diagnose missing abilities.
Learn why Harvester, Upgrader, and Builder are player-defined responsibilities, how roles differ from body parts, and why a Creep name does not create behavior.
Use dryRun to validate a WORK-CARRY-MOVE body, submit one safe spawnCreep() request, read its return code, and verify the new Creep across later ticks.
Understand a Screeps tick, Game.time, and module.exports.loop, then run safe observations that show why actions and state changes appear across later ticks.
Build one Upgrader1 loop that harvests from an active Source, moves within Controller range 3, spends Energy with upgradeController(), and switches state across ticks.
English articles are published only after source review, official API checks where applicable, JavaScript syntax review where code is present, duplicate-intent and link checks, and editorial review. Publication does not imply Console or multi-tick live-room verification; those evidence states remain separate in each guide. Review the verification method.