Skip to content

MAX_ENERGY, MAX_STAT_LEVEL, STARTING_STAT_POINTS are hardcoded in code and dead in economy.json #81

Description

@wpinrui

Architecture §1 principle #1 says: "All tunable values live in JSON. Code never contains magic numbers." These three break it, and worse, they break it silently — the JSON values still exist and look authoritative.

// src/engine/index.ts:11-13
export const STARTING_STAT_POINTS = 10;
export const MAX_ENERGY = 100;
export const MAX_STAT_LEVEL = 20;

These are duplicated in economy.json as resources.maxEnergy and startingStatPoints.

The code constants win. The JSON values are dead. Editing economy.json to retune max energy or the starting stat budget would do absolutely nothing, with no error and no warning.

This is a trap for whoever balances the game later — the config file lies about what it controls.

Fix

Read these from economy.json and delete the code constants (or, if there's a reason they must be compile-time, delete the JSON keys so the file stops advertising control it doesn't have). Pick one source of truth.

Related: the unread-statEffects-keys issue and the hardcoded part-finding bonus — same class of defect.


From the 2026-07-13 code audit (Researcher). Verified against main @ b8e0d70.

Metadata

Metadata

Assignees

No one assigned

    Labels

    balanceGame balance and tuningbugSomething isn't working

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions