Create a central gameState object that tracks all game data.
A game needs a single source of truth — one object that holds all the data about what's happening right now. This is called "state." Every action in the game reads from or writes to this state object.
Ami's gameState includes:
xp(number) — current unbanked XPbanked(number) — safely stored XPriskLevel(number) — danger multiplierzone(string: "safe" or "danger") — current locationtier(number) — player progression tier
Ida's gameState includes:
karma(number) — currency earned from buildsdebt(number) — borrowed funds with interesttier(number) — player progression tierzone(string: "on-lot" or "off-lot") — current locationactiveJob(object or null) — current construction job
Clicking buttons updates state. Console shows correct values after each action.
No rendering. No visuals. State is invisible — we see it only in the console. That is correct for today.
Creating multiple state objects instead of one — there must be exactly one gameState. Everything reads from it.
Forgetting to update the state before logging — always change the value first, then log.
Not understanding that state is just a JavaScript object — it's a plain object with keys and values. Nothing magical.
This is the most important architectural concept in the course. Spend extra time here. Ask: "If I asked you what the player's XP is, where would you look?" The answer must always be: "gameState." If they understand this, everything else flows from it.