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

Core: add panic_method setting #3261

Merged
merged 7 commits into from
May 22, 2024
Merged

Core: add panic_method setting #3261

merged 7 commits into from
May 22, 2024

Conversation

Berserker66
Copy link
Member

What is this fixing or adding?

adds a Setting:

What to do if the current item placements appear unsolvable.
raise -> Raise an exception and abort.
swap -> Attempt to fix it by swapping prior placements around. (Default)
start_inventory -> Move remaining items to start_inventory, generate additional filler items to fill locations.

How was this tested?

https://discord.com/channels/731205301247803413/1214608557077700720/1236015401494773812
verified that swap gives the same result as it currently does, raise gives a fillerror and start_inventory seems to be doing what it is supposed to, by adding 2 items to precollected for this seed.

If this makes graphical changes, please attach screenshots.

@github-actions github-actions bot added affects: core Issues/PRs that touch core and may need additional validation. waiting-on: peer-review Issue/PR has not been reviewed by enough people yet. labels May 3, 2024
@ScipioWright
Copy link
Collaborator

If this PR isn't already doing so, I recommend making it so that tests use the panic mode by default, to rid ourselves of these test failures.

@Berserker66
Copy link
Member Author

They default to swap.

@PoryGone
Copy link
Collaborator

PoryGone commented May 3, 2024

If this PR isn't already doing so, I recommend making it so that tests use the panic mode by default, to rid ourselves of these test failures.

Can we be confident that this PR's solution won't trigger on cases where there is a reasonably solvable world bug causing the failure? Otherwise, changing default test behavior may suppress bugs that it shouldn't.

@ScipioWright
Copy link
Collaborator

Could there be a way for a game that knows they get a random swap failure under default settings to specifically choose to have their tests run with panic mode?

@Exempt-Medic Exempt-Medic added the is: enhancement Issues requesting new features or pull requests implementing new features. label May 3, 2024
@NewSoupVi
Copy link
Collaborator

NewSoupVi commented May 4, 2024

Hmm. How do we feel about "Do safe swap only, then if that fails, throw the item into starting inventory"?

Not even trying swap at all seems a bit overkill for some applications of this that I could think of

@beauxq
Copy link
Collaborator

beauxq commented May 4, 2024

Hmm. How do we feel about "Do safe swap only, then if that fails, throw the item into starting inventory"?

Not even trying swap at all seems a bit overkill for some applications of this that I could think of

This is what I thought.
What about trying to swap first, and if that fails, then go to starting inventory?

@Alchav
Copy link
Contributor

Alchav commented May 4, 2024

Hmm. How do we feel about "Do safe swap only, then if that fails, throw the item into starting inventory"?

Not even trying swap at all seems a bit overkill for some applications of this that I could think of

Some form of this would be good. I have, however, seen it go into a swap loop for a very long time. As in one time I went to sleep while it was swapping and woke up 8 hours later and it was still trying to swap items. Some way of deciding it has taken too long and to just give up would be nice

@Alchav
Copy link
Contributor

Alchav commented May 4, 2024

There are some games with some options that make swapping very likely. Super Metroid / SMMR with no early morph, for example. Any games with an extremely small sphere one where it's easy to fill it with the wrong items.

@Berserker66
Copy link
Member Author

Not entirely sure why this discussion is on this PR, but my 2 cents on the topic is that we should automate early items; in such a way that it builds a state with starting state + already declared early items, identify worlds with let's say <3% of reachable locations, then add some random items to state that fix this problem, then declare those as early items.

Copy link
Member

@ThePhar ThePhar left a comment

Choose a reason for hiding this comment

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

Other than a minor style-preference nitpick, this works as advertised and was instrumental in big async gens.

Any further discussion of enhancements that can be added on top of this can be made in a different discussion/PR, in my opinion. Otherwise, LGTM.

Fill.py Outdated Show resolved Hide resolved
Co-authored-by: Zach Parks <zach@alliware.com>
@Berserker66 Berserker66 merged commit 0ea20f3 into main May 22, 2024
22 of 23 checks passed
@Berserker66 Berserker66 deleted the core_panic_method branch May 22, 2024 12:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
affects: core Issues/PRs that touch core and may need additional validation. is: enhancement Issues requesting new features or pull requests implementing new features. waiting-on: peer-review Issue/PR has not been reviewed by enough people yet.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

9 participants