Beispiel #1
0
def launch(launch_options: LaunchOptions = None):
    port = DEFAULT_RLBOT_PORT
    try:
        desired_port = find_usable_port()
        port = desired_port
    except Exception as e:
        print(str(e))

    path = os.path.join(get_dll_directory(), executable_name)
    if not os.access(path, os.F_OK):
        raise FileNotFoundError(
            f'Unable to find RLBot binary at {path}! Is your antivirus messing you up? Check '
            'https://github.com/RLBot/RLBot/wiki/Antivirus-Notes.')
    if not os.access(path, os.X_OK):
        os.chmod(path, stat.S_IXUSR | stat.S_IXGRP | stat.S_IXOTH)
    if not os.access(path, os.X_OK):
        raise PermissionError(
            'Unable to execute RLBot binary due to file permissions! Is your antivirus messing you up? '
            f'Check https://github.com/RLBot/RLBot/wiki/Antivirus-Notes. The exact path is {path}'
        )

    args = [path, str(port)]
    if launch_options is not None:
        args.append(launch_options.remote_address)
        args.append(str(int(launch_options.networking_role)))
    print(f"Launching RLBot binary with args {args}")
    if platform.system() != 'Windows':
        # Unix only works this way, not sure why. Windows works better with the array, guards against spaces in path.
        args = ' '.join(args)
    return subprocess.Popen(args, shell=True, cwd=get_dll_directory()), port
Beispiel #2
0
    def start(self):
        """Starts the BotHelperProcess - Hivemind."""
        # Prints an activation message into the console.
        # This lets you know that the process is up and running.
        self.logger.debug("Hello, world!")

        # Collect drone indices that requested a helper process with our key.
        self.logger.info("Collecting drones; give me a moment.")
        self.try_receive_agent_metadata()
        self.logger.info("Starting subprocess!")

        if not os.path.isfile(self.exec_path):
            raise FileNotFoundError(f"Could not find file: {self.exec_path}")

        # Starts the process.
        # The drone indices are all the numbers after --drone-indices.
        # example.exe --rlbot-version 1.35.5 --rlbot-dll-directory some/directory/dll/ --drone-indices 0,1,2,3,4,5
        process = Popen([
            self.exec_path, '--rlbot-version', rlbot.__version__,
            '--rlbot-dll-directory',
            get_dll_directory(), '--drone-indices',
            ','.join([str(index) for index in self.drone_indices])
        ])

        # Wait until we get a quit_event, and then terminate the process.
        self.quit_event.wait()
        process.send_signal(SIGTERM)
        process.wait()
 def get_helper_process_request(self):
     if self.is_executable_configured():
         return HelperProcessRequest(
             python_file_path=None,
             key=__file__ + str(self.port),
             executable=self.cpp_executable_path,
             exe_args=["-dll-path",
                       game_interface.get_dll_directory()])
     return None
Beispiel #4
0
    def run_independently(self, terminate_request_event):

        while not terminate_request_event.is_set():
            message = "add {0} {1} {2} {3}".format(self.name, self.team, self.index, game_interface.get_dll_directory())

            try:
                s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
                s.connect(("127.0.0.1", self.port))
                s.send(bytes(message, "ASCII"))
                s.close()
            except ConnectionRefusedError:
                self.logger.warn("Could not connect to server!")

            time.sleep(1)
        else:
            self.retire()
    def run_independently(self, terminate_request_event: Event) -> None:
        # This argument sequence is consumed by Rust's `rlbot::run`.
        process = Popen([
            self.path,
            '--rlbot-version',
            rlbot.__version__,
            '--rlbot-dll-directory',
            get_dll_directory(),
            '--player-index',
            str(self.index),
        ])

        # Block until we are asked to terminate, and then do so.
        terminate_request_event.wait()
        process.send_signal(SIGTERM)
        process.wait()
Beispiel #6
0
    def run_independently(self, terminate_request_event: Event) -> None:
        process = Popen([
            self.path,
            '-index',
            str(self.index),
            '-team',
            str(self.index),
            '-name',
            self.name,
            '-dll-path',
            get_dll_directory(),
        ])

        # Block until we are asked to terminate, and then do so.
        terminate_request_event.wait()
        process.send_signal(SIGTERM)
        process.wait()
Beispiel #7
0
def launch():
    port = DEFAULT_RLBOT_PORT
    try:
        desired_port = find_usable_port()
        port = desired_port
    except Exception as e:
        print(str(e))

    print("Launching RLBot.exe...")
    path = os.path.join(get_dll_directory(), executable_name)
    if os.access(path, os.X_OK):
        return subprocess.Popen([path, str(port)], shell=True), port
    if os.access(path, os.F_OK):
        raise PermissionError(
            'Unable to execute RLBot.exe due to file permissions! Is your antivirus messing you up? '
            f'Check https://github.com/RLBot/RLBot/wiki/Antivirus-Notes. The exact path is {path}'
        )
    raise FileNotFoundError(
        f'Unable to find RLBot.exe at {path}! Is your antivirus messing you up? Check '
        'https://github.com/RLBot/RLBot/wiki/Antivirus-Notes.')
Beispiel #8
0
def launch():
    port = DEFAULT_RLBOT_PORT
    try:
        rlbot_ini = find_rlbot_ini()
        if rlbot_ini is not None:
            desired_port = find_usable_port()
            # TODO: instead of manipulating the ini, start Rocket League with special args once they become available.
            write_port_to_ini(desired_port, rlbot_ini)
            port = desired_port
    except Exception as e:
        print(str(e))

    print("Launching RLBot.exe...")
    path = os.path.join(get_dll_directory(), "RLBot.exe")
    if os.access(path, os.X_OK):
        return subprocess.Popen([path, str(port)])
    if os.access(path, os.F_OK):
        raise PermissionError(
            'Unable to execute RLBot.exe due to file permissions! Is your antivirus messing you up? '
            f'Check https://github.com/RLBot/RLBot/wiki/Antivirus-Notes. The exact path is {path}'
        )
    raise FileNotFoundError(
        f'Unable to find RLBot.exe at {path}! Is your antivirus messing you up? Check '
        'https://github.com/RLBot/RLBot/wiki/Antivirus-Notes.')
 def run_independently(self, terminate_request_event: Event) -> None:
     print("Bot (index: %d, team: %d, name: %s) started in dev mode." %
           (self.index, self.team, self.name))
     print("RLBot dll directory: " + get_dll_directory())
Beispiel #10
0
def launch():
    return subprocess.Popen([os.path.join(get_dll_directory(), "BallPrediction.exe")],
                            stdout=subprocess.PIPE, stderr=subprocess.PIPE)
Beispiel #11
0
import os
from shutil import copy 

from rlbot.utils.structures.game_interface import get_dll_directory

dest = os.path.dirname(os.path.abspath(__file__))

copy(get_dll_directory() + "/RLBot_Core_Interface.dll", dest)
copy(get_dll_directory() + "/RLBot_Core_Interface_32.dll", dest)