Lingo: Various generation optimizations (#2479)

Almost all of the events have been eradicated, which significantly improves both generation speed and playthrough calculation.

Previously, checking for access to a location involved checking for access to each panel in the location, as well as recursively checking for access to any panels required by those panels. This potentially performed the same check multiple times. The access requirements for locations are now calculated and flattened in generate_early, so that the access function can directly check for the required rooms, doors, and colors.

These flattened access requirements are also used for Entrance checking, and register_indirect_condition is used to make sure that can_reach(Region) is safe to use.

The Mastery and Level 2 rules now just run a bunch of access rules and count the number of them that succeed, instead of relying on event items.

Finally: the Level 2 panel hunt is now enabled even when Level 2 is not the victory condition, as I feel that generation is fast enough now for that to be acceptable.
This commit is contained in:
Star Rauchenberger
2023-11-25 07:09:08 -05:00
committed by GitHub
parent 8a852abdc4
commit 6dccf36f88
7 changed files with 330 additions and 169 deletions
+6 -6
View File
@@ -55,14 +55,14 @@ class LingoWorld(World):
create_regions(self, self.player_logic)
def create_items(self):
pool = [self.create_item(name) for name in self.player_logic.REAL_ITEMS]
pool = [self.create_item(name) for name in self.player_logic.real_items]
if self.player_logic.FORCED_GOOD_ITEM != "":
new_item = self.create_item(self.player_logic.FORCED_GOOD_ITEM)
if self.player_logic.forced_good_item != "":
new_item = self.create_item(self.player_logic.forced_good_item)
location_obj = self.multiworld.get_location("Second Room - Good Luck", self.player)
location_obj.place_locked_item(new_item)
item_difference = len(self.player_logic.REAL_LOCATIONS) - len(pool)
item_difference = len(self.player_logic.real_locations) - len(pool)
if item_difference:
trap_percentage = self.options.trap_percentage
traps = int(item_difference * trap_percentage / 100.0)
@@ -93,7 +93,7 @@ class LingoWorld(World):
classification = item.classification
if hasattr(self, "options") and self.options.shuffle_paintings and len(item.painting_ids) > 0\
and len(item.door_ids) == 0 and all(painting_id not in self.player_logic.PAINTING_MAPPING
and len(item.door_ids) == 0 and all(painting_id not in self.player_logic.painting_mapping
for painting_id in item.painting_ids):
# If this is a "door" that just moves one or more paintings, and painting shuffle is on and those paintings
# go nowhere, then this item should not be progression.
@@ -116,6 +116,6 @@ class LingoWorld(World):
}
if self.options.shuffle_paintings:
slot_data["painting_entrance_to_exit"] = self.player_logic.PAINTING_MAPPING
slot_data["painting_entrance_to_exit"] = self.player_logic.painting_mapping
return slot_data