MILESTONE UPDATE

Milestone 8: Resources & Player Ledger

Project Nightfall’s economy has, until now, existed only as a placeholder. Milestone 8 lays the foundation every future resource system will build on: a generic way to track, spend, and display resources for each player, without hard-coding what those resources are.

Resources as data, not code

Instead of giving each player fixed fields like Gold and Lumber, this milestone introduces a resource definition — a small authoring asset that just needs a stable ID and a display name. Gold, Lumber, and Moonstone now exist purely as three definition assets, with nothing in the underlying code that knows or cares which resources exist or how many there are. A fourth resource, or a fortieth, would slot in the same way.

Each player’s balances live in a new resource ledger: a keyed collection mapping resource IDs to amounts, added onto the existing player record without changing how a player is constructed. The ledger enforces a simple but important invariant — balances can never go negative or silently overflow — and it only ever reports a change after that change has actually happened.

Costs that don’t play favorites

Spending resources is handled through a resource cost: an immutable bundle of “this much of resource A, that much of resource B,” checked for affordability before anything is touched. When a cost spans multiple resources, the ledger validates the whole thing up front and applies every part of the spend together — an observer watching for balance changes never sees a state where half the cost has been paid and half hasn’t. That matters because it’s what will let future costs — building a structure, training a unit, casting a spell — draw from any mix of resources without special-case logic for each one.

Seeing it work

A minimal debug scene ties the pieces together: a local player is seeded with starting Gold, Lumber, and Moonstone, an on-screen display reads those balances straight from the ledger, and two debug key presses let a developer deposit Gold or trigger a multi-resource spend to watch the numbers update live. It’s a proof-of-concept harness, not a real UI, and the starting amounts are explicitly placeholder values — nothing here is tuned for balance yet.

What this milestone does not do is give players any way to actually earn these resources through play — there’s no gathering, no resource nodes, no income loop yet; that’s reserved for the next milestone. For now, Milestone 8 proves the plumbing: a resource system flexible enough that Moonstone, the setting’s more exotic currency, is treated exactly the same as ordinary Gold or Lumber, with no special-cased code anywhere in sight.

Discover more from Project Nightfall

Subscribe now to keep reading and get access to the full archive.

Continue reading