Esempio n. 1
0
def make_default_playlist() -> Playlist:

    # Choose which spawns you want to test.
    exercises = [
        #KickoffExercise('Both Corners', blue_spawns=[Spawns.CORNER_R, Spawns.CORNER_L], orange_spawns = []),
        #KickoffExercise('Right Corner 50/50', blue_spawns=[Spawns.CORNER_R], orange_spawns = [Spawns.CORNER_R]),
        KickoffExercise('Right Corner',
                        blue_spawns=[Spawns.CORNER_R],
                        orange_spawns=[]),
        KickoffExercise('Left Corner',
                        blue_spawns=[Spawns.CORNER_L],
                        orange_spawns=[]),
        KickoffExercise('Back Right',
                        blue_spawns=[Spawns.BACK_R],
                        orange_spawns=[]),
        KickoffExercise('Back Left',
                        blue_spawns=[Spawns.BACK_L],
                        orange_spawns=[]),
        KickoffExercise('Straight',
                        blue_spawns=[Spawns.STRAIGHT],
                        orange_spawns=[]),
    ]

    for ex in exercises:
        # The number of players in the match_config needs to match the number of spawns.

        # Replace with path to your bot.
        ex.match_config.player_configs = \
        [PlayerConfig.bot_config(BotConfigs.simple_bot, Team.BLUE) for _ in ex.blue_spawns] + \
        [PlayerConfig.bot_config(BotConfigs.simple_bot, Team.ORANGE) for _ in ex.orange_spawns]

    return exercises
Esempio n. 2
0
def versus_line_goalie_match_config(attacker: Path, goalie: Path = BotConfigs.line_goalie) -> MatchConfig:
    match_config = make_empty_match_config()
    match_config.player_configs = [
        PlayerConfig.bot_config(attacker, Team.ORANGE),
        PlayerConfig.bot_config(goalie, Team.BLUE),
    ]
    return match_config
Esempio n. 3
0
def make_default_playlist() -> Playlist:
    # Choose which spawns you want to test.
    exercises = [
        KickoffExercise('Right Corner',
                        blue_spawns=[Spawns.CORNER_R],
                        orange_spawns=[Spawns.CORNER_R]),
        KickoffExercise('Left Corner',
                        blue_spawns=[Spawns.CORNER_L],
                        orange_spawns=[Spawns.CORNER_L]),
        KickoffExercise('Back Right',
                        blue_spawns=[Spawns.BACK_R],
                        orange_spawns=[Spawns.BACK_R]),
        KickoffExercise('Back Left',
                        blue_spawns=[Spawns.BACK_L],
                        orange_spawns=[Spawns.BACK_L]),
        KickoffExercise('Straight',
                        blue_spawns=[Spawns.STRAIGHT],
                        orange_spawns=[Spawns.STRAIGHT]),
    ]

    for ex in exercises:
        # The length of players in the match_config needs to match the number or spawns.

        # Replace with path to your bot or bots.
        ex.match_config.player_configs = \
            [PlayerConfig.bot_config(Path(Path(__file__).absolute().parent.parent.parent / 'Derevo.cfg'), Team.BLUE) for
             _ in ex.blue_spawns] + \
            [PlayerConfig.bot_config(Path(Path(__file__).absolute().parent.parent.parent / 'Derevo.cfg'), Team.ORANGE)
             for _ in ex.orange_spawns]

    return exercises
Esempio n. 4
0
def make_default_playlist():
    # Add the exercises
    exercises = get_exercises()

    # Configure Wildfire and friends (or foes!)
    for exercise in exercises:
        exercise.match_config.player_configs = [
            PlayerConfig.bot_config(Path(wildfire_test_path), Team.BLUE),
            PlayerConfig.bot_config(Path(opponent_path), Team.ORANGE)
        ]

    return exercises
Esempio n. 5
0
def make_default_playlist():
    exercises = [
        KickoffExercise('Straight',
                        blue_spawns=[Spawns.STRAIGHT],
                        orange_spawns=[]),
        KickoffExercise('Right Corner',
                        blue_spawns=[Spawns.CORNER_R],
                        orange_spawns=[]),
        KickoffExercise('Left Corner',
                        blue_spawns=[Spawns.CORNER_L],
                        orange_spawns=[]),
        KickoffExercise('Back Right',
                        blue_spawns=[Spawns.BACK_R],
                        orange_spawns=[]),
        KickoffExercise('Back Left',
                        blue_spawns=[Spawns.BACK_L],
                        orange_spawns=[])
    ]

    for exercise in exercises:
        exercise.match_config.player_configs = [
            PlayerConfig.bot_config(
                Path(__file__).absolute().parent.parent / 'src' / 'bot.cfg',
                Team.BLUE)
        ]

    return exercises
