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

Plando item pool shrinks the base item pool too much #2117

Open
mracsys opened this issue Oct 14, 2023 · 0 comments
Open

Plando item pool shrinks the base item pool too much #2117

mracsys opened this issue Oct 14, 2023 · 0 comments
Labels
Component: Plandomizer Plandomizer library and functionality Type: Bug Something isn't working

Comments

@mracsys
Copy link

mracsys commented Oct 14, 2023

I may not have a complete understanding of this issue. This is as far as I got:

Plandomizer has two item pools to draw from: the base item pool and the item pool specified in the plando.

def alter_pool(self, world: World, pool: list[str]) -> list[str]:
self.base_pool = list(pool)

This saves the base pool created in ItemPool.py based on world settings and enabled locations' vanilla items. It then removes all instances of items defined in the plando item pool (self.item_pool) without considering how many are removed.

predicate = self.pattern_matcher(item_name)
pool_match = [item for item in pool if predicate(item)]
for item in pool_match:
self.base_pool.remove(item)

I believe this is why deleting the item pool from plandos usually lets them work, but keeping the item pool will almost always fail for strict item pools. Junk items should be added to make up the difference when too many items are removed to fill all locations. If the plando specifies less than required major items, that could be handled but should probably be an error message instead as something like one Hookshot in the pool is likely intentional as long as reachable_locations is beatable.

Separately, I think there is overzealous deletion of junk items going on somewhere. With the following call stack starting in Plandomizer.fill:

item = self.get_item(ignore_pools, item_pools, location, player_id, record, worlds)

item = self.pool_replace_item(item_pools, "#Junk", player_id, record.item, worlds)

removed_item = self.pool_remove_item(item_pools, item_group, 1, world_id=player_id)[0]

removed_item = pull_random_element(pools, predicate)

OoT-Randomizer/Plandomizer.py

Lines 1512 to 1514 in 068f85e

candidates = [(element, pool) for pool in pools for element in pool if predicate(element)]
if len(candidates) == 0:
return None

Junk items are being exhausted before all junk items from the plando are placed in the world. Manually inspecting all pools in the debugger at this line shows some shields and "non-junk" junk like Deku Nuts (10), in addition to remaining major items. Since there aren't any junk items left, the randomizer fails to fill the location. The location it fails for me has a red rupee specified in the plando. This applies with and without the item pool specified in the plando.

This is using a plando generated with Randomize Main Rules with the spoiler updated with randomize_settings: false, which may result in an incorrect item pool if the shuffle settings don't match between rando state and the plando (see #2116). This was generated on Dev-Rob 7.1.195 Rob-49 (commit: 4697c68), but should apply to the main repository. The version listed in the attached plando is misleading as I merged some minor changes in a local copy.

OoT_462DD_4YA2P8FGEL-0_Spoiler.txt

@fenhl fenhl added Type: Bug Something isn't working Component: Plandomizer Plandomizer library and functionality labels Oct 14, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Component: Plandomizer Plandomizer library and functionality Type: Bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants