Skip to content

Play background music on the title screen - #65

Closed
kafuji wants to merge 36 commits into
JamesIV4:mainfrom
kafuji:claude/title-screen-bgm-7275e2
Closed

kafuji wants to merge 36 commits into
JamesIV4:mainfrom
kafuji:claude/title-screen-bgm-7275e2

Conversation

@kafuji

@kafuji kafuji commented Nov 1, 2026

Copy link
Copy Markdown

What

The startup menu now plays its own BGM: "Fantasy Orchestral Theme" by Joth (CC0, OpenGameArt).

  • TitleMusic (src/audio/music/title-music.ts) reuses FileMusicPlayer with a one-track library, so it gets the same streaming, crossfade looping and procedural fallback as the in-game music.
  • useTitleMusic (src/ui/app/session/use-title-music.tsx) plays it while startupMenuVisible is true. It fades out when a game starts, and the player (and its AudioContext) is released about 1.5 s later.
  • It follows the existing sound, music and music-volume options. Because of the autoplay policy, it starts on the first pointer, key or touch gesture.
  • createDefaultBackgroundMusicPlayer now takes an optional library.
  • Credits were added to public/licenses/music-credits.txt.

Why

On desktop/web the engine isn't created until a game starts, so the title screen had no music. The title music therefore lives on the UI side rather than in the engine's BackgroundMusic.

Notes for reviewers

  • The track is the original MP3 (~3.8 MB, 3:12), not loudness-normalised and re-encoded to Ogg like the other tracks, because ffmpeg wasn't available. Re-encoding it would match the rest of public/music/.
  • The piece ends on a crescendo and loops with a 4 s crossfade back into its quiet intro. Nobody has listened to the loop point by ear yet.
  • Tests: new title-music.test.ts. tsc --noEmit and the src/audio/music tests pass. In the dev server, the title screen fetches the track and it decodes without errors.

🤖 Generated with Claude Code

claude and others added 30 commits October 30, 2026 18:54
- Update checker queries kafuji/nethack-3d-plus releases
- Vite GitHub Pages base follows the repository name
- README and privacy policy credit upstream and link to this fork

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_0151xkPns3FZDoHATwhZvNjP
- Run tsc, vitest, i18n:check, and startup:check-rulesets on PRs and main
- Raise timeout for the slow blood-ground rasterizer test (~7s)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_0151xkPns3FZDoHATwhZvNjP
- Mount fork-only strings under en.plus (src/plus/i18n/en.ts) and add ja
  translations in src/plus/i18n/ja.ts, merged on top of upstream ja.ts
- Translate 34 ja keys that were still English
- Externalize the Top Scores dialogs, timeline, and reports; localize
  English labels stored in score records at display time
- Localize tile context actions, message navigation labels, technique
  menu headers, tileset layout names, and a few engine messages
- i18n:check tolerates locales that have not translated plus.* yet

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_0151xkPns3FZDoHATwhZvNjP
- Startup Top Scores button, character sheet panel titles, solid color
  picker, technique menu counters, overwrite confirmation, Unwield label
- Floating XP / experience level labels above the player
- Client-generated window titles (message history, help files)
- Trap and hidden-find labels recorded by run telemetry

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_0151xkPns3FZDoHATwhZvNjP
Review of ja.ts against JNetHack conventions: role is 職業, search is
探す, explore mode is 探検; fix mistranslations (legacy intro, autoopen,
tip, quiver, version-check status), untranslated tileset details, and a
button name mismatch in the save import notice. Fork strings now reuse
upstream stat names (腕力, 器用さ, 知性).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_0151xkPns3FZDoHATwhZvNjP
- scripts/plus/extract-jnethack-texts.mjs pairs JNetHack and NetHack
  sources: 419 monster names, 682 object names/appearances by category,
  and 2782 message templates from JNetHack's /*JP*/ annotations
- src/plus/game-text: template matcher, doname-style object name
  translator (counters, BUC/erosion prefixes, worn/wielded suffixes),
  and hand-written rules for runtime-composed combat messages
- Applied only when displaying the message log, floating messages,
  prompts, menus, inventory, and info windows; parsers keep English
