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

[TLOZ]: Fix determinism / Add Location Name Groups / Remove Level 9 Junk Fill #3670

Merged
merged 8 commits into from
Jul 24, 2024

Conversation

t3hf1gm3nt
Copy link
Collaborator

What is this fixing or adding?

Axing the final uses of world.multiworld.random that were missed before, hopefully fixing the determinism issue brought up in Issue #3664 (at least on TLOZ's end, leaving SMZ3 alone). Also adding location name groups finally, as well as axing the Level 9 Junk Fill because with the new location name groups players can choose to exclude Level 9 with exclude locations instead.

How was this tested?

Couple of test gens of the same seed with two TLOZ yamls. Tried using the yamls provided in #3664 but I believe more would need to be done on SMZ3's end, which I will be leaving to that world's maintainer.

If this makes graphical changes, please attach screenshots.

…unk Fill

Axing the final uses of world.multiworld.random that were missed before, hopefully fixing the determinism issue brought up in Issue ArchipelagoMW#3664 (at least on TLOZ's end, leaving SMZ3 alone). Also adding location name groups finally, as well as axing the Level 9 Junk Fill because with the new location name groups players can choose to exclude Level 9 with exclude locations instead.
@github-actions github-actions bot added the waiting-on: peer-review Issue/PR has not been reviewed by enough people yet. label Jul 19, 2024
@t3hf1gm3nt t3hf1gm3nt added is: bug/fix Issues that are reporting bugs or pull requests that are fixing bugs. is: maintenance Regular updates to requirements and utilities that do not fix bugs or change/add features. is: refactor/cleanup Improvements to code/output readability or organizization. waiting-on: peer-review Issue/PR has not been reviewed by enough people yet. and removed waiting-on: peer-review Issue/PR has not been reviewed by enough people yet. labels Jul 19, 2024
Copy link
Member

@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, merged into main and it generates properly and the new location groups are properly created and populated. Only suggestion I have is potentially adding a Take Any location group

@t3hf1gm3nt
Copy link
Collaborator Author

Only suggestion I have is potentially adding a Take Any location group

Kept debating back and forth on whether I wanted a group for them or not. Figured why not after you mentioned it, and threw in a bonus group for the sword caves.

Copy link
Member

@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.

New groups work just fine as well

Copy link
Contributor

@nicholassaylor nicholassaylor left a comment

Choose a reason for hiding this comment

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

Did not test, but changes look appropriate for what they do. LGTM

@Exempt-Medic Exempt-Medic added waiting-on: core-review Issue/PR has been peer-reviewed and is ready to be merged or needs input from a core maintainer. and removed waiting-on: peer-review Issue/PR has not been reviewed by enough people yet. labels Jul 20, 2024
Comment on lines 91 to 104
location_name_groups = {
"Shops": shop_locations,
"Take Any": take_any_locations,
"Sword Caves": sword_cave_locations,
"Level 1": level_locations[0],
"Level 2": level_locations[1],
"Level 3": level_locations[2],
"Level 4": level_locations[3],
"Level 5": level_locations[4],
"Level 6": level_locations[5],
"Level 7": level_locations[6],
"Level 8": level_locations[7],
"Level 9": level_locations[8],
}
Copy link
Member

Choose a reason for hiding this comment

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

This should be wrong typing since location_name_groups is defined as ClassVar[Dict[str, Set[str]]] = {}. Does pycharm not complain about this?
Should be set(shop_location), set(take_any_locations), etc.

Or do other games do the same thing and should we update the definition in AutoWorld.py? AutoWorld's __new__ already converts it to frozenset() and frozenset(set(list)) is quite a bit slower than frozenset(list)? Maybe @Berserker66 at this point.

Copy link
Member

Choose a reason for hiding this comment

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

FWIW, PyCharm doesn't seem to complain, at least not by default, might be some setting I have to turn on somewhere

Copy link
Member

Choose a reason for hiding this comment

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

mypy says

worlds/tloz/__init__.py:92: error: Dict entry 0 has incompatible type "str": "list[str]"; expected "str": "set[str]"  [dict-item]

and similar

Copy link
Member

Choose a reason for hiding this comment

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

Ah, it requires mypy. Well that explains it then, in which case there are many errors in that file

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I had no knowledge of what mypy even was until this conversation. Should that be a requirement if it's expected for people to follow it?

Regardless, I will update the location name groups to be sets when I get a chance.

Copy link
Member

Choose a reason for hiding this comment

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

Should that be a requirement if it's expected for people to follow it?

Pycharm does a lot of that already, but is a lot less strict and needs to operate faster (ignoring some things), so mypy is not strictly required unless you want to get typing 100% correct.
Using mypy gives you some level of confidence that you did not misuse an API or a special case (such as ignoring the None case for an Optional[Item] ).

The question here is if the type hint in Autoworld is "good" (correct), because all code operating on it would work with a list rather than a set, and providing a list (as you did) would have had better performance.

@Exempt-Medic Exempt-Medic removed the is: maintenance Regular updates to requirements and utilities that do not fix bugs or change/add features. label Jul 23, 2024
@NewSoupVi NewSoupVi merged commit 8756f48 into ArchipelagoMW:main Jul 24, 2024
17 checks passed
@t3hf1gm3nt t3hf1gm3nt deleted the tloz-fix-determinism branch July 24, 2024 12:10
AustinSumigray pushed a commit to AustinSumigray/Archipelago that referenced this pull request Jan 4, 2025
…unk Fill (ArchipelagoMW#3670)

* [TLOZ]: Fix determinism / Add Location Name Groups / Remove Level 9 Junk Fill

Axing the final uses of world.multiworld.random that were missed before, hopefully fixing the determinism issue brought up in Issue ArchipelagoMW#3664 (at least on TLOZ's end, leaving SMZ3 alone). Also adding location name groups finally, as well as axing the Level 9 Junk Fill because with the new location name groups players can choose to exclude Level 9 with exclude locations instead.

* location name groups

* add take any item and sword cave location name groups

* use sets like you're supposed to, silly
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. is: refactor/cleanup Improvements to code/output readability or organizization. waiting-on: core-review Issue/PR has been peer-reviewed and is ready to be merged or needs input from a core maintainer.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants