Skip to content
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

Make RandomLevelsCategory use seed from game #323

Merged
merged 1 commit into from
Jan 2, 2024

Conversation

jvyden
Copy link
Member

@jvyden jvyden commented Jan 2, 2024

Closes #122

Why

Previously, we were using a globally shared instance of Random when calculating the random order of levels. This caused levels to appear multiple times in the list and caused others to get potentially missed entirely.

By using a consistent seed we can negate both of those problems and ensure the full list gets hit consistently.

How

To fix, introduce the client's seed parameter as an available parameter to use in the filter settings. We can then use this to create a new Random object on each call of GetRandomLevel() with the new seed.

Remarks

This will require a change in refresh-web to make the website generate a random seed, since if we do not find a seed value server-side we simply use 0.

@jvyden jvyden requested a review from Beyley January 2, 2024 22:03
@jvyden jvyden merged commit 86ae4a2 into LittleBigRefresh:main Jan 2, 2024
2 checks passed
@jvyden jvyden deleted the fix-luckydip-determinism branch January 2, 2024 22:06
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.

The same level can appear multiple times in lucky dip
2 participants