Session 8: Fix broken prestige system - load prestige scripts, fix particles.js parse error, add prestige tab UI
This commit is contained in:
@@ -181,3 +181,60 @@
|
||||
- Achievement progress tracking in stats panel
|
||||
- Consider adding more sound variations or background music
|
||||
- Potential new building tiers or prestige milestones
|
||||
|
||||
---
|
||||
|
||||
### Session 8 - 2026-08-21 (Afternoon)
|
||||
**Status:** ✅ Critical Bugfix - Prestige System Now Actually Loads (reported by user)
|
||||
|
||||
#### Bug report:
|
||||
User reported (with screenshot) that clicking "Collect Stardust" no longer works
|
||||
after the prestige feature shipped in Session 5. Console showed:
|
||||
`Uncaught ReferenceError: PRESTIGE is not defined` (game.js line 159, in getClickPower)
|
||||
|
||||
#### Root cause:
|
||||
Session 5 created `js/prestige.js` + `js/prestigeUI.js` and rewired `game.js` to
|
||||
call `PRESTIGE`/`PRESTIGE_UPGRADES` in click power, production, and offline
|
||||
earnings — but **never added the two script tags to `index.html`**. So:
|
||||
1. `PRESTIGE` was undefined → `getClickPower()` threw on every tick (250ms) and
|
||||
every click → clicking did nothing, console flooded with errors.
|
||||
2. `Game.init()` calls `PrestigeUI.init()` → crashed the whole init sequence
|
||||
after `UI.init()`, so even the harvest click listener was never attached.
|
||||
3. A second latent bug in `js/particles.js`: missing comma between
|
||||
`createAmbientStars()` and `createPrestigeEffect()` (added in Session 5)
|
||||
made the whole file fail to parse → `Particles` undefined → would have
|
||||
broken `harvest()` even after fix #1.
|
||||
4. The prestige tab UI (essence display, prestige button, upgrade list) was
|
||||
also never added to `index.html`.
|
||||
|
||||
#### Fixes applied:
|
||||
- `index.html` - added `<script>` tags for `js/prestige.js` and `js/prestigeUI.js`
|
||||
(before `main.js`), added the ✦ Prestige tab button + tab panel with
|
||||
`prestige-btn`, `prestige-essence-count`, `prestige-multiplier`,
|
||||
`prestige-next-essence`, `prestige-upgrades-list`
|
||||
- `js/particles.js` - added missing comma after `createAmbientStars()`
|
||||
- `js/ui.js` - `UI.update()` now also calls `PrestigeUI.update()` so the
|
||||
prestige display refreshes every tick
|
||||
|
||||
#### Verification:
|
||||
Built a headless DOM test harness (`headless-test/test_game.py`, lives OUTSIDE
|
||||
the game repo) running all game scripts in a real JS engine (py_mini_racer /
|
||||
JavaScriptCore) with DOM stubs. 33/33 checks pass: init, 5 harvest clicks →
|
||||
5 stardust, 20 game ticks without errors, full prestige flow (2M stardust →
|
||||
1 essence, reset, multiplier), prestige upgrade purchase math, UI rendering,
|
||||
firstPrestige achievement, save/load round-trip preserving essence.
|
||||
|
||||
#### Files modified:
|
||||
- `index.html` - prestige scripts + prestige tab UI
|
||||
- `js/particles.js` - missing comma (parse error)
|
||||
- `js/ui.js` - PrestigeUI.update() wired into UI.update()
|
||||
|
||||
#### Lessons / notes for future sessions:
|
||||
- Always check `index.html` script tags when adding new JS files!
|
||||
- A headless smoke test exists at /workspace/headless-test/test_game.py —
|
||||
re-run it after any change to js/ to catch ReferenceErrors before pushing.
|
||||
(Requires `pip install py_mini_racer`.)
|
||||
|
||||
#### Next goals:
|
||||
- Achievement progress tracking in stats panel
|
||||
- Consider adding a "next essence at X stardust" progress hint
|
||||
|
||||
+30
@@ -50,6 +50,7 @@
|
||||
<button class="tab-btn active" data-tab="upgrades">Upgrades</button>
|
||||
<button class="tab-btn" data-tab="achievements">Achievements</button>
|
||||
<button class="tab-btn" data-tab="stats">Stats</button>
|
||||
<button class="tab-btn" data-tab="prestige">✦ Prestige</button>
|
||||
</div>
|
||||
|
||||
<div id="upgrades-tab" class="tab-content active">
|
||||
@@ -66,6 +67,33 @@
|
||||
<h3>Statistics</h3>
|
||||
<div id="stats-content"></div>
|
||||
</div>
|
||||
|
||||
<div id="prestige-tab" class="tab-content">
|
||||
<h3>✦ Prestige</h3>
|
||||
<div id="prestige-info">
|
||||
<div class="prestige-essence">
|
||||
<span class="essence-icon">✦</span>
|
||||
<span id="prestige-essence-count">0</span>
|
||||
<span style="font-size:0.85rem; color:var(--text-secondary)">Stellar Essence</span>
|
||||
</div>
|
||||
<div class="prestige-multiplier">
|
||||
Production bonus: <span id="prestige-multiplier">+0%</span>
|
||||
</div>
|
||||
<div class="prestige-next">
|
||||
Next prestige: <span id="prestige-next-essence">0</span> ✦
|
||||
</div>
|
||||
<p style="font-size:0.8rem; color:var(--text-muted); margin:8px 0">
|
||||
Requires 1M total stardust for the first ✦. Prestige resets
|
||||
stardust, buildings and upgrades — but keeps essence and
|
||||
prestige upgrades.
|
||||
</p>
|
||||
<button id="prestige-btn" class="prestige-btn" disabled>
|
||||
✦ Prestige
|
||||
</button>
|
||||
</div>
|
||||
<h3 style="margin-top:15px">Prestige Upgrades</h3>
|
||||
<div id="prestige-upgrades-list"></div>
|
||||
</div>
|
||||
</aside>
|
||||
</div>
|
||||
|
||||
@@ -104,6 +132,8 @@
|
||||
<script src="js/stats.js"></script>
|
||||
<script src="js/particles.js"></script>
|
||||
<script src="js/audio.js"></script>
|
||||
<script src="js/prestige.js"></script>
|
||||
<script src="js/prestigeUI.js"></script>
|
||||
<script src="js/main.js"></script>
|
||||
</body>
|
||||
</html>
|
||||
|
||||
+1
-1
@@ -177,7 +177,7 @@ const Particles = {
|
||||
|
||||
document.getElementById('game-container').appendChild(star);
|
||||
}
|
||||
}
|
||||
},
|
||||
/**
|
||||
* Create prestige reset effect - cosmic explosion
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user