Archipelago icon indicating copy to clipboard operation
Archipelago copied to clipboard

Bug: `create_playthrough` failing when entrance connections have rules

Open toasterparty opened this issue 2 years ago • 3 comments

What happened?

PoryGone and myself have both noticed that our worlds sometimes fail to create_playthrough. My game's case is pretty extreme (about 50% failure rate). The same seed can fail on one attempt and succeed on another because create_playthrough is not deterministic (see #1018).

Example:

Calculating playthrough.
Uncaught exception
Traceback (most recent call last):
  File ".\Generate.py", line 730, in <module>
    main(my_seed=n)
  File ".\Generate.py", line 261, in main
    callback(erargs, seed)
  File "C:\Other\git\Archipelago\Main.py", line 419, in main
    create_playthrough(world)
  File "C:\Other\git\Archipelago\Main.py", line 529, in create_playthrough
    raise RuntimeError(f'Not all required items reachable. Unreachable locations: {required_locations}')
RuntimeError: Not all required items reachable. Unreachable locations: {6-2 (3-Star)}

I have strong reason to believe that this specifically caused by an erroneous culling pass in create_playthrough. If I replace this line with if False:, the problem goes away, even after 100 generations.

Our hunch is that this issue only affects games with shuffled topology which implement using rules on region entrance connections.

Beserker pointed at the indirect_connections dict used by ALttP as a potential problem, but adding my entrances to that dict and messing around with that logic yielded no results.

What were the expected results?

Games which generate should always be solvable by playthrough routine.

Software

Local generation

toasterparty avatar Sep 13 '22 04:09 toasterparty

PoryGone's issue is likely unrelated, upon second viewing.

My issue most likely stems from the fact that my entrance rule uses can_reach on a region which is known to cause issues.

toasterparty avatar Sep 13 '22 05:09 toasterparty

I can confirm that can_reach(region) is broken. Swapping out with an equivalent can_reach(location) call was successful in resolving this issue.

toasterparty avatar Sep 13 '22 18:09 toasterparty

not a perfect solution but in a roundabout way #1056 adds functionality to address this. This issue should likely stay open as I think fixing Entrance.can_reach(Region) is more pleasant but unsure what the beste way to go about fixing that is still.

alwaysintreble avatar Sep 25 '22 19:09 alwaysintreble