I wrote up a big effortpost about indirect conditions for nex on the [DS3 3.0 PR](https://github.com/ArchipelagoMW/Archipelago/pull/3128#discussion_r1693843193). The version I'm [PRing to the world API document](https://github.com/ArchipelagoMW/Archipelago/pull/3552) is very brief and unnuanced, because I'd rather people use too many indirect conditions than too few. But that might leave some devs wanting to know more. I think that comment on nex's DS3 PR is probably the best detailed explanation for indirect conditions that exists currently. So I think it's good if it exists somewhere. And the FAQ doc seems like the best place right now, because I don't want to write an entirely new doc at the moment.
3.0 KiB
APWorld Dev FAQ
This document is meant as a reference tool to show solutions to common problems when developing an apworld. It is not intended to answer every question about Archipelago and it assumes you have read the other docs, including Contributing, Adding Games, and World API.
My game has a restrictive start that leads to fill errors
Hint to the Generator that an item needs to be in sphere one with local_early_items. Here, 1 represents the number of "Sword" items to attempt to place in sphere one.
early_item_name = "Sword"
self.multiworld.local_early_items[self.player][early_item_name] = 1
Some alternative ways to try to fix this problem are:
- Add more locations to sphere one of your world, potentially only when there would be a restrictive start
- Pre-place items yourself, such as during
create_items - Put items into the player's starting inventory using
push_precollected - Raise an exception, such as an
OptionErrorduringgenerate_early, to disallow options that would lead to a restrictive start
I have multiple settings that change the item/location pool counts and need to balance them out
In an ideal situation your system for producing locations and items wouldn't leave any opportunity for them to be unbalanced. But in real, complex situations, that might be unfeasible.
If that's the case, you can create extra filler based on the difference between your unfilled locations and your itempool by comparing get_unfilled_locations to your list of items to submit
Note: to use self.create_filler(), self.get_filler_item_name() should be defined to only return valid filler item names
total_locations = len(self.multiworld.get_unfilled_locations(self.player))
item_pool = self.create_non_filler_items()
for _ in range(total_locations - len(item_pool)):
item_pool.append(self.create_filler())
self.multiworld.itempool += item_pool
A faster alternative to the for loop would be to use a list comprehension:
item_pool += [self.create_filler() for _ in range(total_locations - len(item_pool))]
I learned about indirect conditions in the world API document, but I want to know more. What are they and why are they necessary?
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 (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.