Skip to content

Allow user to exclude locations#389

Open
tanjo3 wants to merge 22 commits intoLagoLunatic:masterfrom
tanjo3:exclude-locations
Open

Allow user to exclude locations#389
tanjo3 wants to merge 22 commits intoLagoLunatic:masterfrom
tanjo3:exclude-locations

Conversation

@tanjo3
Copy link
Copy Markdown
Contributor

@tanjo3 tanjo3 commented Jun 6, 2024

This PR adds an "Excluded Locations" tab that lets users specify progression locations to be ignored by the randomizer.

The interface here is similar to selecting starting items from randomized items. On the "Excluded Locations" tab, the user can view all the progression locations for the settings selected from the main tab. They can use the buttons to move locations to the "Excluded Locations" side; locations on this side will be considered non-progress locations by the randomizer. Additionally, two filters are added for both progression and excluded locations, allowing the user to quickly find a location in the list. The filters do not affect the final value for either location list.

A few things to note:

  • If you have randomized charts on, all 49 sunken treasure locations will be considered progression locations, since we have yet to determine which chart maps where. If you select sunken treasure locations to be excluded, they will contain non-progress items, and the charts leading to those locations will also be considered non-progress.
  • Building on that, items solely required to unlock excluded locations will be considered non-progress. For example, even if Miscellaneous is on, if the Ankle check is excluded, Tingle statues will be regarded as non-progress. This means they will be in wooden chests for the purposes of chest type matches contents.
  • Excluded locations are considered nonprogress and are not included in hint generation. For example, excluding Ganon's Maze chest means it will never appear as a location hint.
  • If you have dungeons on but exclude too many checks in a dungeon so the randomizer can't place dungeon items, you will get an error.
  • This is not meant to be an interface for selecting which bosses are required for Required Bosses Mode.

I've also added zlib compression, alongside base64 encoding, for permalinks. This is optional. However, since each location adds a bit to the bitstring, it can get rather long. For the default settings and a seed name of A:
Before: MS4xMC4wXzBjMjYyNmQAQQBJEFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAGAAA+wLIJQAAAAAAAQBBAIAA
After: eJwz1DM00DOIN0g2MjMyS2FwZPAUCGAgEkgwMPxmOqEKZjMCtTYwAAA+Dgbz

If any further revisions or clarifications are needed, please let me know.

@tanjo3
Copy link
Copy Markdown
Contributor Author

tanjo3 commented Jun 9, 2024

I've added 10 tests that hopefully cover a sufficient number of setting combos to test this feature.

@tanjo3 tanjo3 marked this pull request as ready for review June 9, 2024 20:15
Comment thread test/test_dry.py Outdated
def enable_all_options(options: Options):
enable_all_progression_location_options(options)
# options.progression_locations
# options.excluded_locations
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Did you mean to leave these comments in?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Yeah, I figured it was in the style of the test function to have all the options there, but the unmodified ones commented out. Like with randomized_gear/starting_gear.

@wooferzfg
Copy link
Copy Markdown
Contributor

I got an error when running the Windows build:

Wind_Waker_Randomizer_4CZGSuPJp1

@LagoLunatic
Copy link
Copy Markdown
Owner

I fixed the pkg error on master, you can revert the workaround in wwrando.spec

tanjo3 and others added 22 commits April 23, 2026 13:23
Also validates `excluded_locations` to ensure it only contains real locations. This change ensures consistency when `Options` is constructed directly (such as in tests).
Running the randomizer with `-noui` or creating `Options` in tests misses `__post_init__`, so move validation to `validate` which gets called by the randomizer itself. Also, dedup excluded locations during validation.
Most UI interactions call `update_settings` which will trigger a deepcopy of the item locations dict. This is an unnecessary cost for the purpose of safety, so add a parameter to `load_and_parse_item_locations` that allows it to skip the  deepcopy. It's the responsibility of the caller to ensure the dict is not mutated. The default is to deepcopy and we only use `deepcopy=False` in 3 places where the dict is confirmed to not be mutated.
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.

3 participants