Skip to content

[P1] New games spawn 10 workers against a worker cap of 2 — core gameplay loop broken from the start #310

Description

@itsmiso-ai

Problem: bootstrap_state() seeds the starting crew by iterating Constants.WORKER_NAMES.size(), so a new game now starts with 10 workers (the full name pool expanded in #242) while the worker cap is BASE_WORKER_CAP = 2. Every new colony is instantly 8 workers over cap: the Recruit button is permanently disabled ("At Cap (10/2)"), food upkeep (FOOD_PER_EXTRA_WORKER x 8 extra workers every 10 ticks) collapses food to 0 within the first ~10 ticks, starvation stalls build progress, and the housing -> recruit progression the whole economy is built around never engages. This is a regression introduced by #242 (WORKER_NAMES 2 -> 10): bootstrap always used .size(), so the expansion silently changed the starting crew from 2 to 10.

Evidence:

  • scripts/main.gd:745-753for i in Constants.WORKER_NAMES.size(): state.workers.append(...) (10 iterations)
  • scripts/constants.gd:5 — WORKER_NAMES has 10 entries; BASE_WORKER_CAP := 2
  • Commit 9b6553b (Expand WORKER_NAMES pool and add badge colors for all workers #242 "Expand WORKER_NAMES pool ...") changed only the constants; the bootstrap loop was left iterating .size()
  • Design intent: docs/SPEC.md ("Workers — Jun and Mara"), README.md ("2 autonomous workers"), tests/test_e2e.gd:69 (assert_eq(state.workers.size(), 2, "two workers")), tests/test_worker_cap.gd (cap 2 with no builds)
  • Verified headless (Godot 4.2.2, current main): bootstrap_state() -> workers=10 cap=2 can_recruit=false; a 400-tick sim of that state showed food=0 by tick 10, still 0 at tick 400
  • No existing test exercises bootstrap_state()'s worker count, which is why this shipped

Acceptance:

  • A fresh game starts with exactly Constants.BASE_WORKER_CAP (2) workers; crew panel shows "2 / 2 workers"; Recruit becomes enabled once housing allows
  • New-game economy is sustainable: no instant food collapse / starvation stall with no player input
  • Add a regression test asserting the new-game init creates BASE_WORKER_CAP workers, plus a tick-integration test covering the starting-state food trajectory

Metadata

Metadata

Assignees

No one assigned

    Labels

    auditAudit, review, or investigation work.priority/p1High priority.status/doneWork is complete.type/bugBug fix.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions