From 59ac364b4fa8eb84459f905be2ebfb49a366ac34 Mon Sep 17 00:00:00 2001 From: qwint Date: Sun, 11 Aug 2024 16:03:30 -0500 Subject: [PATCH] adds optimization to regen so that it only generates the world you are connecting as (with plans to cache those so it won't gen the same world+slot data more than once) and adds a framework so all worlds that will need to regen can be skipped from the multiworld gen'd at launch note: this will break UT for worlds that still use old options API, but those are soon disappearing so I don't care as much --- worlds/tracker/TrackerClient.py | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/worlds/tracker/TrackerClient.py b/worlds/tracker/TrackerClient.py index fcf6caa96780..3ef086b41b32 100644 --- a/worlds/tracker/TrackerClient.py +++ b/worlds/tracker/TrackerClient.py @@ -427,7 +427,6 @@ def on_package(self, cmd: str, args: dict): self.ui.tabs.show_map = True else: self.tracker_world = None - updateTracker(self) self.watcher_task = asyncio.create_task(game_watcher(self), name="GameWatcher") elif cmd == 'RoomUpdate': @@ -512,6 +511,13 @@ def run_generator(self, slot_data: Optional[Dict] = None): logger.error(tb) def TMain(self, args, seed=None, baked_server_options: Optional[Dict[str, object]] = None): + def set_options(self): + for player in self.player_ids: + world_type = AutoWorld.AutoWorldRegister.world_types[self.game[player]] + self.worlds[player] = world_type(self, player) + options_dataclass: typing.Type[Options.PerGameCommonOptions] = world_type.options_dataclass + self.worlds[player].options = options_dataclass(**{option_key: getattr(args, option_key)[player] + for option_key in options_dataclass.type_hints}) if not baked_server_options: baked_server_options = get_settings().server_options.as_dict() assert isinstance(baked_server_options, dict) @@ -542,7 +548,8 @@ def TMain(self, args, seed=None, baked_server_options: Optional[Dict[str, object multiworld.sprite = args.sprite.copy() multiworld.sprite_pool = args.sprite_pool.copy() - multiworld.set_options(args) + # multiworld.set_options(args) + set_options(multiworld) multiworld.set_item_links() multiworld.state = CollectionState(multiworld) logger.info('Archipelago Version %s - Seed: %s\n', __version__, multiworld.seed)