Esempio n. 6
0
def make_match_config_with_bots(blue_bots: List[Path] = None,
                                orange_bots: List[Path] = None) -> MatchConfig:
    """
    Returns a match config containing the provided bots playing soccar.
    The bot index order will be blue_bots then orange_bots.
    Has some mutators which are usually useful for bot training.
    """
    if blue_bots is None: blue_bots = []
    if orange_bots is None: orange_bots = []
    blue_players = [
        PlayerConfig.bot_config(bot_path, Team.BLUE) for bot_path in blue_bots
    ]
    orange_players = [
        PlayerConfig.bot_config(bot_path, Team.ORANGE)
        for bot_path in orange_bots
    ]
    return make_match_config_with_players(blue_players + orange_players)
Esempio n. 7
0
 def bot_to_config(self, bot: BotID, bots: Mapping[BotID, BotConfigBundle],
                   team: Team) -> PlayerConfig:
     config = PlayerConfig.bot_config(Path(bots[bot].config_path), team)
     # Resolve Psyonix bots -- only Psyonix bots are in this list
     if bot in psyonix_bot_skill:
         config.rlbot_controlled = False
         config.bot_skill = psyonix_bot_skill[bot]
     return config
Esempio n. 8
0
def make_match_config_with_my_bot() -> MatchConfig:
    # Makes a config which only has our bot in it for now.
    # For more defails: https://youtu.be/uGFmOZCpel8?t=375
    match_config = make_empty_match_config()
    match_config.player_configs = [
        PlayerConfig.bot_config(
            Path(__file__).absolute().parent.parent / 'bean.cfg', Team.BLUE),
    ]
    return match_config
Esempio n. 9
0
def make_default_playlist() -> Playlist:
    exercises = [DribbleDrop('Dribble Drop'), DribbleRoll('Dribble Roll')]

    for ex in exercises:
        ex.match_config.player_configs = [
            PlayerConfig.bot_config(Path(__file__).absolute().parent.parent.parent / 'Derevo.cfg', Team.BLUE)
        ]

    return exercises
Esempio n. 10
0
def make_bot_config(config_bundle: BotConfigBundle,
                    team: Team) -> PlayerConfig:
    # Our main concern here is Psyonix bots
    player_config = PlayerConfig.bot_config(Path(config_bundle.config_path),
                                            team)
    player_config.rlbot_controlled = player_config.name not in psyonix_bots.keys(
    )
    player_config.bot_skill = psyonix_bots.get(player_config.name, 1.0)
    return player_config
Esempio n. 11
0
def make_default_playlist():
    exercises = [BallRollingToGoalie("first training exercise")]
    for e in exercises:
        e.match_config.player_configs = [
            PlayerConfig.bot_config(
                Path(__file__).absolute().parent.parent / 'babySteps.cfg',
                Team.BLUE)
        ]
    return exercises
Esempio n. 12
0
def make_playlist(bot_info, team):
    playlist = []
    for bot_name, path in bot_info:
        ex: SimpleExercise = SimpleExercise(bot_name, team=team)
        t = Team.BLUE if team == 1 else Team.ORANGE
        ex.match_config.player_configs = [
            PlayerConfig.bot_config(Path(path), t)
        ]
        playlist.append(ex)
    return playlist
Esempio n. 13
0
def make_default_playlist() -> Playlist:
    team = Team.BLUE
    ex: SimpleExercise = SimpleExercise("Simple",
                                        team=1 if team == Team.BLUE else -1)
    ex.match_config.player_configs = [
        PlayerConfig.bot_config(
            Path(__file__).absolute().parent / "simple_bot" / 'SimpleBot.cfg',
            team)
    ]
    return [ex]
Esempio n. 14
0
def make_match_config(working_dir: WorkingDir,
                      bot_id_pair: Tuple[BotID, BotID]) -> MatchConfig:
    match_config = read_match_config_from_file(
        PackageFiles.default_match_config)
    match_config.game_map = random.choice([
        'ChampionsField',
        'Farmstead',
        'StarbaseArc',
        'DFHStadium',
        'SaltyShores',
        'Wasteland',
    ])
    if random.random() < .5:
        bot_id_pair = bot_id_pair[::-1]  # mix up the colors a bit.
    match_config.player_configs = [
        PlayerConfig.bot_config(working_dir.bots / bot_id_pair[0], Team.BLUE),
        PlayerConfig.bot_config(working_dir.bots / bot_id_pair[1],
                                Team.ORANGE),
    ]
    return match_config
