|
2 | 2 | from time import sleep |
3 | 3 |
|
4 | 4 | from rlbot import flat |
5 | | -from rlbot.managers import MatchManager |
| 5 | +from rlbot.managers import MatchManager, get_player_config |
| 6 | +from rlbot.utils.maps import GAME_MAP_TO_UPK, STANDARD_MAPS |
6 | 7 |
|
7 | 8 | CURRENT_FILE = Path(__file__).parent |
8 | 9 |
|
9 | | -MATCH_CONFIG_PATH = CURRENT_FILE / "series.toml" |
| 10 | +BOT_PATH = CURRENT_FILE / "necto/bot.toml" |
10 | 11 | RLBOT_SERVER_FOLDER = CURRENT_FILE / "../../core/RLBotCS/bin/Release/" |
11 | 12 |
|
12 | 13 | if __name__ == "__main__": |
13 | 14 | match_manager = MatchManager(RLBOT_SERVER_FOLDER) |
14 | 15 | match_manager.ensure_server_started() |
15 | 16 |
|
| 17 | + current_map = -1 |
| 18 | + |
| 19 | + match_settings = flat.MatchSettings( |
| 20 | + launcher=flat.Launcher.Steam, |
| 21 | + auto_start_bots=True, |
| 22 | + game_mode=flat.GameMode.Soccer, |
| 23 | + enable_state_setting=True, |
| 24 | + existing_match_behavior=flat.ExistingMatchBehavior.Continue_And_Spawn, |
| 25 | + skip_replays=True, |
| 26 | + player_configurations=[ |
| 27 | + get_player_config(flat.RLBot(), 0, BOT_PATH), |
| 28 | + get_player_config(flat.RLBot(), 1, BOT_PATH), |
| 29 | + ], |
| 30 | + ) |
| 31 | + |
16 | 32 | while True: |
17 | | - match_manager.start_match(MATCH_CONFIG_PATH) |
| 33 | + # don't use the same map |
| 34 | + current_map = (current_map + 1) % len(STANDARD_MAPS) |
| 35 | + match_settings.game_map_upk = GAME_MAP_TO_UPK[STANDARD_MAPS[current_map]] |
| 36 | + |
| 37 | + print(f"Starting match on {match_settings.game_map_upk}") |
| 38 | + |
| 39 | + match_manager.start_match(match_settings) |
18 | 40 |
|
19 | 41 | while ( |
20 | 42 | match_manager.packet is None |
|
28 | 50 | ): |
29 | 51 | match_manager.rlbot_interface.send_game_state( |
30 | 52 | flat.DesiredGameState( |
31 | | - game_info_state=flat.DesiredGameInfoState(game_speed=5) |
| 53 | + game_info_state=flat.DesiredGameInfoState(game_speed=10) |
32 | 54 | ) |
33 | 55 | ) |
34 | 56 |
|
35 | 57 | sleep(0.1) |
36 | 58 |
|
37 | | - # let the end screen play for 5 seconds |
| 59 | + # let the end screen play for 5 seconds (just for fun) |
38 | 60 | sleep(5) |
39 | | - match_manager.stop_match() |
40 | | - sleep(1) |
|
0 commit comments