Пример #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):

        for proc in psutil.process_iter():
            if proc.name() == "RLBot.exe":
                self.rlbot_gateway_process = proc
                self.logger.info("Already have RLBot.exe running!")
                return

        if self.rlbot_gateway_process is None or not psutil.pid_exists(self.rlbot_gateway_process.pid):
            self.rlbot_gateway_process = gateway_util.launch()
            self.logger.info(f"Python started RLBot.exe with process id {self.rlbot_gateway_process.pid}")
Пример #3
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
Пример #4
0
    def ensure_rlbot_gateway_started(self):

        for proc in psutil.process_iter():
            try:
                if proc.name() == "RLBot.exe":
                    self.rlbot_gateway_process = proc
                    self.logger.info("Already have RLBot.exe running!")
                    return
            except Exception as e:
                self.logger.error(
                    f"Failed to read the name of a process while hunting for RLBot.exe: {e}"
                )

        if self.rlbot_gateway_process is None or not psutil.pid_exists(
                self.rlbot_gateway_process.pid):
            self.rlbot_gateway_process = gateway_util.launch()
            self.logger.info(
                f"Python started RLBot.exe with process id {self.rlbot_gateway_process.pid}"
            )