Actually copy in the text

This commit is contained in:
NewSoupVi
2024-07-31 19:34:37 +02:00
parent db5be6a411
commit 295e719ef3

View File

@@ -50,4 +50,19 @@ item_pool += [self.create_filler() for _ in range(total_locations - len(item_poo
The world API document mentions indirect conditions and **when** you should use them, but not *how* they work and *why* they are necessary. This is because the explanation is quite complicated.
It might get its own document in the future, but for now, you can read [this comment written by NewSoupVi](https://github.com/ArchipelagoMW/Archipelago/pull/3128#discussion_r1693843193) (and the other comments in that reply thread if you're still curious to learn more). As of the time of writing, it reflects the most up to date understanding of indirect conditions.
Region sweep (the algorithm that determines with regions are reachable) is a Breadth First Search of the region graph from the Menu region, checking entrances one by one and adding newly reached nodes (regions) and their entrances to the queue until there is nothing more to check.
However, if entrance access conditions depend on regions, then it is possible for this to happen:
1. An entrance that depends on a region is checked and determined to be intraversible because the region hasn't been reached yet during the graph search
2. After that, the region is reached by the graph search. The entrance *would* now be determined as traversible if it were rechecked.
To account for this case, we would have to recheck all entrances every time a new region is reached, until no new regions are reached.
Because most games do not check for region access inside of entrance access conditions, AP has decided to **eschew this rechecking** and just checks every entrance once. This gives a significant performance gain to AP as a whole, about 30%-50%.
However, because some games *did* start using things like `region.can_reach` inside entrance access conditions, we provided a way to **manually** define that a *specific* entrance needs to be rechecked during region sweep if a *specific* region is reached during it. This is what an indirect condition is.
This keeps almost all of the performance upsides. Even a game making heavy use of indirect conditions (See: The Witness) is still way way faster than if it just blanket "rechecked all entrances until nothing new is found".
The reason `location.can_reach` and `entrance.can_reach` are also affected is simple: They call `region.can_reach` on their respective parent/source region.
We recognize it's a pretty bad beginner's trap (heck, not even a "beginner's" trap, just a trap - even for experienced AP devs), and some games are very complex with their access rules.
There is an open Pull Request that makes this behavior optional via a world class attribute: [Core: Region handling customization](https://github.com/ArchipelagoMW/Archipelago/pull/3682)