Esempio n. 15
0
def make_default_playlist():
    exercises = [HookShot('Trash Training')]

    for exercise in exercises:
        exercise.match_config.player_configs = [
            PlayerConfig.bot_config(
                Path(__file__).absolute().parent.parent / 'Trashbag' / 'Trashbag.cfg', 
                Team.BLUE
            )
        ]
    return exercises
Esempio n. 16
0
def make_default_playlist():
    exercises = [get_shot()]

    for exercise in exercises:
        exercise.match_config.player_configs = [
            PlayerConfig.bot_config(
                Path(__file__).absolute().parent.parent / 'YangBot' / 'src' /
                'main' / 'python' / 'yangbot.cfg', Team.BLUE)
        ]

    return exercises
Esempio n. 17
0
def make_default_playlist():
    exercises = import_exercises(_example_rl_custom_training_json)
    exercises.pop(14)  # 14 doesnt end properly
    exercises.pop(23)  # 24 doesnt end properly
    exercises.pop(24)  # 26 doesnt end properly
    for exercise in exercises:
        exercise.match_config.player_configs = [
            PlayerConfig.bot_config(
                Path(__file__).absolute().parent / 'Trashbag' / 'Trashbag.cfg',
                Team.BLUE)
        ]
    return exercises
def make_match_config_with_my_bot(name) -> MatchConfig:
    # Makes a config which only has our bot in it for now.
    # For more defails: https://youtu.be/uGFmOZCpel8?t=375
    match_config = make_empty_match_config()
    match_config.player_configs = [
        PlayerConfig.bot_config(
            Path(__file__).absolute().parent.parent / 'rashBot' / 'rashBot.cfg', #            Path(__file__).absolute().parent.parent / 'stick' / 'stick.cfg',
            Team.BLUE
        )
    ]
    match_config.player_configs[0].name = name
    return match_config
Esempio n. 19
0
def make_default_playlist():
    exercises = [
        BallRollingTowardsWall('Test Training!'),
    ]
    for exercise in exercises:
        exercise.match_config.player_configs = [
            PlayerConfig.bot_config(
                Path(__file__).absolute().parent / 'BroccoliBot.cfg',
                Team.BLUE)
        ]

    return exercises
Esempio n. 20
0
 def test_dribbling(self):
     exercise = Dribbling('Dribbling')
     exercise.match_config.player_configs = [
         PlayerConfig.bot_config(
             Path(__file__).absolute().parent.parent.parent / 'Derevo.cfg',
             Team.BLUE)
     ]
     result_iter = run_playlist([exercise])
     results = list(result_iter)
     result = results[0]
     self.assertEqual(len(results), 1)
     self.assertEqual(result.exercise.name, 'Dribbling')
     self.assertIsInstance(result.grade, Pass)
Esempio n. 21
0
def make_default_playlist():
    exercises = (
        OpenNet("Easy open net"),
        SideShot("Harder side shot"),
        WallShot("Wall Shot!"),
        ToughAngle("Difficult angle"),
    )
    for exercise in exercises:
        exercise.match_config.player_configs = [
            PlayerConfig.bot_config(
                Path(__file__).absolute().parent.parent / 'src' / 'bot.cfg',
                Team.BLUE),
        ]

    return exercises
Esempio n. 22
0
def make_default_playlist() -> Playlist:
    # Choose which spawns you want to test.
    exercises = [
        # RollingTowardsGoalShot('Rolling Shot'),
        # HookShot('Hookshot'),
        FacingAwayFromBallInFrontOfGoal('Facing away from opponents goal', car_start_x=200., car_start_y=5100),
    ]

    for ex in exercises:
        # The length of players in the match_config needs to match the number or spawns.

        # Replace with path to your bot or bots.
        ex.match_config.player_configs = [
            PlayerConfig.bot_config(Path(__file__).absolute().parent.parent.parent / 'Derevo.cfg', Team.BLUE)]

    return exercises
Esempio n. 23
0
def make_default_playlist():
    exercises = ([
        SpawnLocationExercise(name="SpawnLocationExercise"),
        SpawnLocationExercise(name="SpawnLocationExercise"),
        SpawnLocationExercise(name="SpawnLocationExercise"),
        # SpawnLocationExercise(name="SpawnLocationExercise"),
        # SpawnLocationExercise(name="SpawnLocationExercise"),
    ])
    for exercise in exercises:
        match_config = make_empty_match_config()
        match_config.player_configs = [
            # RocketLeague doesn't like being started without any players.
            PlayerConfig.bot_config(BotConfigs.brick_bot, Team.BLUE),
        ]
        match_config.mutators.respawn_time = '3 Seconds'
        match_config.instant_start = False
        exercise.match_config = match_config

    return exercises
