Skip to content

Conversation

@zealain
Copy link
Contributor

@zealain zealain commented Dec 23, 2025

This adds an unstable rate bar during gameplay that is heavily inspired by its equivalent in osu!. It shows for each hit whether the hit was early or late, with colored sections based on Critical (cyan), Perfect (blue), Great (green) and Good (yellow). Left is early, right is late. I attached a short clip to better illustrate it.

ur_short.mp4

It doesn't interact with touch notes or slide completion because those have much more lenient windows and it should be fairly obvious if you miss them anyway. It works for Tap, Hold start and Slide start. There are no special exceptions for Ex and Break notes.

I wasn't sure where exactly to put the new file, let me know if it should be moved. I also didn't provide any Chinese translations because I don't speak it (and don't trust Google Translate to not mess it up).

@gemini-code-assist
Copy link

Summary of Changes

Hello @zealain, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request introduces a new gameplay feature: an unstable rate display. This visual aid, inspired by similar systems in rhythm games, provides players with immediate feedback on the timing accuracy of their inputs. It helps players understand if their hits were early or late and categorizes them by judgment (Critical, Perfect, Great, Good) using distinct colors, enhancing the learning and improvement process during gameplay.

Highlights

  • New Feature: Unstable Rate Display: This pull request introduces a new 'unstable rate' display during gameplay, providing visual feedback on hit timing accuracy, similar to features found in other rhythm games.
  • Visual Feedback: The display shows whether a hit was early or late, with color-coded sections indicating the judgment (Critical, Perfect, Great, Good) for immediate player understanding.
  • Gameplay Integration: The feature integrates seamlessly with the game's existing systems using Harmony patches, specifically targeting GameProcess.OnStart, NoteBase.Judge, and HoldNote.JudgeHoldHead.
  • Scope of Application: The unstable rate display is active for Tap, Hold start, and Slide start notes, but intentionally excludes touch notes and slide completion due to their more lenient timing windows.
  • Configurability: The new display is marked with a ConfigSection attribute, suggesting it can be configured or toggled by the user.
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

Copy link

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request introduces a great new feature for displaying hit accuracy, inspired by osu!'s unstable rate bar. The implementation is well-structured and uses Harmony patches effectively. My review focuses on some critical performance and memory optimizations to ensure the mod runs smoothly without causing stutter or memory leaks during gameplay. I've provided specific suggestions to cache expensive resources like materials and to properly manage the lifecycle of the UI elements.

Comment on lines 103 to 132
private static void SetupBaseline()
{
LineRenderer line;

// Draw lines from the center outwards in both directions
for (float sign = -1; sign <= 1; sign += 2)
{
// Draw each timing window in a different color
foreach (var timing in Timings)
{
line = CreateLine();

line.SetPosition(0, new Vector3(BaselineCenter + sign * BaselineHScale * timing.windowStart, BaselineHeight, 0));
line.SetPosition(1, new Vector3(BaselineCenter + sign * BaselineHScale * timing.windowEnd, BaselineHeight, 0));

line.startColor = timing.color;
line.endColor = timing.color;
}
}

// Center marker
line = CreateLine();

// Setting z-coordinate to -1 to make sure it stays in the foreground
line.SetPosition(0, new Vector3(BaselineCenter, BaselineHeight + CenterMarkerHeight, -1));
line.SetPosition(1, new Vector3(BaselineCenter, BaselineHeight - CenterMarkerHeight, -1));

line.startColor = Color.white;
line.endColor = Color.white;
}

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

high

The SetupBaseline method is called every time a game starts, but it doesn't clean up the GameObjects created in previous runs. This causes a memory leak as old baseline objects accumulate in the scene. To fix this, you should destroy the old objects before creating new ones, using the BaselineGameObjects list to keep track of them.

    private static void SetupBaseline()
    {
        foreach (var obj in BaselineGameObjects)
        {
            Object.Destroy(obj);
        }
        BaselineGameObjects.Clear();

        LineRenderer line;

        // Draw lines from the center outwards in both directions
        for (float sign = -1; sign <= 1; sign += 2)
        {
            // Draw each timing window in a different color
            foreach (var timing in Timings)
            {
                line = CreateLine();
                BaselineGameObjects.Add(line.gameObject);

                line.SetPosition(0, new Vector3(BaselineCenter + sign * BaselineHScale * timing.windowStart, BaselineHeight, 0));
                line.SetPosition(1, new Vector3(BaselineCenter + sign * BaselineHScale * timing.windowEnd, BaselineHeight, 0));

                line.startColor = timing.color;
                line.endColor = timing.color;
            }
        }

        // Center marker
        line = CreateLine();
        BaselineGameObjects.Add(line.gameObject);

        // Setting z-coordinate to -1 to make sure it stays in the foreground
        line.SetPosition(0, new Vector3(BaselineCenter, BaselineHeight + CenterMarkerHeight, -1));
        line.SetPosition(1, new Vector3(BaselineCenter, BaselineHeight - CenterMarkerHeight, -1));

        line.startColor = Color.white;
        line.endColor = Color.white;
    }

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Based on my testing, the objects do not survive once the song is finished because they are children of the GameMonitor, which I think gets destroyed each time. Not 100% sure though, I only tested that the previous lines are no longer drawn in subsequent songs.

@clansty
Copy link
Member

clansty commented Dec 23, 2025

wow, very good feature!

@clansty clansty changed the base branch from main to config-next-2.4 December 24, 2025 04:59
@clansty clansty merged commit fd36609 into MuNET-OSS:config-next-2.4 Dec 24, 2025
1 check passed
clansty added a commit that referenced this pull request Dec 26, 2025
* more disableio4

* [+] 新增舊框燈版 837-15070-02 重低音 LED / 頂板 LED / 中央 LED 的支持 (#100)

* [+] Adding support for 837-15070-02 Woofer LED, Roof LED and Center LED

Co-authored-by: PT_Chen <[email protected]>

* [F] Fixing not consistant module name

* [F] Fixed missing command

* [F] Optimized with reducing reflection fetching

* refactor: Merging into SkipBoardNoCheck

---------

Co-authored-by: PT_Chen <[email protected]>

* [O] rename SkipBoardNoCheck to OldCabLightBoardSupport

* [+] MaimollerIO 按键灯光触摸单独设置

* [O] AdxHidInput.DisableButtons

* [O] Add MaiChartManager EN

* Add unstable rate display (#101)

* Add unstable rate display

* Reuse material

* Fix windows line endings

* move UnstableRate

* [O] UnstableRate 2P support

* [O] 使用对象池优化性能

* [O] Change color

* [+] build script configuration

* [+] 增加同时开启的 DisplayTouchInGame

* [O] 力大砖飞 -> ResourcesOverride

* [O] configSort

* [O] convert check to non-AI script

* [O] configSort

* [F] bugs

* [F] minor

* revert

---------

Co-authored-by: Kevin S.H. Chang <[email protected]>
Co-authored-by: PT_Chen <[email protected]>
Co-authored-by: zealain <[email protected]>
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