Пример #1
0
    def ensure_rlbot_gateway_started(self) -> int:
        """
        Ensures that RLBot.exe is running. Returns the port that it will be listening on for connections from
        Rocket League. Rocket League should be passed a command line argument so that it starts with this same port.
        :return:
        """

        # TODO: Uncomment this when done with local testing of Remote RLBot.
        self.rlbot_gateway_process, port = gateway_util.find_existing_process()
        if self.rlbot_gateway_process is not None:
            self.logger.info(f"Already have RLBot.exe running! Port is {port}")
            return port

        launch_options = LaunchOptions()
        if self.match_config is not None:  # Currently this is None when launching from RLBotGUI.
            networking_role = NetworkingRole[self.match_config.networking_role]
            launch_options = LaunchOptions(
                networking_role=networking_role,
                remote_address=self.match_config.network_address)

        self.rlbot_gateway_process, port = gateway_util.launch(launch_options)
        self.logger.info(
            f"Python started RLBot.exe with process id {self.rlbot_gateway_process.pid} "
            f"and port {port}")
        return port
Пример #2
0
    def ensure_rlbot_gateway_started(self) -> int:
        """
        Ensures that RLBot.exe is running. Returns the port that it will be listening on for connections from
        Rocket League. Rocket League should be passed a command line argument so that it starts with this same port.
        :return:
        """
        self.rlbot_gateway_process, port = gateway_util.find_existing_process()
        if self.rlbot_gateway_process is not None:
            self.logger.info(f"Already have RLBot.exe running! Port is {port}")
            return port

        self.rlbot_gateway_process, port = gateway_util.launch()
        self.logger.info(f"Python started RLBot.exe with process id {self.rlbot_gateway_process.pid} "
                         f"and port {port}")
        return port
Пример #3
0
def start_match(bot_list, match_settings):
    launcher_preference_map = load_launcher_settings()
    launcher_prefs = launcher_preferences_from_map(launcher_preference_map)

    # Show popup in GUI if rocket league is not started with -rlbot flag
    try:
        testSetupManager = SetupManager()
        temp, port = gateway_util.find_existing_process()
        del temp
        testSetupManager.is_rocket_league_running(port)
    except Exception:
        eel.noRLBotFlagPopup()
        print(
            "Error starting match. This is probably due to Rocket League not being started under the -rlbot flag."
        )
    else:
        eel.spawn(start_match_helper, bot_list, match_settings, launcher_prefs)
Пример #4
0
    def spawn_bot(self):
        config_path = None
        if self.bundle is not None:
            config_path = self.bundle.config_path

        match_config = self.build_match_config(config_path)

        if self.setup_manager is None:
            self.setup_manager = SetupManager()

            rlbot_gateway_process, _ = gateway_util.find_existing_process()
            if rlbot_gateway_process is None:
                # RLBot.exe is not running yet, we should use the Restart behavior.
                # That avoids a situation where dead cars start piling up when
                # RLBot.exe gets killed and re-launched over and over and lacks context
                # to clean up previous cars.
                match_config.existing_match_behavior = 'Restart'

            self.setup_manager.connect_to_game()

        self.setup_manager.load_match_config(match_config)
        self.setup_manager.start_match()
Пример #5
0
def start_match(bot_list, match_settings):
    launcher_preference_map = load_launcher_settings()
    launcher_prefs = launcher_preferences_from_map(launcher_preference_map)

    # Show popup in GUI if rocket league is not started with -rlbot flag
    try:
        testSetupManager = SetupManager()
        temp, port = gateway_util.find_existing_process()
        if port is None:
            # RLBot.exe is not running, but Rocket League might be. That's a situation we can recover from, RLBot.exe
            # will be booted up using the ideal port later, so assume that port.
            port = gateway_util.IDEAL_RLBOT_PORT
        del temp
        # It's fine if rocket league is not running, this would just return false and we'd proceed. What we're checking
        # for is an exception thrown when rocket league IS running but without the necessary flags or a mismatched port.
        testSetupManager.is_rocket_league_running(port)
    except Exception as e:
        eel.noRLBotFlagPopup()
        print(
            f"Error starting match. This is probably due to Rocket League not being started under the -rlbot flag. {e}"
        )
    else:
        eel.spawn(start_match_helper, bot_list, match_settings, launcher_prefs)