TICK LAB · V1

Break one Screeps call into one Tick

Use constrained transfer(), spawnCreep(), and CPU / Bucket experiments to inspect API returns, intents, budget checks, and modeled Tick state transitions.

Deterministic educational model
Educational experiments, not a full Screeps Engine simulator

The lab currently contains three constrained experiments: Creep.transfer(), StructureSpawn.spawnCreep(), and Game.cpu CPU / Bucket. Each exposes only a small set of verifiable variables and keeps unmodeled boundaries explicit; results explain reviewed API / Engine behavior or constrained budget calculations and are not Live shard evidence.

Experiment 01 / Transfer Energy

Creep.transfer()

Transfer ENERGY carried by Creep1 into adjacent Spawn1.

Tick 100 · World State
Creep1Creep
Energy
50 / 50
Position
20, 20
Spawn1StructureSpawn
Energy
250 / 300
Free capacity
50
Position
21, 20
Code
const result = creep.transfer(
  Game.spawns.Spawn1,
  RESOURCE_ENERGY
);
result—
Tick 101 · Modeled next state
Run the Tick to reveal the state transition
Try a branch directly

No parameter guessing required. Pick a typical scenario to run it immediately and inspect the return code, intent, and next state together.

Custom controlsOr change the world state yourself, then run another Tick.
Range

transfer() requires the target to be adjacent.

Tick Timeline

Adjust the controls, then run this Tick.

Return Code

Adjust the controls, then run this Tick.

Experiment 02 / Spawn Creep

StructureSpawn.spawnCreep()

Use one constrained StructureSpawn.spawnCreep() call to see how name, Busy, and Energy checks determine the return code.

Controlled boundary

Spawn1 is fixed as owned and RCL-usable, the name is Worker1, options is an empty object, the body is limited to three valid presets, and default Room energyAvailable is used. V1 does not model energyStructures distribution, directions, dryRun, exit blocking, or competing Spawns.

Tick 200 · World State
Spawn1StructureSpawn
State
Idle
energyAvailable
300 / 300
Name
Worker1 available
Worker1Spawn request
Body cost
200 ENERGY
Spawn time
9 ticks
Body
3 parts
[WORK, CARRY, MOVE]
Code
const result = Game.spawns.Spawn1.spawnCreep(
  [WORK, CARRY, MOVE],
  "Worker1"
);
result—
Tick 201 · Modeled next state
Run the Tick to reveal the modeled spawning state
Try a Spawn branch directly

These scenarios also expose the checked priority: name conflict comes before Busy, and Busy comes before Energy.

Custom Spawn controlsChange the body, Room energy, Busy state, and name occupancy, then run another Tick.
Spawn busy
Worker1 exists
Spawn Timeline

Pick a scenario or adjust the controls, then run this Tick.

Return Code

Pick a scenario or adjust the controls, then run this Tick.

Experiment 03 / CPU Budget

Game.cpu

Use one constrained Game.cpu snapshot to see how limit, tickLimit, bucket, and getUsed() determine whether an optional task still has safe budget.

Controlled boundary
Game.cpu.limit = 100

This experiment fixes Game.cpu.limit at 100 CPU and varies only bucket, CPU already used, and one optional-task cost estimate. tickLimit is modeled from the documented bucket behavior and capped at 500; bucket is capped at 10,000. RUN / SKIP is a local teaching guard decision, not a Screeps API return code or intent. Real task CPU cost must still be measured on a live shard.

Tick 300 · CPU Snapshot
Game.cpuCPU snapshot
limit
100
tickLimit
500
bucket
4000 / 10000
getUsed()
40
Optional tasklocal estimate
Estimated cost
20
Headroom
460
Budget Guard
const plannedTaskCost = 20; // local estimate
const used = Game.cpu.getUsed();
const headroom = Game.cpu.tickLimit - used;

if (headroom >= plannedTaskCost) {
  runOptionalTask();
}
decision—
Tick 301 · Modeled Bucket
Run the budget check to reveal modeled CPU and bucket movement
Try a CPU branch directly

These scenarios separate bucket refill, steady use, reserve spending, the tickLimit ceiling, and a task that should be skipped.

Custom CPU snapshotChange bucket, current getUsed(), and the optional-task estimate, then run another budget check.
CPU Timeline

Pick a scenario or adjust the controls, then run this Tick.

Budget Decision

Pick a scenario or adjust the controls, then run this Tick.