Skip to content

Fix MW goal hint weight initialization and add regression test#2539

Merged
fenhl merged 1 commit into
OoTRandomizer:Devfrom
Elagatua:feature/multiworld-goal-hint-weights
Mar 16, 2026
Merged

Fix MW goal hint weight initialization and add regression test#2539
fenhl merged 1 commit into
OoTRandomizer:Devfrom
Elagatua:feature/multiworld-goal-hint-weights

Conversation

@Elagatua
Copy link
Copy Markdown

Fixes a multiworld goal-hint weighting bug where goal/category weights were being set on world 0 goal objects during required-location search, leaving worlds > 0 with zeroed weights.

What changed

  • Removed goal/category weight mutation from search_goals.
  • Added world-specific weight initialization in update_goal_items using the world_id from discovered required locations:
    • worlds[world_id].goal_categories[category_name].weight = 1
    • worlds[world_id].goal_categories[category_name].get_goal(goal_name).weight = 1
  • Added a regression unit test:
    • Unittest.TestHints.test_multiworld_goal_weights_initialized_per_world
    • Verifies in multiworld that goals with required locations in worlds > 0 have both category and goal weights initialized to 1.

This preserves existing behavior for single-world while restoring correct per-world weighting for multiworld goal hint selection.

Testing

  • py -3 -m unittest Unittest.TestHints.test_multiworld_goal_weights_initialized_per_world
  • py -3 -m unittest Unittest.TestHints.test_one_hint_per_goal

Move goal/category weight assignment out of search_goals and set weights per actual world_id from required_locations in update_goal_items
Prevent world 0 category objects from incorrectly owning all weight updates in multiworld
Add test_multiworld_goal_weights_initialized_per_world to verify worlds > 0 get goal/category weights set when they have required goal locations
Keep one-hint-per-goal behavior covered with existing tests
@fenhl fenhl linked an issue Mar 16, 2026 that may be closed by this pull request
@fenhl fenhl added Type: Bug Something isn't working Component: Hints related to how we help the player labels Mar 16, 2026
@fenhl fenhl added this to the next milestone Mar 16, 2026
@fenhl fenhl merged commit da00d67 into OoTRandomizer:Dev Mar 16, 2026
6 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: Bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Wrong goal hints generated for worlds other than the first

2 participants