Gameplay correctness: quest/state/economy fixes, combat+boss wiring, client truth pass, and a working Fracture Rift
Summary
Follow-up to the 2026-07-20 gameplay-correctness scan (6-lane end-to-end trace). The scan found the codebase's signature defect at scale: fully-built features never wired, and features advertising behavior they don't have. This PR fixes the high/medium findings in three server/client lanes plus the namesake feature itself.
Quest UX (was the 60-second CEO experience, broken):
- Quest progress streams to the client (
Messages.QuestStatusafter offers and each increment, both AI and no-AI branches) - Quest rewards are actually granted (XP + item, drop-at-feet when inventory full)
- Real abandon: new
QUEST_ABANDON(105) routed to the quest service +QuestStatus(null)ack
State-wipe bugs:
- Death no longer wipes up to 60s of progress: respawn-HELLO skips the storage reload for an already-authenticated dead player
- Achievements no longer wiped on login (init is idempotent)
- AI players no longer respawn as unkillable ghosts
Economy/inventory: cake + firepotion purchases no longer phantom, shop stock no longer leaks on abort, unequip preserves properties + notifies owner, stackable drops no longer desync
Combat/progression (advertised-but-fake class):
- Nemesis system resurrected (killer attribution was never passed)
- Roaming bosses broadcast movement, use config stats, can drop legendaries (
bossIdnow set) - Zone XP/gold bonuses applied (were display-only), ascension multipliers applied, gray-mob XP protection sees the real level (was inverted), rested XP depletes, skill unlocks fire on level-up, level-up no longer refills HP on a dead player, party HP/position sync live, roaming-boss leash exemption, map-edge spatial-group clamp
Client truth pass: #tap-debug overlay removed from production, Venice branding retired, boss spawn announcements display, boss leaderboard reachable (L key), HUD equipment icons refresh, minimap fixes (incl. returning-player auto-show), glitch1 sound, quest offer de-duplicated, NPC dialogue keyed by kind, I/J keys guarded, ESC closes rift panels before exiting a run
The Fracture Rift (was completely unreachable): format registration, entry via status-bar button + R key + ESC, positional Messages.* classes, world spawn tick with map-validated positions, kill/death/disconnect wiring (disconnect restores entry position BEFORE save — panel finding), off-owner kills free the owner's spawn slot (panel finding), door-path teleport, SQLite-backed leaderboard, FORTIFIED/EMPOWERED modifiers at spawn
Test plan
pnpm test: 70 files / 3,321 tests green (+122 vs master)pnpm build:server(tsc) +pnpm build:client(webpack) both clean; eslint parity on touched files- Rift implementation delegated to a MiniMax-M3 headless session (flat-rate lane) then hand-verified: full diff review, suite, builds; two panel rounds of findings fixed with tests (disposition record in the PR conversation)
- Deploy note: no env/config changes vs current production; straight pull + build + restart
Summary by Sourcery
Restore advertised gameplay features and wiring across quests, combat, progression, AI, rifts, and client UI, including a fully playable Fracture Rift with persistent leaderboard and correct server-client messaging.
New Features:
- Implement a full Fracture Rift experience with arena teleport, mob spawning, run progression, rewards, disconnect handling, and a client-side menu/HUD/leaderboard UI.
- Add boss spawn world-event announcements and a boss kill leaderboard accessible via keybinds and UI.
- Introduce quest abandon handling on server and client, including status clearing and confirmation messaging.
Bug Fixes:
- Ensure quest progress and completion are streamed to the client, rewards are actually granted (including full-inventory ground drops), and abandon requests clear server-side state.
- Prevent death-triggered respawns from reloading stale storage state, preserving in-memory progression while re-registering the player cleanly in the world.
- Fix AI players respawning as invisible ghosts by re-adding them to the world entity registry on respawn.
- Correct economy handling so consumable purchases like cake and firepotion grant items and shop stock does not leak when inventory is full.
- Make inventory drops and unequips preserve item properties and keep client inventory stacks in sync.
- Apply ascension, nemesis, zone, and roaming-boss multipliers correctly to combat rewards and damage, including gray-mob XP protection using the real player level.
- Keep party HP and positions in sync by updating party state on damage, regen ticks, and movement.
- Exempt roaming bosses from leash resets so they do not rubber-band to spawn mid-fight and broadcast their movement properly.
- Clamp map spatial groups at edges so all tiles belong to a valid group and entities remain visible.
- Make achievements initialization idempotent so persistence-loaded progress is not wiped on login.
- Deplete rested XP correctly during XP gains and avoid refilling HP on level-up for dead players.
- Guard inventory and achievements keybindings behind game readiness to prevent UI toggling when the game is not started.
- Retire production debug overlays and Venice-specific client state while keeping static content intact.
Enhancements:
- Refactor rift messaging to use positional Messages classes that match client parsers and add richer tests around the rift lifecycle and leaderboard.
- Extend RiftManager with walkability-aware spawning, spawned-mob tracking, off-owner kill handling, and SQLite-backed leaderboard seeding/persistence.
- Expand combat-system tests and logic around reward distribution, party sharing, and nemesis/zone/boss interactions.
- Improve quest controller, Venice handler, and message router to keep quest state server-authoritative while exposing abandon and progress flows to the client.
- Enhance minimap rendering to classify entities by kind rather than ad-hoc types and adjust visibility defaults for better UX.
- Wire progression callbacks so skill unlocks trigger on level-up and ascension bonuses affect HP and damage consistently.
- Tighten message format checking and add new message types for rift operations, leaderboards, and quest abandon.
Deployment:
- Integrate rift leaderboard persistence with the existing SQLite storage at server boot while keeping the rest of the deployment flow unchanged.
Tests:
- Add extensive unit tests for RiftHandler, RiftManager, combat and shop systems, Venice quest handling, map grouping, achievements, inventory, auth/respawn, AI-player lifecycle, roaming bosses, progression, storage, and player rested XP to lock in corrected behaviors and messaging contracts.
- Increase overall test coverage for world ticks (regen, aggro), rift lifecycle, and new persistence paths like the rift leaderboard.
Summary by cubic
Fixes core gameplay wiring and ships a fully working Fracture Rift. Quests, combat, bosses, economy, and client UI now behave as advertised, and player progress no longer gets wiped on respawn/login.
-
New Features
- Fracture Rift is playable: enter via status bar or R, exit with ESC; periodic spawns at map-validated positions; door-path teleport; FORTIFIED/EMPOWERED modifiers; correct kill/death/disconnect handling; off-owner kills free spawn slots; SQLite-backed leaderboard seeded at boot.
- Boss leaderboard (L key) and world event announcements for boss spawns.
-
Bug Fixes
- Quests: stream status to the client, grant XP and item rewards (drop at feet when full), support server-side abandon with an ack, and send a final status update before completion to keep the tracker in sync.
- Progress/state: respawn no longer reloads from storage (no progress loss); achievements init is idempotent; AI bots no longer respawn as ghosts.
- Economy/inventory: cake/firepotion purchases grant items; shop stock no longer leaks on full-inventory abort; unequip preserves properties and updates the owner; stack drops send correct counts.
- Combat/progression: killer attribution flows end-to-end; zone and nemesis multipliers applied; ascension damage/HP bonuses applied; rested XP actually depletes; skill unlocks fire on level-up; level-up doesn’t refill HP on a dead player.
- Bosses/world/party: roaming bosses broadcast movement, use config stats, and can drop legendaries; map-edge group clamp prevents invisible entities; party position/HP kept in sync.
- Client: removed
#tap-debug; retired Venice branding; minimap visibility/dots fixed; HUD equipment icons refresh on live equip; NPC talks keyed by kind; I/J keys gated until game start; ESC exits a rift only when no window or panel was closed (rift panels close first); failed rift entries show the server’s reason; boss spawn announcements and leaderboard reachable; rift UI escapes leaderboard names and modifier text to prevent XSS.
Summary by CodeRabbit
-
New Features
- Added the Fracture Rift menu, lifecycle controls, progress updates, rewards, and leaderboard access.
- Added keyboard shortcuts: R for the Rift menu and L for the boss leaderboard.
- Added persistent Rift leaderboard rankings.
- Added quest abandonment and improved quest progress, completion, and reward tracking.
- Added world-event notifications and improved minimap visibility and entity indicators.
-
Bug Fixes
- Improved inventory drop and unequip handling, including stack counts and item properties.
- Prevented purchases when inventory is full.
- Improved respawn behavior, party updates, boss movement, and Rift cleanup.
- Added ascension bonuses to player health and combat damage.
-
Documentation
- Updated in-game messaging to reflect AI integration retirement and static fallback content.