Speed up Progression Balancing, mostly by using generators and pre-sorts where the opportunity exists

In some cases multi-thousand element lists were created in-memory with near identical contents, per player, then discarded and reassembled.
Was testing against a case with 3 GB of additional memory use (50 players) which appeared to get stuck, but really was just very slow. This example case is fixed with these changes.
Additionally, progression balancing is now run after ShopSlotFill, so it is now "aware" of the changed progression shops can produce.
As well, special handling for keys was removed, as not all games will have the notion of keys.
This commit is contained in:
Fabian Dill
2021-02-05 08:07:12 +01:00
parent 239b365264
commit 96d544ac84
4 changed files with 34 additions and 32 deletions

View File

@@ -606,9 +606,9 @@ class CollectionState(object):
new_locations = True
while new_locations:
reachable_events = {location for location in locations if location.event and
(not key_only or (not self.world.keyshuffle[
location.item.player] and location.item.smallkey) or (not self.world.bigkeyshuffle[
location.item.player] and location.item.bigkey))
(not key_only or
(not self.world.keyshuffle[location.item.player] and location.item.smallkey)
or (not self.world.bigkeyshuffle[location.item.player] and location.item.bigkey))
and location.can_reach(self)}
new_locations = reachable_events - self.events
for event in new_locations: