Repository navigation
feat(scoring): Rock Band-style drums scoring from a YARG engine port #20
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,26 @@ | ||
| # Changelog | ||
|
|
||
| All notable changes to the Drum Highway plugin. The format follows | ||
| [Keep a Changelog](https://keepachangelog.com/en/1.1.0/); versions follow `plugin.json`. | ||
|
|
||
| ## [4.1.0] - Unreleased | ||
|
|
||
| ### Added | ||
| - **Rock Band-style scoring** from a JavaScript port of YARG.Core's drums engine (`assets/engine.js`, | ||
| LGPL-3.0, see `NOTICE.md`): ±70 ms hit window, multiplier up to x4 (x8 in star power), pro-drums | ||
| cymbal/tom lanes, accent/ghost dynamics bonus, stars, and star power with fill activation. Driven | ||
| through `assets/session.js`, which also adds spot-on timing, roll and drum-solo bonuses. The 2D view | ||
| marks hits / misses from the engine and shows a score HUD when **Score** is on. | ||
| - **Difficulty per player** — Easy, Medium, Hard, Expert, Expert+ (`drums_difficulty_v1`), from the | ||
| settings panel, the HUD badge or D / Shift+D; Expert drops the double-kick notes. Easier levels, star | ||
| power, fills and solos come from the drum tab's feedpak 1.20.0 gameplay metadata; without it the song | ||
| plays Expert only, without star power. | ||
| - **Assists** — auto kick / auto cymbals up to a chosen difficulty (played on the drum sound at their own | ||
| volume), hit-timing presets (Relaxed / Forgiving / Normal / Precision), **Pro cymbals** toggle and an | ||
| input **Offset** (ms) for audio / MIDI latency. | ||
|
|
||
| ### Changed | ||
| - A drum-tab hit is an accent only when the tab marks it (`a`, feedpak 1.20.0) or, for older tabs, when it | ||
| has a written velocity of 100 or more; a hit with no velocity is no longer drawn as an accent. A kick | ||
| marked `x2` is a double kick (GM 35). | ||
| - The "Hits" checkbox is now **Score**. |
Large diffs are not rendered by default.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,165 @@ | ||
| GNU LESSER GENERAL PUBLIC LICENSE | ||
| Version 3, 29 June 2007 | ||
|
|
||
| Copyright (C) 2007 Free Software Foundation, Inc. <https://fsf.org/> | ||
| Everyone is permitted to copy and distribute verbatim copies | ||
| of this license document, but changing it is not allowed. | ||
|
|
||
|
|
||
| This version of the GNU Lesser General Public License incorporates | ||
| the terms and conditions of version 3 of the GNU General Public | ||
| License, supplemented by the additional permissions listed below. | ||
|
|
||
| 0. Additional Definitions. | ||
|
|
||
| As used herein, "this License" refers to version 3 of the GNU Lesser | ||
| General Public License, and the "GNU GPL" refers to version 3 of the GNU | ||
| General Public License. | ||
|
|
||
| "The Library" refers to a covered work governed by this License, | ||
| other than an Application or a Combined Work as defined below. | ||
|
|
||
| An "Application" is any work that makes use of an interface provided | ||
| by the Library, but which is not otherwise based on the Library. | ||
| Defining a subclass of a class defined by the Library is deemed a mode | ||
| of using an interface provided by the Library. | ||
|
|
||
| A "Combined Work" is a work produced by combining or linking an | ||
| Application with the Library. The particular version of the Library | ||
| with which the Combined Work was made is also called the "Linked | ||
| Version". | ||
|
|
||
| The "Minimal Corresponding Source" for a Combined Work means the | ||
| Corresponding Source for the Combined Work, excluding any source code | ||
| for portions of the Combined Work that, considered in isolation, are | ||
| based on the Application, and not on the Linked Version. | ||
|
|
||
| The "Corresponding Application Code" for a Combined Work means the | ||
| object code and/or source code for the Application, including any data | ||
| and utility programs needed for reproducing the Combined Work from the | ||
| Application, but excluding the System Libraries of the Combined Work. | ||
|
|
||
| 1. Exception to Section 3 of the GNU GPL. | ||
|
|
||
| You may convey a covered work under sections 3 and 4 of this License | ||
| without being bound by section 3 of the GNU GPL. | ||
|
|
||
| 2. Conveying Modified Versions. | ||
|
|
||
| If you modify a copy of the Library, and, in your modifications, a | ||
| facility refers to a function or data to be supplied by an Application | ||
| that uses the facility (other than as an argument passed when the | ||
| facility is invoked), then you may convey a copy of the modified | ||
| version: | ||
|
|
||
| a) under this License, provided that you make a good faith effort to | ||
| ensure that, in the event an Application does not supply the | ||
| function or data, the facility still operates, and performs | ||
| whatever part of its purpose remains meaningful, or | ||
|
|
||
| b) under the GNU GPL, with none of the additional permissions of | ||
| this License applicable to that copy. | ||
|
|
||
| 3. Object Code Incorporating Material from Library Header Files. | ||
|
|
||
| The object code form of an Application may incorporate material from | ||
| a header file that is part of the Library. You may convey such object | ||
| code under terms of your choice, provided that, if the incorporated | ||
| material is not limited to numerical parameters, data structure | ||
| layouts and accessors, or small macros, inline functions and templates | ||
| (ten or fewer lines in length), you do both of the following: | ||
|
|
||
| a) Give prominent notice with each copy of the object code that the | ||
| Library is used in it and that the Library and its use are | ||
| covered by this License. | ||
|
|
||
| b) Accompany the object code with a copy of the GNU GPL and this license | ||
| document. | ||
|
|
||
| 4. Combined Works. | ||
|
|
||
| You may convey a Combined Work under terms of your choice that, | ||
| taken together, effectively do not restrict modification of the | ||
| portions of the Library contained in the Combined Work and reverse | ||
| engineering for debugging such modifications, if you also do each of | ||
| the following: | ||
|
|
||
| a) Give prominent notice with each copy of the Combined Work that | ||
| the Library is used in it and that the Library and its use are | ||
| covered by this License. | ||
|
|
||
| b) Accompany the Combined Work with a copy of the GNU GPL and this license | ||
| document. | ||
|
|
||
| c) For a Combined Work that displays copyright notices during | ||
| execution, include the copyright notice for the Library among | ||
| these notices, as well as a reference directing the user to the | ||
| copies of the GNU GPL and this license document. | ||
|
|
||
| d) Do one of the following: | ||
|
|
||
| 0) Convey the Minimal Corresponding Source under the terms of this | ||
| License, and the Corresponding Application Code in a form | ||
| suitable for, and under terms that permit, the user to | ||
| recombine or relink the Application with a modified version of | ||
| the Linked Version to produce a modified Combined Work, in the | ||
| manner specified by section 6 of the GNU GPL for conveying | ||
| Corresponding Source. | ||
|
|
||
| 1) Use a suitable shared library mechanism for linking with the | ||
| Library. A suitable mechanism is one that (a) uses at run time | ||
| a copy of the Library already present on the user's computer | ||
| system, and (b) will operate properly with a modified version | ||
| of the Library that is interface-compatible with the Linked | ||
| Version. | ||
|
|
||
| e) Provide Installation Information, but only if you would otherwise | ||
| be required to provide such information under section 6 of the | ||
| GNU GPL, and only to the extent that such information is | ||
| necessary to install and execute a modified version of the | ||
| Combined Work produced by recombining or relinking the | ||
| Application with a modified version of the Linked Version. (If | ||
| you use option 4d0, the Installation Information must accompany | ||
| the Minimal Corresponding Source and Corresponding Application | ||
| Code. If you use option 4d1, you must provide the Installation | ||
| Information in the manner specified by section 6 of the GNU GPL | ||
| for conveying Corresponding Source.) | ||
|
|
||
| 5. Combined Libraries. | ||
|
|
||
| You may place library facilities that are a work based on the | ||
| Library side by side in a single library together with other library | ||
| facilities that are not Applications and are not covered by this | ||
| License, and convey such a combined library under terms of your | ||
| choice, if you do both of the following: | ||
|
|
||
| a) Accompany the combined library with a copy of the same work based | ||
| on the Library, uncombined with any other library facilities, | ||
| conveyed under the terms of this License. | ||
|
|
||
| b) Give prominent notice with the combined library that part of it | ||
| is a work based on the Library, and explaining where to find the | ||
| accompanying uncombined form of the same work. | ||
|
|
||
| 6. Revised Versions of the GNU Lesser General Public License. | ||
|
|
||
| The Free Software Foundation may publish revised and/or new versions | ||
| of the GNU Lesser General Public License from time to time. Such new | ||
| versions will be similar in spirit to the present version, but may | ||
| differ in detail to address new problems or concerns. | ||
|
|
||
| Each version is given a distinguishing version number. If the | ||
| Library as you received it specifies that a certain numbered version | ||
| of the GNU Lesser General Public License "or any later version" | ||
| applies to it, you have the option of following the terms and | ||
| conditions either of that published version or of any later version | ||
| published by the Free Software Foundation. If the Library as you | ||
| received it does not specify a version number of the GNU Lesser | ||
| General Public License, you may choose any version of the GNU Lesser | ||
| General Public License ever published by the Free Software Foundation. | ||
|
|
||
| If the Library as you received it specifies that a proxy can decide | ||
| whether future versions of the GNU Lesser General Public License shall | ||
| apply, that proxy's public statement of acceptance of any version is | ||
| permanent authorization for you to choose that version for the | ||
| Library. |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,25 @@ | ||
| # Licensing notice for the drums plugin | ||
|
|
||
| Most of this plugin is original code under the **MIT** license (see `README.md`). That includes | ||
| `screen.js`, `assets/session.js`, `plugin.json`, the other assets and the tests other than | ||
| `tests/engine.test.js`. | ||
|
|
||
| Two files are ports of [YARG.Core](https://github.com/YARC-Official/YARG.Core) and are licensed under the | ||
| **GNU Lesser General Public License v3.0** (full text in [`LICENSE.LGPL-3.0`](LICENSE.LGPL-3.0); the LGPL | ||
| builds on the GNU GPL v3.0, whose text is in [`LICENSE.GPL-3.0`](LICENSE.GPL-3.0)): | ||
|
|
||
| | File | Status | | ||
| |------|--------| | ||
| | `assets/engine.js` | LGPL-3.0. JavaScript port, with modifications, of YARG.Core's drums engine (`Engine/Drums/DrumsEngine.cs`, `Engine/Drums/Engines/YargDrumsEngine.cs`, `DrumsEngineParameters.cs`, `DrumsStats.cs`, `Engine/BaseEngine*.cs`, `BaseStats.cs`, `HitWindowSettings.cs`, `Chart/Notes/DrumNote.cs`, `Note.cs`, drum activation flags from `InstrumentDifficultyExtensions.cs`, and defaults from `Game/Presets/EnginePreset*.cs`). It also takes the drum star thresholds from YARG's `DrumsPlayer.cs` (LGPL-3.0). Copyright (c) YARC (YARG) contributors. | | ||
| | `tests/engine.test.js` | LGPL-3.0. Tests for `engine.js`, partly ported from `YARG.Core.UnitTests/Engine/DrumEngineTester.cs` and `DrumsStatsTests.cs`. | | ||
|
|
||
| `assets/engine.js` is a standalone, unminified script with no dependencies, shipped as its own file and | ||
| loaded at runtime. `screen.js` and `assets/session.js` only use it through its public API | ||
| (`window.DrumsEngine` / `require('./engine.js')`), so they remain separate MIT works that use the Library | ||
| as described in LGPL-3.0 section 4 ("Combined Works"). You may replace `assets/engine.js` with a modified | ||
| version. If you distribute changes to `assets/engine.js`, they must stay under LGPL-3.0 and their source | ||
| must stay available. Combining an LGPL-3.0 file with MIT code this way is permitted by both licenses, and | ||
| both are compatible with feedBack's AGPL-3.0. | ||
|
|
||
| The header of `assets/engine.js` lists every behaviour that deviates from YARG ("Deviations from YARG"). | ||
| The scoring look and feel imitates rhythm-game drum tracks but uses no artwork, fonts or logos from them. | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -16,7 +16,9 @@ A plugin for [Slopsmith](https://github.com/got-feedback/feedback) that replaces | |
| - **MIDI drum pad input** — connect any MIDI drum pad, electronic kit, or controller via Web MIDI API | ||
| - **Custom MIDI mapping** — "Learn" mode to assign any MIDI note to any lane, for non-standard drum pads | ||
| - **Built-in drum sounds** — WebAudioFont-powered GM drum kit playback on MIDI hit | ||
| - **Accuracy scoring** — hit detection with tight +/-50ms timing window, accuracy %, streak counter | ||
| - **Rock Band-style scoring** — score, multiplier, streak, stars and star power from a port of the YARG drums engine (`assets/engine.js`). See [Scoring](#scoring). | ||
| - **Difficulty** — Easy, Medium, Hard, Expert or Expert+ per player (browser), changeable mid-song. See [Difficulty](#difficulty). | ||
| - **Assists** — auto kick, auto cymbals (each up to a chosen difficulty) and hit-timing presets. See [Assists](#assists). | ||
| - **Inline settings** — MIDI device, volume, channel filter, lane labels, hit detection, and mapping table | ||
|
|
||
| ## Drum Lanes | ||
|
|
@@ -32,6 +34,68 @@ A plugin for [Slopsmith](https://github.com/got-feedback/feedback) that replaces | |
| | Ride | Ri | 51, 59 | White | Diamond | | ||
| | Kick | Ki | 35, 36 | Red | Full-width bar | | ||
|
|
||
| ## Scoring | ||
|
|
||
| Turn on **Score** in the settings panel (gear) to see the scoring HUD: multiplier, score, streak, stars | ||
| and the star power meter. Hit notes turn green, missed notes grey, and a pad hit on an empty lane flashes it | ||
| red. | ||
|
|
||
| Scoring is a JavaScript port of YARG.Core's drums engine (`assets/engine.js`, LGPL-3.0 — see | ||
| [License](#license)), used through `assets/session.js`: | ||
|
|
||
| - **Hit window** ±70 ms (see [Assists](#assists) for wider ones); one pad hit hits at most one note. | ||
| - **Multiplier** grows every 10 notes up to x4, doubled during star power (x8). 60 points per note (pro | ||
| drums), plus a dynamics bonus for hitting an accent hard or a ghost note soft (needs a velocity-sensitive | ||
| kit). Pro drums: a cymbal and the tom of the same colour are different notes; with **Pro cymbals** off | ||
| either one hits that colour's notes. | ||
| - **Star power** — notes in a star power phrase are drawn silver-white; hitting every note of a phrase fills | ||
| a quarter of the meter. With half a meter, the chart's **fills** are marked green: the hit that ends the | ||
| fill activates star power. | ||
| - **Bonuses** (shown in the score) — +10 x multiplier for a hit within 25 ms, extra points for snare / tom | ||
| rolls, and a drum-solo bonus (100 per note hit, doubled for a perfect solo) with a live percentage during | ||
| a solo. | ||
| - **Offset** (ms) — subtracted from the time of every hit; raise it if your hits register late (audio or | ||
| MIDI latency). Hits between frames are placed using the playback rate, not quantised to the frame rate. | ||
| - Seeking (or a loop jumping back) restarts scoring from the new position; skipped notes aren't misses. | ||
|
|
||
| The scoring files load on first use from core's plugin assets route (`/api/plugins/drums/assets/`). Until | ||
| they have loaded the view shows the chart as it is. | ||
|
|
||
| ### Difficulty | ||
|
|
||
| Each player picks **Easy**, **Medium**, **Hard**, **Expert** or **Expert+**, stored per browser | ||
| (`localStorage` key `drums_difficulty_v1`, default Expert), so in splitscreen / multiplayer every player | ||
| keeps their own. Change it in the settings panel, by clicking the difficulty badge (top-left of the lanes), | ||
| or with **D** (harder) / **Shift+D** (easier) while the view is focused. | ||
|
|
||
| - **Expert+** is the drum part as charted, double kicks included; **Expert** drops the double-kick notes | ||
| (`x2`). **Easy / Medium / Hard** come from the chart's own easier levels; the badge says **AUTO** when a | ||
| level was reduced by software rather than hand-charted. | ||
| - A level the chart doesn't have is greyed out with the reason; a song without your saved level plays | ||
| Expert (the badge is dimmed) and your choice is kept for the next song. | ||
| - Changing difficulty mid-song rebuilds the chart from the current position, like a seek. | ||
|
|
||
| ### Where star power, fills and levels come from | ||
|
|
||
| They are part of the song's drum tab (`drum_tab.json`, feedpak 1.20.0 "drum gameplay metadata"): per-hit | ||
| `a` (accent) and `x2` (double kick) flags, `star_power` / `fills` / `solos` as `{start_time, end_time}` | ||
| ranges, and `levels.easy|medium|hard` with their own `hits` and a `generated` marker. feedBack's Rock Band / | ||
| Clone Hero / YARG chart importer writes them, and core streams them to the plugin with the tab | ||
| (`bundle.drumTab`). A tab without them — an older tab, a core that doesn't stream them yet, or drums encoded | ||
| as guitar notes — plays **Expert only, without star power**; everything else works the same. | ||
|
Comment on lines
+84
to
+85
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win Document the legacy Expert+ exception. Difficulty selection can offer Expert+ without gameplay metadata when a legacy chart contains GM 35 double-kick notes. The unconditional Expert-only fallback misstates that behavior. (github.com)
📍 Affects 2 files
🤖 Prompt for AI Agents |
||
|
|
||
| ### Assists | ||
|
|
||
| - **Auto kick / Auto cymbals** (`drums_auto_kick_v1`, `drums_auto_cymbals_v1`): `Off`, `Easy only`, | ||
| `Easy – Medium`, `Easy – Hard` or `Every difficulty` — the assist is on at that difficulty and the ones | ||
| below it. Those notes are left out of scoring, marked as played when they reach the now line, and pad hits | ||
| on them are ignored. Cymbals = the chart's hi-hat, ride and crash notes. They are **played on the drum | ||
| sound** (scheduled ~60 ms ahead on the audio clock) so muting the drum stem leaves no holes, at their own | ||
| **Auto vol** (`drums_auto_volume_v1`, default 80%), so pads can stay silent when the kit module makes the | ||
| sound. | ||
| - **Timing** (`drums_timing_v1`): Relaxed ±130 ms, Forgiving ±100 ms, Normal ±70 ms (YARG's default), | ||
| Precision (YARG's dynamic window that tightens on fast notes). | ||
|
|
||
| ## Requirements | ||
|
|
||
| - **Chrome or Edge** for MIDI drum pad input (Firefox does not support Web MIDI) | ||
|
|
@@ -71,6 +135,14 @@ Different drum pads send different MIDI note numbers. Use the "Learn" mode in se | |
|
|
||
| Click "Reset Map" to return to standard GM mapping. | ||
|
|
||
| ## Development | ||
|
|
||
| Tests run with plain Node (the org CI runs each `tests/*.test.js`): `node tests/engine.test.js`, | ||
| `node tests/session.test.js`, `node tests/screen.test.js`. | ||
|
|
||
| ## License | ||
|
|
||
| MIT | ||
| MIT, except `assets/engine.js` and `tests/engine.test.js`: they are ports of | ||
| [YARG.Core](https://github.com/YARC-Official/YARG.Core) and stay under the **LGPL-3.0** | ||
| (`LICENSE.LGPL-3.0`, with the GPL-3.0 it builds on in `LICENSE.GPL-3.0`). The engine is a separate, | ||
| replaceable file that the MIT code only calls through its public API. Details in [NOTICE.md](NOTICE.md). | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win
Include the modified-library licensing option. LGPL v3 section 2(b) permits conveying a modified library under the GNU GPL. Both explanations instead present LGPL-3.0 as the only option. (gnu.org)
NOTICE.md#L20-L20: replace the unconditional “must stay under LGPL-3.0” statement with the permitted options.README.md#L145-L146: qualify “stay under LGPL-3.0” for modified library copies.📍 Affects 2 files
NOTICE.md#L20-L20(this comment)README.md#L145-L146🤖 Prompt for AI Agents