UltraStar-Deluxe / USDX

The free and open source karaoke singing game UltraStar Deluxe, inspired by Sony SingStarâ„¢
https://usdx.eu
GNU General Public License v2.0
808 stars 160 forks source link

Do not repeat songs when randomizing #851

Closed DeinAlptraum closed 1 week ago

DeinAlptraum commented 2 months ago

Instead of picking a random song whenever R is pressed, this generates a random permutation of all songs, goes to the next one in that order every time R is pressed, and finally generates a new permutation once all songs have come up once. While in a search, this creates a random queue based on the filtered subset of songs. This queue is reset whenever the search filter is changed.

Depending on what your expectations are, I would say this resolves #186

I have only implemented this for the regular randomization (the "in one category" case) since I have no idea what the category feature does or how I can access it...

dgruss commented 1 month ago

I've merged this into my local compile and had a weird bug: after randomizing a small number of times (< 30, with way more songs in the game) the random function always selected exactly the same song.

DeinAlptraum commented 1 month ago

@dgruss thanks for testing and reporting this! That is indeed very strange, nothing comparable happens to me. Can you tell me

dgruss commented 1 month ago

windows 10, 20000+ songs, folders are deactivated, so it is one long list. i haven't tried it again but will as soon as i get to it

DeinAlptraum commented 4 weeks ago

I believe I fixed this: before, this only randomized the entire song list, and when you pressed R while in a search, it would still try to pick the next index from the entire song list. I changed this to now maintain separate random orders for search and full song list. Whenever you're in a search, a random queue for that specific search is used, and reset whenever the search filter changes. Otherwise the full song list's queue is used, which is never reset until the game is restarted or you went through the entire library.

@dgruss since the symptoms of the bug that I experienced were a bit different from what you described, I would appreciate if you could test this change once more!

dgruss commented 3 weeks ago

the change looks good. can't reproduce the bug anymore

barbeque-squared commented 1 week ago

Works fine in Roulette. Has a weird issue in Chessboard when using search (if there's 1 result, R will always select the last overall song. if there's 2, it will select either the first search result or the last overall song) but that was also the case before this PR, and there's more issues in Chessboard anyway.

Also +1 for not bothering with the categories.