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

Noita: Fix rare item fill failure for single-player games #2387

Merged
merged 9 commits into from
Oct 29, 2023

Conversation

ScipioWright
Copy link
Collaborator

What is this fixing or adding?

Shops in Noita have some items that are not allowed to be there -- namely, physics items, since you can usually break them.
Makes it so it checks whether enough shop-allowed items are in the itempool already, and makes more if not.

Eventually, this fix will be reverted in favor of making the physics items in the shop not have physics. That will have to wait for the current Noita beta to get pushed live, though.

How was this tested?

Several generations with one and multiple Noita yamls with random settings.

If this makes graphical changes, please attach screenshots.

N/A

@ScipioWright ScipioWright added the is: bug/fix Issues that are reporting bugs or pull requests that are fixing bugs. label Oct 27, 2023
Comment on lines 80 to 89
# if there's not enough shop-allowed items in the pool, we can encounter gen issues
# 39 is the number of shop checks in the pool
shop_random_count = 0
if len(itempool) < 39:
shop_random_count = 39 - len(itempool)
random_count = locations_to_fill - 39
else:
random_count = locations_to_fill - len(itempool)

itempool += create_random_items(multiworld, player, shop_random_count, random_count)
Copy link
Collaborator

Choose a reason for hiding this comment

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

Maybe a little bit more convoluted than it needs to be. We can pass the dict to create_random_items instead of separate count values. Something like

# 39 is the number of shop-valid items we need to guarantee
if len(itempool) < 39:
    itempool += create_random_items(multiworld, player, shop_only_filler_weights, 39 - len(itempool))
itempool += create_random_items(multiworld, player, item_filler_weights, locations_to_fill - len(itempool))

Copy link
Collaborator

Choose a reason for hiding this comment

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

filler_weights below can then be defined as I think something like (assuming the weights will be the same)

filler_weights: Dict[str, int] = {
    **shop_only_filler_weights,
    "Gold (200)": 15,
    ....

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Doing it this way I'm getting constant failures with a minimal items solo yaml. The main issue: I don't think AP is placing the items correctly. I'm loading in exactly 7 perks, 32 hearts, and 7 Gold (200)s. The only way for it to work is if it places the perks + hearts in the 39 shop slots, and the 7 Gold (200)s in the 7 spell refresher spots. It is not doing this most of the time.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Of note, the number of Golds it fails to place is not consistent. Most of the time, it fails to place 2 of them. Sometimes, 3. Sometimes, 1. Rarely, it succeeds.

@ScipioWright
Copy link
Collaborator Author

Alright, changed it so that we're doing a lot of manual fill if we have only one player. It's messy and dumb, but it passes the tests.

@Berserker66 Berserker66 merged commit 36f95b0 into ArchipelagoMW:main Oct 29, 2023
12 checks passed
@ScipioWright ScipioWright deleted the noita-item-fill-fix branch October 30, 2023 02:31
FlySniper pushed a commit to FlySniper/Archipelago that referenced this pull request Nov 14, 2023
Jouramie pushed a commit to Jouramie/Archipelago that referenced this pull request Feb 28, 2024
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.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants