Screeps: Clean Dead Creep Memory Safely
Clean stale Memory.creeps entries by comparing them with Game.creeps. Delete only confirmed dead names and keep custom task indexes in sync.
TOPIC · 7 GUIDES
Focused English articles connected to memory, organized with the same filters used by the main article library.
Clean stale Memory.creeps entries by comparing them with Game.creeps. Delete only confirmed dead names and keep custom task indexes in sync.
Publish versioned shard-owned channels, validate remote strings, enforce a conservative UTF-8 project budget, detect writer restarts and revision regressions, and measure freshness with local observation windows.
Distinguish local variables, disposable heap cache, and persistent Memory; initialize Creep state safely; store JSON-compatible values; and recover current game objects from IDs.
Publish versioned public RawMemory segments, request one foreign segment for the next tick, validate untrusted JSON, rotate subscriptions, and detect stream changes without confusing local, cross-shard, and foreign storage.
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.
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.