Adaptive soundtrack: urgent drums, crystal shimmer, flawless fanfare - #9
Merged
Conversation
Music now reacts to the run: - Urgent drum layer (kick/hat patterns per theme) crossfades in when hearts drop to 2 or fewer, a hazard looms within 420px ahead, or the Magma King is in the arena. - Shimmer pad layer (lead +12 semitones with sparkle overtones) sparkles over crystal-dense stretches (4+ uncollected within 280px). - Layers are always scheduled; only gains move, so transitions are click-free and stop/victory fade them out. - Victory fanfare gets a brighter "flawless run" variant (8-note arpeggio + bell shimmer) when the run took no damage; the game tracks hits via a new GameCtx.onPlayerHit hook. - Pure trigger logic lives in src/adaptive.ts (adaptiveFlags) with 9 unit tests; 7 more game-level tests cover hit tracking and fanfare routing. Validated: typecheck, 209/209 tests, build (131.67 kB / 40.43 kB gzip), lint, and headless E2E (gain crossfades measured live, zero page errors).
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Music now reacts to the run:
src/adaptive.ts(adaptiveFlags), wired through a newGameCtx.onPlayerHithook and ahitscounter in the game.Validated locally (CI is failing for pre-existing unrelated reasons, so local validation is the gate):
npm run typecheck✓npm test— 209/209 (was 193; +9 pure adaptive tests, +7 game-level tests) ✓npm run build— 131.67 kB / 40.43 kB gzip ✓npm run lint✓{flawless: true}, post-hit victory routes{flawless: false}, zero page errors ✓Screenshots:
/tmp/tinyrex-e2e/01-urgent.png,02-shimmer.png,03-victory.png