-
Notifications
You must be signed in to change notification settings - Fork 722
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
Noita: Fix rare item fill failure for single-player games #2387
Conversation
worlds/noita/Items.py
Outdated
# 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) |
There was a problem hiding this comment.
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))
There was a problem hiding this comment.
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,
....
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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.
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. |
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