Esempio n. 24
0
    def test_defend_ball_rolling_towards_goal(self):
        exercises = [
            DefendBallRollingTowardsGoal('DefendBallRollingTowardsGoal'),
            LineSave('LineSave'),
            TryNotToOwnGoal('TryNotToOwnGoal'),
        ]

        for ex in exercises:
            # The length of players in the match_config needs to match the number or spawns.

            # Replace with path to your bot or bots.
            ex.match_config.player_configs = [
                PlayerConfig.bot_config(
                    Path(__file__).absolute().parent.parent.parent /
                    'Derevo.cfg', Team.BLUE)
            ]
        result_iter = run_playlist(exercises)
        results = list(result_iter)
        self.assertEqual(len(results), 3)
        for result in results:
            self.assertIsInstance(result.grade, Pass)
Esempio n. 25
0
def start_training_helper(playlist_path, bot, seed=None):
    global in_training
    if in_training:
        return
    in_training = True
    playlist = import_pack(playlist_path)
    for el in playlist:
        if isinstance(el, JSONExercise):
            el.set_bot(bot["path"])
        else:
            el.match_config.player_configs = [
                PlayerConfig.bot_config(Path(bot["path"]), Team.BLUE),
            ]
    for result in run_playlist(playlist, seed=seed or random.randint(1, 1000)):
        try:
            print_result(result)
        except Exception:
            print("An error occurred trying to run training exercise:")
            traceback.print_exc()
        time.sleep(1)  # Allow bot to finish its action so it doesnt f**k up
    in_training = False
Esempio n. 26
0
class RollFromGround(RocketLeagueCustomStrikerTraining):
    """Ball starts only with angular velocity"""

    grader: Grader = RocketLeagueStrikerGrader(timeout_seconds=2,
                                               timeout_override=True,
                                               ground_override=True)
    test_match_config.player_configs = [
        PlayerConfig.bot_config(BotConfigs.prop_bot, Team.BLUE),
    ]
    test_match_config.game_map = "ThrowbackStadium"
    match_config: MatchConfig = test_match_config

    def make_game_state(self, rng: SeededRandomNumberGenerator) -> GameState:
        car_pos = Vector3(5600, 0, 0)
        ball_pos = Vector3(rng.randrange(-800, 800),
                           rng.randrange(-5000, 5000), 93)
        ball_vel = Vector3(rng.randrange(-2000, 2000),
                           rng.randrange(-2000, 2000), 0)
        ball_ang_vel = Vector3(0, 0, 0)

        ball_state = BallState(
            Physics(location=ball_pos,
                    velocity=ball_vel,
                    angular_velocity=ball_ang_vel))
        car_state = CarState(boost_amount=100,
                             jumped=False,
                             double_jumped=False,
                             physics=Physics(location=car_pos,
                                             rotation=Rotator(0, 0, 0),
                                             velocity=Vector3(0, 0, 0),
                                             angular_velocity=Vector3(0, 0,
                                                                      0)))
        enemy_car = CarState(physics=Physics(
            location=Vector3(10000, 10000, 10000)))
        game_state = GameState(ball=ball_state,
                               cars={
                                   0: car_state,
                                   1: enemy_car
                               })
        return game_state
Esempio n. 27
0
def make_defendinator_player_config(team: Team) -> PlayerConfig:
    return PlayerConfig.bot_config(
        Path(__file__).absolute().parent.parent / 'Defendinator.cfg', team)
Esempio n. 28
0
from pathlib import Path

from rlbot.matchconfig.match_config import PlayerConfig, Team

__cfg_path = Path(__file__).absolute(
).parent.parent.parent / 'SpaceInvaders' / 'manticore' / 'manticore' / 'manticore.cfg'
manticore_blue = PlayerConfig.bot_config(__cfg_path, Team.BLUE)
manticore_orange = PlayerConfig.bot_config(__cfg_path, Team.ORANGE)
Esempio n. 29
0
from pathlib import Path

from rlbot.matchconfig.match_config import PlayerConfig, Team

__cfg_path = Path(__file__).absolute().parent.parent / 'src' / 'main' / 'python' / 'local_version.cfg'
agc_blue = PlayerConfig.bot_config(__cfg_path, Team.BLUE)
agc_orange = PlayerConfig.bot_config(__cfg_path, Team.ORANGE)
Esempio n. 30
0
from pathlib import Path

from rlbot.matchconfig.match_config import PlayerConfig, Team

__cfg_path = Path(__file__).absolute(
).parent.parent.parent / 'SpaceInvaders' / 'Relief' / 'README' / 'relief_bot.cfg'
relief_blue = PlayerConfig.bot_config(__cfg_path, Team.BLUE)
relief_orange = PlayerConfig.bot_config(__cfg_path, Team.ORANGE)