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

Pokemon RB: make stage_post_fill deterministic #4008

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

Mysteryem
Copy link
Contributor

What is this fixing or adding?

stage_post_fill iterates sets of locations, so the iteration order is non-deterministic, resulting in different items being converted from Progression to Useful when generating with the same seed.

I don't think this currently causes any problems because the main use of these locations after stage_post_fill is playthrough calculation, which is non-deterministic to begin with, but maybe there could be problems in the future.

This patch makes stage_post_fill deterministic by sorting the duplicate pokemon locations in each sphere before choosing which of the duplicates should remain as progression.

How was this tested?

I added debug checks for deterministic results to the end of the generator (dumping the locations and items to a file with a unique name per seed and yaml combinations and comparing against the file when it already exists).

Pokemon RB would constantly fail this check beforehand. With this patch, Pokemon RB passes the check every time.

stage_post_fill iterates sets of locations, so the iteration order is
non-deterministic, resulting in different items being converted from
Progression to Useful when generating with the same seed.

This patch makes stage_post_fill deterministic by sorting the duplicate
pokemon locations in each sphere before choosing which of the duplicates
should remain as progression.
@github-actions github-actions bot added the waiting-on: peer-review Issue/PR has not been reviewed by enough people yet. label Sep 28, 2024
@Mysteryem
Copy link
Contributor Author

@Alchav

@Exempt-Medic Exempt-Medic added the is: bug/fix Issues that are reporting bugs or pull requests that are fixing bugs. label Sep 30, 2024
Copy link
Collaborator

@Exempt-Medic Exempt-Medic left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Changes LGTM, tested some generations and compared which items were being made Useful and saw that it was now deterministic (5 trials)

@Exempt-Medic Exempt-Medic added waiting-on: world-maintainer Issue/PR is waiting for feedback or approval by the maintainer of a world. and removed waiting-on: peer-review Issue/PR has not been reviewed by enough people yet. labels Sep 30, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
is: bug/fix Issues that are reporting bugs or pull requests that are fixing bugs. waiting-on: world-maintainer Issue/PR is waiting for feedback or approval by the maintainer of a world.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants