Skip to content

setNoteStateProvider integration for renderer-agnostic visual feedback #8

Closed

Description

@cchacs

Part of #2. Depends on #7 (scoring engine).

Feed judgments from the scoring engine into highway.setNoteStateProvider() (the contract documented in core CLAUDE.md under "Note-state provider — for scorers that want renderers to 'light up' notes," feedBack#254) so whichever renderer is currently active — the default 2D highway, drum_highway_3d, or any future 2D drums visualization — lights up gems on hit/active/miss without this plugin owning any canvas or renderer-specific code.

Contract to implement:

highway.setNoteStateProvider((note, chartTime) => {
    // note is the drum_tab hit object; chartTime is its own `t` (drum hits
    // aren't chorded the way fretted notes are, so chartTime === note.t
    // in the common case — confirm whether drum_tab ever groups simultaneous
    // hits the way `chords` does, and handle that if so).
    // Return null | 'hit' | 'active' | 'miss' | { state, alpha, color }
});
// On teardown: highway.setNoteStateProvider(null);

Tasks:

  • Only one provider is active at a time (core's "last call wins" rule) — make sure this plugin's init()/destroy() lifecycle sets and clears the provider cleanly across song switches and splitscreen panel teardown, mirroring the idempotent-script-guard conventions used elsewhere in this ecosystem (difficulty-ladder's window.__feedBackDynamicDifficulty pattern, section_map's hook-install guard).
  • Decide alpha/fade-timing ownership here (per the contract, the provider owns all fade timing, not the renderer) — a struck note should decay, a currently-held state (if drums ever model sustained hits — unlikely for this instrument, confirm) should stay lit.
  • Verify behavior under splitscreen: each panel's highway instance gets its own provider registration; this plugin's state must be per-instance, not a shared module global (same rule difficulty-ladder's CLAUDE.md calls out explicitly).

Acceptance:

  • Hitting a mapped pad lights the corresponding gem on the default 2D highway without any renderer-specific code in this plugin.
  • Same behavior holds when drum_highway_3d is the active renderer (verifies the contract is genuinely renderer-agnostic, not accidentally coupled to the default renderer's internals).
  • No stale provider left registered after leaving the player screen or switching songs.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions