-
Notifications
You must be signed in to change notification settings - Fork 48
Add unstable rate display #101
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
Conversation
Summary of ChangesHello @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
Using Gemini Code AssistThe 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
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 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
|
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.
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.
| 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; | ||
| } |
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.
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;
}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.
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.
|
wow, very good feature! |
* 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]>
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).