Files
alchemist-accessibility/accessibility/docs
Accessibility ModandClaude Opus 5 fe872be683 Phase 1: console history, review keys, and wall tones
Game-file footprint unchanged: still one line in main.lua.

Console (Q4: speak everything queued, cancelled by explicit action):
- history.lua keeps our own unbounded history, since the game's console buffer
  expires entries after 3s. Mirrors the game's (xN) coalescing so what is heard
  matches what is on screen. The review cursor holds position while new lines
  arrive rather than being yanked to the tail mid-read.
- patches/console.lua wraps console.print, calling the real one first so a bug
  on our side cannot swallow a message the player would otherwise see.
- Any keypress reaching the game silences the pending speech backlog.

Hotkeys: [ and ] review, Shift+[/] jump to ends, \ repeat, Shift+\ copy.
Chosen from scancodes the game does not bind. Note keybindings.getCommand()
ignores modifiers, so Ctrl+Up would read to the game as a movement -- our keys
are consumed and never overlay a game-claimed scancode.

Wall tones (Q5: on step, 3D-positioned, radius 5):
- Direction and distance are deliberately decoupled. The listener sits at the
  camera 4 units above the plane under an inverse distance model, so placing a
  tone at the wall's real position would make distant walls quieter (the
  opposite of the request) and collapse the stereo pan. Instead the source sits
  at a fixed radius in the wall's direction at listener height, and volume is
  computed explicitly from distance.
- Step detection polls player coordinates rather than hooking movement, so it
  covers walking, pathing, portals and pushes for free.
- Respects FoV/rememberedFoV; never leaks unseen geometry.

tests/test_history.lua: 16 assertions, all passing, pure Lua.

Not yet verified in actual play -- needs a human at the keyboard.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
2026-08-01 20:38:28 +02:00
..

Accessibility mod — documentation

Research and planning for making Sulphur Memories: Alchemist 0.4.2 blind-accessible.

Doc Contents
01-architecture.md How the game is built: states, console, level model, keybindings, where text already exists.
02-hooking-strategy.md How to attach the mod with (near) zero edits to game files.
03-implementation-plan.md Six phases, each independently testable.
04-open-questions.md Decisions needed before/while building.
05-decisions.md Answers given so far, and what they imply. Supersedes Q1/Q2/Q7/Q10.

The short version

Three findings shape everything:

  1. The game is already keyboard-complete. All 28 states implement keypressed; there's a full rebindable-keys system with contexts. The accessibility gap is that nothing announces what is focused — not that things are unreachable. This makes the job much smaller than a typical mouse-driven game.

  2. The game already writes the text we need to speak. console.print is a single chokepoint for all log messages. level.getCursorMessage() returns tile/creature descriptions. getCursorPopupStats() feeds the item popups in five screens. We are mostly re-routing existing strings to speech, not writing a description engine.

  3. Everything is a required singleton, and debug.getupvalue works. Module functions can be monkey-patched in place, and the file-local selectedOption variables in menu states are readable from outside. A one-line bootstrap in main.lua is the only unavoidable edit.

Proposed footprint: 1–3 lines added to main.lua, everything else new files under accessibility/. A git baseline tagged vanilla-0.4.2 makes re-application on future versions a rebase.