- Lazy-loaded; toggle under Options > Display when the UI is Japanese

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_0151xkPns3FZDoHATwhZvNjP
- Extract JNetHack map feature/trap names (defsym.h), dungeon branch
  names (dungeon.lua), and role/rank/god names (role.c)
- Translate stairs/altar descriptions, monster-vs-monster attacks, and
  status bar title, location, hunger and encumbrance words
- Reject template matches whose captured text stays in English, and drop
  overly generic extracted formats, to avoid garbled output

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_0151xkPns3FZDoHATwhZvNjP
…prompts

- Extract quest.lua texts (legacy intro, quest dialogue) and translate
  whole info windows; extract enlightenment attribute pairs for the
  end-of-game disclosure, plus yn_function/putstr/Strcpy prompts
- Hand-written JNetHack-style rules for getobj prompts, shop greetings,
  hunger, lifting, eating, wielding, pet kills and gold notices
- Stop substituting translated verb phrases into templates and drop
  extracted templates that ignore their arguments, avoiding mistranslation

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_0151xkPns3FZDoHATwhZvNjP
Integrates the Japanese localization, sound and BGM work from main.

- Game text now uses three tiers: main's curated translations, then the
  JNetHack-derived translator as a fallback (messages, prompts, items,
  player titles, locations, quest windows), then unreviewed Nehww
  references marked 参考訳. JNetHack punctuation is normalized to 、。
- Conflicting UI files take main's implementation; the separate game text
  toggle is removed since translation follows the interface language
- Drop fork ja overrides that main already reworded, and unused strings
- Remove accidentally committed Node compile caches and ignore them
- Add the 18 sound-effect and music strings main added in English to the
  es, fr, ko, pt-br, ru and zh-cn locales so i18n:check passes

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_0151xkPns3FZDoHATwhZvNjP
Set up fork, CI, and Japanese localization (UI + in-game text)
- Add disclosure rules for background, basics, status and skill lines
  (rank/role, alignment and mission, opposed deities, HP/Pw/XP, score,
  autopickup, wielding, skills, piety, handedness, wallet, hunger, load,
  magic cancellation), reusing the curated role/rank/deity/skill names
- Extract enl_msg()/you_*() pairs generically into sentence templates for
  both tenses, including contracted negatives
- Extract sentence-like entries from literal message tables inside
  #if 0 /*JP*/ blocks (e.g. slime/stoning texts), and keep JNetHack
  translations that fold a body_part() argument into the text
- Fix #if 0 block matching that could span into the next block
- Align fork Top Scores role names with the curated vocabulary

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_0151xkPns3FZDoHATwhZvNjP
Translate end-of-game disclosure and more JNetHack message tables
…exts

- Extractor expands ternary-chosen messages and arguments into paired
  variants (by condition), inlines literal %s arguments, and matches
  wrapped arguments both ways; templates grow from 3156 to 4628
- Extract humanoid body part names and use them for possessive messages
- Rules for monster weapon swings and for monster resistance gains and
  trap escapes, which JNetHack itself leaves untranslated

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_0151xkPns3FZDoHATwhZvNjP
Sound effects
- Nine procedural sounds for events upstream left without assets:
  explosion, ray/wand bolt, wand fizzle, potion shatter, scroll read,
  trap triggered, teleport, prayer and shop bell. They use the existing
  synth: builtin sources, so sound packs can still override them
- Message-log triggers for each, with tests, and labels in all locales

Background music
- Region-aware track preferences from the status line's dungeon name
  (Mines/Sokoban/Quest/Ludios/Gehennom/endgame); the playing track
  crossfades when the region changes
- Random starting track per mood when no region preference applies
- Stingers: a short lament on game over, and a small fanfare when
  entering a new branch, with the music ducked underneath

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_0151xkPns3FZDoHATwhZvNjP
- MusicStatusEffectChain sits after the music mix: modulated delay
  (vibrato/wobble), distortion, low-pass, tremolo and stereo panner,
  plus playback-rate drift for file tracks
- Confused: pitch and pan wander irregularly; stunned: wider, faster
  sways with tremolo; hallucinating: wobbly vibrato and distortion;
  blind: slightly muffled; deaf: heavily muffled and quiet; turning to
  stone: slower and darker. Effects combine by strongest parameter
