-
Notifications
You must be signed in to change notification settings - Fork 30
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
feat: [closes #383] Random number generator seeding #397
Conversation
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
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.
overall i like this approach! just a few questions/comments for you
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.
Thanks for the helpful review @lstebner! I think we should be set now. It's getting late for me so I'll let this sit and wait to merge and release until tomorrow morning. Feel free to add any comments in the meantime!
What this PR does
This PR implements random number generation seeding. The seed state is stored as a URL query parameter rather than the
farmhand.state
object so that seeded URLs can be shared.This is a feature designed for speedrunners. With a guaranteed sequence of random numbers, Farmhand's behavior can become completely predictable, thus enabling consistent speedrun experiences.
How this change can be validated
In a Private/Incognito browser session, open the preview URL with an embedded seed query param: https://farmhand-git-feature-383rng-seed-jeremyckahn.vercel.app/?seed=test
Observe that the value of Carrot Seed in the Shop is $21.10. Feel free to test other seed values, this is just a baseline.
Then in another Private/Incognito browser session, open the preview URL without an embedded seed query param: https://farmhand-git-feature-383rng-seed-jeremyckahn.vercel.app/
Observe that the value of Carrot Seed in the Shop is a random value for each new Private/Incognito session.
Additional information