ppy / osu

rhythm is just a *click* away!
https://osu.ppy.sh
MIT License
15.13k stars 2.25k forks source link

Use room watching functionality to receive realtime daily challenge updates #28659

Closed bdach closed 2 months ago

bdach commented 3 months ago

https://github.com/ppy/osu/assets/20418176/0e36a8a1-4e58-4422-b47a-59efead60ed8

Also contains some drive-by fixes to issues I didn't spot before (music not playing, crash in breakdown on all initial zero counts, etc.)

Known deficiencies:

commit 535c8583f212bb750f043c11facc009107995ea7
Author: Bartłomiej Dach <dach.bartlomiej@gmail.com>
Date:   Thu Jun 6 11:06:22 2024 +0200

    leaderboard refetch (sponsored by "it's stupid but it works")

diff --git a/osu.Game/Screens/OnlinePlay/DailyChallenge/DailyChallenge.cs b/osu.Game/Screens/OnlinePlay/DailyChallenge/DailyChallenge.cs
index 933ab95ff5..65531aa174 100644
--- a/osu.Game/Screens/OnlinePlay/DailyChallenge/DailyChallenge.cs
+++ b/osu.Game/Screens/OnlinePlay/DailyChallenge/DailyChallenge.cs
@@ -345,6 +345,10 @@ private void onRoomScoreSet(MultiplayerRoomScoreSetEvent e)
                 {
                     breakdown.AddNewScore(ev);
                     feed.AddNewScore(ev);
+
+                    // TODO: this may not be the best idea.
+                    if (e.NewRank <= 50)
+                        Schedule(() => leaderboard.RefetchScores());
                 });
             });
         }

but (a) it probably needs a stagger lest we DDoS osu-web by doing this the naive way as above, and (b) I kinda do want to see if I can figure out a way to do this better in general because the leaderboard is by far the worst part of this screen (visually even) after these changes, so maybe I'll give it some time next week to see if I can steal a leaderboard design from somewhere else that could perhaps also enable dynamic updates without refetching the entire leaderboard.

If wanting to test locally, you must have osu-web, osu-server-spectator, and osu-queue-score-statistics (on queue watch) running in tandem.