- Status bits come from the condition mask for each runtime and are
  forwarded only when they change; works with the procedural fallback

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_0151xkPns3FZDoHATwhZvNjP
More game text translation, synthesized event sounds, regional and status-colored BGM
- Reject translations that still contain a 3+ word English run copied
  from the original (e.g. a pattern capturing "your displaced image and
  misses you" as a monster), falling through to JNetHack or the original
- Menu rows in question dialogs also try message translations, so
  options like "All types" and "Items of unknown Bless/Curse status"
  are shown in Japanese; tile tooltips keep their stricter behavior
- Translate quoted speech by its inner text, priest names
  ("the priestess of <deity>"), temple entry lines, and formats whose
  %s glues to the next word ("moving %sfaster") with small adverbs

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_0151xkPns3FZDoHATwhZvNjP
Fix mixed-language and untranslated game text from play reports
- Add ~1,800 renderings to nethack5-source-ja.json for message formats
  found by running every pline-family call in the NetHack 3.6.7 and 5.0
  sources through the display translation, including assembled messages
  such as "Kaablamm!  You hear an explosion in the distance!" and
  "The flute toots."
- Let a later translation layer win when an earlier generic rule kept
  English words ("Somehow, the jackal" read as a monster), and prefer
  JNetHack over a curated rendering that still has English left
- Treat a single unknown lowercase word captured by a template as English
- Add scripts/i18n/extract-source-messages.mjs and an opt-in coverage
  test that lists source messages still shown in English

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
An() writes "A dagger"; without the JNetHack dictionary (non-Japanese
system locale, as in CI) the item was left in English.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…tion-e5995e

Translate remaining untranslated NetHack messages into Japanese
- Add oracles-rumors-ja.json pairing NetHack 3.6.7 and 5.0 rumors and major
  oracles with JNetHack's Japanese text, plus translations for rumors added
  after 3.6.7.
- Translate rumors from the Oracle, fortune cookies and engravings, and
  translate the major oracle window.
- Translate the shop credit and sale prompts, and let prompts fall back to
  the NetHack source message dictionary when nothing English is left.
- Stop the JNetHack translator from returning Object.prototype members for
  text such as "constructor".

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Translate oracle consultations, rumors and shop credit prompts
- Prompts now use the assembled message templates before JNetHack, so
  "Put in what type of objects?" no longer renders as "どの種類のものをPut in?".
- Reject JNetHack prompt renderings that copy ordinary English words.
- Translate "What kinds of thing do you want to put in?" and the
  "Just picked up: ..." / "Items you just picked up" menu choices.
- Give the JNetHack translator prototype-free dictionaries, so text such as
  "constructor" no longer turns into "function Object() ...".

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Translate container class menus and the just-picked-up choice
…rrencies

- Final disclosure lines assembled in insight.c: characteristics with
  base/peak/limit, wallet and stashed gold, death, bones, skills with
  "could have enhanced", experience, riding, traps, combat bonuses, moon.
- Vanquished and genocided lists, class headers, and killers such as
  "a hallucinogen-distorted werejackal" in the dungeon overview.
- end.c summary window (Goodbye, "You died in ... with N points",
  valuables, header line) and chronicle events.
- Samurai object names (sake, kabuto, ...), bottle names in potion
  messages, possessive body parts ("the jackal's head").
- Hallucinatory currencies in messages and prompts.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
kafuji and others added 6 commits November 2, 2026 08:28
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Translate end-of-game reports, Samurai item names and hallucinated currencies
…city

Drag the log's bottom-right corner to widen it or show more lines; the
default size is the minimum, the size is kept per device, and a
double-click resets it. A new client option sets the log's background
opacity so more of the dungeon shows through.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…cy-753262

Make the desktop message log resizable with adjustable background opacity
The startup menu now plays "Unexplored Expansion" through a dedicated
file music player, fading out when a game starts. It follows the existing
sound/music/volume options and resumes on the first user gesture.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
"Fantasy Orchestral Theme" by Joth (CC0, OpenGameArt.org) replaces the
reused in-game track. It is kept as the original MP3.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@kafuji

kafuji commented Nov 2, 2026

Copy link
Copy Markdown
Author

Opened against the wrong repository by mistake — sorry for the noise.

@kafuji kafuji closed this Nov 2, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants