Skip to content

Commit 2a722bb

Browse files
committed
Add match series runner
1 parent 7a0a6d7 commit 2a722bb

File tree

2 files changed

+57
-0
lines changed

2 files changed

+57
-0
lines changed

tests/run_forever.py

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
from pathlib import Path
2+
from time import sleep
3+
4+
from rlbot import flat
5+
from rlbot.managers import MatchManager
6+
7+
CURRENT_FILE = Path(__file__).parent
8+
9+
MATCH_CONFIG_PATH = CURRENT_FILE / "series.toml"
10+
RLBOT_SERVER_FOLDER = CURRENT_FILE / "../../core/RLBotCS/bin/Release/"
11+
12+
if __name__ == "__main__":
13+
match_manager = MatchManager(RLBOT_SERVER_FOLDER)
14+
match_manager.ensure_server_started()
15+
16+
while True:
17+
match_manager.start_match(MATCH_CONFIG_PATH)
18+
19+
while (
20+
match_manager.packet is None
21+
or match_manager.packet.game_info.game_state_type
22+
!= flat.GameStateType.Ended
23+
):
24+
if (
25+
match_manager.packet is not None
26+
and match_manager.packet.game_info.game_state_type
27+
== flat.GameStateType.Active
28+
):
29+
match_manager.rlbot_interface.send_game_state(
30+
flat.DesiredGameState(
31+
game_info_state=flat.DesiredGameInfoState(game_speed=5)
32+
)
33+
)
34+
35+
sleep(0.1)
36+
37+
# let the end screen play for 5 seconds
38+
sleep(5)

tests/series.toml

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
[rlbot]
2+
launcher = "steam"
3+
auto_start_bots = true
4+
5+
[match]
6+
num_cars = 2
7+
game_mode = "Soccer"
8+
game_map_upk = "Stadium_P"
9+
enable_state_setting = true
10+
existing_match_behavior = "Continue_And_Spawn"
11+
skip_replays = true
12+
13+
[[cars]]
14+
config = "necto/bot.toml"
15+
team = 1
16+
17+
[[cars]]
18+
config = "necto/bot.toml"
19+
team = 0

0 commit comments

Comments
 (0)