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

Enable hint distribution to exclude specific goal categories for goal hints #2271

Merged

Conversation

Elagatua
Copy link

This feature was created for the SGL 2024 settings which needed to have Path of the Hero hints disabled.

A excluded_goal_categories key can be defined in the hint distribution file along with an array of goal category names. Any goal category in the array will not be selected when generating goal hints.

@fenhl fenhl added Type: Enhancement New feature or request Status: Needs Review Someone should be looking at it Component: Hints related to how we help the player Status: Under Consideration Developers are considering whether to accept or decline the feature described labels Jul 26, 2024
@fenhl fenhl self-requested a review August 1, 2024 17:25
@fenhl fenhl removed the Status: Under Consideration Developers are considering whether to accept or decline the feature described label Aug 13, 2024
@fenhl
Copy link
Collaborator

fenhl commented Aug 13, 2024

I feel like for consistency with the custom_goals entry, excluded_goal_categories should affect everything that uses goals, not just hints. This could be accomplished by adjusting the World constructor as follows:

         # Initialize default goals for win condition
         self.goal_categories: dict[str, GoalCategory] = OrderedDict()
         if self.hint_dist_user['use_default_goals']:
             self.set_goals()
+            for cat in self.hint_dist_user.get('excluded_goal_categories', []):
+                try:
+                    del self.goal_categories[cat]
+                except KeyError:
+                    pass # don't crash when a hint distro doesn't exist due to selected settings

@Elagatua
Copy link
Author

would adding that behavior eliminate the need for the changes in Hints.py? @fenhl

@fenhl
Copy link
Collaborator

fenhl commented Aug 13, 2024

Yes.

Copy link
Collaborator

@fenhl fenhl left a comment

Choose a reason for hiding this comment

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

Since this implementation is now significantly different from what's being used in SGL, I'm going to require some basic testing: Does it correctly affect both hints and AGR? I'm not sure if I'll have time to test this myself today, so if anyone would like to help get this PR merged, please report your findings.

@fenhl fenhl added Status: Needs Testing Probably should be tested and removed Status: Needs Review Someone should be looking at it labels Aug 14, 2024
@fenhl
Copy link
Collaborator

fenhl commented Aug 14, 2024

We're giving this PR an exemption from the ongoing feature freeze since it's making a hints change from this release cycle configurable.

@fenhl fenhl added this to the next milestone Aug 14, 2024
@Elagatua
Copy link
Author

Agreed that it needs testing.

@fenhl
Copy link
Collaborator

fenhl commented Aug 21, 2024

Tested using ootrstats:

$ ootrstats-supervisor -u Elagatua -b feature/exclude-specific-goal-categories --preset=tournament --json-settings='{"reachable_locations": "goals", "hint_dist_user": {"name": "test", "gui_name": "Test", "description": "Test", "add_locations": [], "remove_locations": [], "add_items": [], "remove_items": [], "dungeons_woth_limit": 40, "dungeons_barren_limit": 40, "named_items_required": true, "vague_named_items": false, "use_default_goals": true, "upgrade_hints": "on", "distribution": {"always": {"order": 1, "weight": 0.0, "fixed": 0, "copies": 1}, "trial": {"order": 2, "weight": 0.0, "fixed": 0, "copies": 1}, "goal": {"order": 3, "weight": 0.0, "fixed": 40, "copies": 1}, "junk": {"order": 4, "weight": 0.0, "fixed": 40, "copies": 1}}, "excluded_goal_categories": ["ganon"]}}' categorize '.gossip_stones[].text | select(contains("on the path of"))'
$ ootrstats-supervisor -u Elagatua -b feature/exclude-specific-goal-categories --preset=tournament --json-settings='{"reachable_locations": "goals", "hint_dist_user": {"name": "test", "gui_name": "Test", "description": "Test", "add_locations": [], "remove_locations": [], "add_items": [], "remove_items": [], "dungeons_woth_limit": 40, "dungeons_barren_limit": 40, "named_items_required": true, "vague_named_items": false, "use_default_goals": true, "upgrade_hints": "on", "distribution": {"always": {"order": 1, "weight": 0.0, "fixed": 0, "copies": 1}, "trial": {"order": 2, "weight": 0.0, "fixed": 0, "copies": 1}, "goal": {"order": 3, "weight": 0.0, "fixed": 40, "copies": 1}, "junk": {"order": 4, "weight": 0.0, "fixed": 40, "copies": 1}}, "excluded_goal_categories": ["ganon"]}}' categorize '.[":goal_locations"].ganon'
8152x: null
$ ootrstats-supervisor --clean -u Elagatua -b feature/exclude-specific-goal-categories --preset=tournament --json-settings='{"reachable_locations": "goals", "hint_dist_user": {"name": "test", "gui_name": "Test", "description": "Test", "add_locations": [], "remove_locations": [], "add_items": [], "remove_items": [], "dungeons_woth_limit": 40, "dungeons_barren_limit": 40, "named_items_required": true, "vague_named_items": false, "use_default_goals": true, "upgrade_hints": "on", "distribution": {"always": {"order": 1, "weight": 0.0, "fixed": 0, "copies": 1}, "trial": {"order": 2, "weight": 0.0, "fixed": 0, "copies": 1}, "goal": {"order": 3, "weight": 0.0, "fixed": 40, "copies": 1}, "junk": {"order": 4, "weight": 0.0, "fixed": 40, "copies": 1}}, "excluded_goal_categories": []}}' categorize '.[":goal_locations"].ganon'
112x: {"Path of the hero":{"GC Maze Left Chest":"Light Arrows"}}
105x: {"Path of the hero":{"Graveyard Shield Grave Chest":"Light Arrows"}}
102x: {"Path of the hero":{"ZD Chest":"Light Arrows"}}
[…]
$ ootrstats-supervisor -u Elagatua -b feature/exclude-specific-goal-categories --preset=tournament --json-settings='{"reachable_locations": "goals", "hint_dist_user": {"name": "test", "gui_name": "Test", "description": "Test", "add_locations": [], "remove_locations": [], "add_items": [], "remove_items": [], "dungeons_woth_limit": 40, "dungeons_barren_limit": 40, "named_items_required": true, "vague_named_items": false, "use_default_goals": true, "upgrade_hints": "on", "distribution": {"always": {"order": 1, "weight": 0.0, "fixed": 0, "copies": 1}, "trial": {"order": 2, "weight": 0.0, "fixed": 0, "copies": 1}, "goal": {"order": 3, "weight": 0.0, "fixed": 40, "copies": 1}, "junk": {"order": 4, "weight": 0.0, "fixed": 40, "copies": 1}}, "excluded_goal_categories": []}}' categorize '.gossip_stones[].text | select(contains("on the path of"))'
607x: "They say that #Kakariko Village# is on the path of #the hero#."
295x: "They say that #the Sacred Forest Meadow# is on the path of #the hero#."
267x: "They say that #the Ice Cavern# is on the path of #the hero#."
[…]

In summary, excluded_goal_categories prevents “on the path of the hero” hints from being generated and the ganon category from showing up in :goal_locations. (Ignore the 8232 failures, I had some workers configured incorrectly.) Only the last 2 commands, where excluded_goal_categories is empty, has the ganon category show up. So this is working as expected. I haven't verified that there are any unreachable bows or magic meters since that would need to be checked manually, but if anyone would like to check that, I can generate and post another batch of spoiler logs.

@fenhl fenhl removed the Status: Needs Testing Probably should be tested label Aug 21, 2024
@fenhl fenhl merged commit 289b0ae into OoTRandomizer:Dev Aug 21, 2024
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Component: Hints related to how we help the player Type: Enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants