示例#1
0
def main():
    install_and_import('rlbot')
    from rlbot.utils import public_utils, logging_utils
    logger = logging_utils.get_logger(DEFAULT_LOGGER)
    if not public_utils.have_internet():
        logger.log(logging_utils.logging_level, 'Skipping upgrade check for now since it looks like you have no internet')
    elif public_utils.is_safe_to_upgrade():
        pipmain(['install', '-r', 'requirements.txt', '--upgrade', '--upgrade-strategy=eager'])

    try:
        import sys
        import os

        path = os.path.dirname(os.path.abspath(__file__))
        sys.path.insert(0, path)  # this is for first process imports

        if len(sys.argv) > 1 and sys.argv[1] == 'gui':
            from rlbot.gui.qt_root import RLBotQTGui
            RLBotQTGui.main()
        else:
            from rlbot import runner
            runner.main()
    except Exception as e:
        print("Encountered exception: ", e)
        print("Press enter to close.")
        input()
示例#2
0
    def __init__(self):
        super(RLBotEnv, self).__init__()
        self.action_space = spaces.Tuple((
            spaces.Box(low=np.array([-1.]),
                       high=np.array([1.]),
                       dtype=np.float),
            # spaces.Box(low=np.array([-1., -1., -1., -1., -1.]), high=np.array([1., 1., 1., 1., 1.]), dtype=np.float),
            # spaces.Discrete(2),
            # spaces.Discrete(2),
            # spaces.Discrete(2)
        ))
        self.manager = runner.main(gym=True)
        self.game_thread = threading.Thread(target=self.manager.infinite_loop)
        self.game_thread.start()

        self.score = 0

        self_location = spaces.Box(low=np.array([-4096., -5120., 0.]),
                                   high=np.array([4096., 5120., 2044.]),
                                   dtype=np.float)
        self_rotation = spaces.Box(low=np.array([-np.pi, -np.pi, -np.pi]),
                                   high=np.array([np.pi, np.pi, np.pi]),
                                   dtype=np.float)
        # self_velocity = spaces.Box(low=np.array([0., 0., 0.]),               high=np.array([2300.,2300.,2300.]),    dtype=np.float)
        # self_angular_velocity = spaces.Box(low=np.array([-1., -1., -1.]), high=np.array([1., 1., 1.]), dtype=np.float)
        # has_wheel_contact = spaces.Discrete(2)
        # jumped = spaces.Discrete(2)
        # boost = spaces.Box(low=np.array([0]), high=np.array([100]), dtype=np.float)
        ball_location = spaces.Box(low=np.array([-4096., -5120., 0.]),
                                   high=np.array([4096., 5120., 2044.]),
                                   dtype=np.float)
        # ball_rotation = spaces.Box(low=np.array([-np.pi, -np.pi, -np.pi]), high=np.array([np.pi, np.pi, np.pi]), dtype=np.float)
        # ball_velocity = spaces.Box(low=np.array([0., 0., 0.]),               high=np.array([2300.,2300.,2300.]),    dtype=np.float)
        # ball_angular_velocity = spaces.Box(low=np.array([-1., -1., -1.]), high=np.array([1., 1., 1.]), dtype=np.float)

        self.observation_space = spaces.Tuple((
            self_location,
            self_rotation,
            # self_velocity,
            # self_angular_velocity,
            # has_wheel_contact,
            # jumped,
            # boost,
            ball_location,
            # ball_rotation,
            # ball_velocity,
            # ball_angular_velocity,
        ))
示例#3
0
        globals()[package] = importlib.import_module(package)


if __name__ == '__main__':
    install_and_import('rlbot')
    from rlbot.utils import public_utils, logging_utils
    logger = logging_utils.get_logger(DEFAULT_LOGGER)
    if not public_utils.have_internet():
        logger.log(
            logging_utils.logging_level,
            'Skipping upgrade check for now since it looks like you have no internet'
        )
    elif public_utils.is_safe_to_upgrade():
        pipmain([
            'install', '-r', 'requirements.txt', '--upgrade',
            '--upgrade-strategy=eager'
        ])

    try:
        import sys
        if len(sys.argv) > 1 and sys.argv[1] == 'gui':
            from rlbot.gui.qt_root import RLBotQTGui
            RLBotQTGui.main()
        else:
            from rlbot import runner
            runner.main()
    except Exception as e:
        print("Encountered exception: ", e)
        print("Press enter to close.")
        input()
示例#4
0
 def Spawn(self):
     runner.main()
示例#5
0
import sys
import os.path
sys.path.insert(
    0,
    os.path.realpath(
        os.path.dirname(os.path.abspath(__file__)) + '/src/main/python/'))

if __name__ == '__main__':

    from rlbot import runner as framework_runner

    framework_runner.main()
示例#6
0
        from rlbot.utils import public_utils, logging_utils

        logger = logging_utils.get_logger(DEFAULT_LOGGER)
        if not public_utils.have_internet():
            logger.log(logging_utils.logging_level,
                       'Skipping upgrade check for now since it looks like you have no internet')
        elif public_utils.is_safe_to_upgrade():
            pipmain(['install', '-r', 'requirements.txt', '--upgrade', '--upgrade-strategy=eager'])

            # https://stackoverflow.com/a/44401013
            rlbots = [module for module in sys.modules if module.startswith('rlbot')]
            for rlbot_module in rlbots:
                sys.modules.pop(rlbot_module)

    except ImportError:
        pipmain(['install', '-r', 'requirements.txt', '--upgrade', '--upgrade-strategy=eager'])

    try:
        if len(sys.argv) > 1 and sys.argv[1] == 'gui':
            from rlbot.gui.qt_root import RLBotQTGui

            RLBotQTGui.main()
        else:
            from rlbot import runner

            runner.main()
    except Exception as e:
        print("Encountered exception: ", e)
        print("Press enter to close.")
        input()