Skip to content

Commit 3f2167f

Browse files
committed
Rename group id to agent id
1 parent c5ce202 commit 3f2167f

File tree

9 files changed

+51
-35
lines changed

9 files changed

+51
-35
lines changed

rlbot/interface.py

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ class SocketDataType(IntEnum):
3434
STOP_COMMAND = 12
3535
SET_LOADOUT = 13
3636
INIT_COMPLETE = 14
37-
TEAM_CONTROLLABLES = 15
37+
CONTROLLABLE_TEAM_INFO = 15
3838

3939

4040
MAX_SIZE_2_BYTES = 2**16 - 1
@@ -71,16 +71,18 @@ class SocketRelay:
7171
match_settings_handlers: list[Callable[[flat.MatchSettings], None]] = []
7272
match_communication_handlers: list[Callable[[flat.MatchComm], None]] = []
7373
ball_prediction_handlers: list[Callable[[flat.BallPrediction], None]] = []
74-
team_controllables_handlers: list[Callable[[flat.TeamControllables], None]] = []
74+
controllable_team_info_handlers: list[
75+
Callable[[flat.ControllableTeamInfo], None]
76+
] = []
7577
raw_handlers: list[Callable[[SocketMessage], None]] = []
7678

7779
def __init__(
7880
self,
79-
group_id: str,
81+
agent_id: str,
8082
connection_timeout: float = 120,
8183
logger: Optional[logging.Logger] = None,
8284
):
83-
self.group_id = group_id
85+
self.agent_id = agent_id
8486
self.connection_timeout = connection_timeout
8587
self.logger = get_logger("interface") if logger is None else logger
8688

@@ -197,7 +199,7 @@ def connect(
197199
handler()
198200

199201
flatbuffer = flat.ConnectionSettings(
200-
self.group_id,
202+
self.agent_id,
201203
wants_ball_predictions,
202204
wants_match_communications,
203205
close_after_match,
@@ -292,12 +294,12 @@ def handle_incoming_message(self, incoming_message: SocketMessage):
292294
ball_prediction = flat.BallPrediction.unpack(incoming_message.data)
293295
for handler in self.ball_prediction_handlers:
294296
handler(ball_prediction)
295-
case SocketDataType.TEAM_CONTROLLABLES:
296-
if len(self.team_controllables_handlers) > 0:
297-
player_mappings = flat.TeamControllables.unpack(
297+
case SocketDataType.CONTROLLABLE_TEAM_INFO:
298+
if len(self.controllable_team_info_handlers) > 0:
299+
player_mappings = flat.ControllableTeamInfo.unpack(
298300
incoming_message.data
299301
)
300-
for handler in self.team_controllables_handlers:
302+
for handler in self.controllable_team_info_handlers:
301303
handler(player_mappings)
302304

303305
def disconnect(self):

rlbot/managers/bot.py

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -33,15 +33,13 @@ class Bot:
3333
_latest_prediction = flat.BallPrediction()
3434

3535
def __init__(self):
36-
group_id = os.environ.get("RLBOT_GROUP_ID")
36+
agent_id = os.environ.get("RLBOT_AGENT_ID")
3737

38-
if group_id is None:
39-
self.logger.critical("RLBOT_GROUP_ID environment variable is not set")
38+
if agent_id is None:
39+
self.logger.critical("RLBOT_AGENT_ID environment variable is not set")
4040
exit(1)
4141

42-
self.logger.info(group_id)
43-
44-
self._game_interface = SocketRelay(group_id, logger=self.logger)
42+
self._game_interface = SocketRelay(agent_id, logger=self.logger)
4543
self._game_interface.match_settings_handlers.append(self._handle_match_settings)
4644
self._game_interface.field_info_handlers.append(self._handle_field_info)
4745
self._game_interface.match_communication_handlers.append(
@@ -50,7 +48,7 @@ def __init__(self):
5048
self._game_interface.ball_prediction_handlers.append(
5149
self._handle_ball_prediction
5250
)
53-
self._game_interface.team_controllables_handlers.append(
51+
self._game_interface.controllable_team_info_handlers.append(
5452
self._handle_player_mappings
5553
)
5654
self._game_interface.packet_handlers.append(self._handle_packet)
@@ -99,7 +97,7 @@ def _handle_field_info(self, field_info: flat.FieldInfo):
9997
):
10098
self._initialize()
10199

102-
def _handle_player_mappings(self, player_mappings: flat.TeamControllables):
100+
def _handle_player_mappings(self, player_mappings: flat.ControllableTeamInfo):
103101
self.team = player_mappings.team
104102
controllable = player_mappings.controllables[0]
105103
self.spawn_id = controllable.spawn_id

rlbot/managers/hivemind.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -35,13 +35,13 @@ class Hivemind:
3535
_latest_prediction = flat.BallPrediction()
3636

3737
def __init__(self):
38-
group_id = os.environ.get("RLBOT_GROUP_ID")
38+
agent_id = os.environ.get("RLBOT_AGENT_ID")
3939

40-
if group_id is None:
41-
self._logger.critical("RLBOT_GROUP_ID environment variable is not set")
40+
if agent_id is None:
41+
self._logger.critical("RLBOT_AGENT_ID environment variable is not set")
4242
exit(1)
4343

44-
self._game_interface = SocketRelay(group_id, logger=self._logger)
44+
self._game_interface = SocketRelay(agent_id, logger=self._logger)
4545
self._game_interface.match_settings_handlers.append(self._handle_match_settings)
4646
self._game_interface.field_info_handlers.append(self._handle_field_info)
4747
self._game_interface.match_communication_handlers.append(
@@ -97,7 +97,7 @@ def _handle_field_info(self, field_info: flat.FieldInfo):
9797
):
9898
self._initialize()
9999

100-
def _handle_player_mappings(self, player_mappings: flat.TeamControllables):
100+
def _handle_player_mappings(self, player_mappings: flat.ControllableTeamInfo):
101101
self.team = player_mappings.team
102102
for controllable in player_mappings.controllables:
103103
self.spawn_ids.append(controllable.spawn_id)

rlbot/managers/match.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -64,9 +64,9 @@ def get_player_config(
6464

6565
settings: dict[str, Any] = config["settings"]
6666

67-
location = parent
68-
if "location" in settings:
69-
location /= settings["location"]
67+
root_dir = parent
68+
if "root_dir" in settings:
69+
root_dir /= settings["root_dir"]
7070

7171
run_command = settings.get("run_command", "")
7272
if CURRENT_OS == OS.LINUX and "run_command_linux" in settings:
@@ -86,7 +86,7 @@ def get_player_config(
8686
type,
8787
settings["name"],
8888
team,
89-
str(location),
89+
str(root_dir),
9090
str(run_command),
9191
loadout,
9292
0,

rlbot/managers/script.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -32,13 +32,13 @@ class Script:
3232
_latest_prediction = flat.BallPrediction()
3333

3434
def __init__(self):
35-
group_id = os.environ.get("RLBOT_GROUP_ID")
35+
agent_id = os.environ.get("RLBOT_AGENT_ID")
3636

37-
if group_id is None:
38-
self.logger.critical("RLBOT_GROUP_ID environment variable is not set")
37+
if agent_id is None:
38+
self.logger.critical("RLBOT_AGENT_ID environment variable is not set")
3939
exit(1)
4040

41-
self._game_interface = SocketRelay(group_id, logger=self.logger)
41+
self._game_interface = SocketRelay(agent_id, logger=self.logger)
4242
self._game_interface.match_settings_handlers.append(self._handle_match_settings)
4343
self._game_interface.field_info_handlers.append(self._handle_field_info)
4444
self._game_interface.match_communication_handlers.append(
@@ -91,7 +91,7 @@ def _handle_field_info(self, field_info: flat.FieldInfo):
9191
):
9292
self._initialize()
9393

94-
def _handle_player_mappings(self, player_mappings: flat.TeamControllables):
94+
def _handle_player_mappings(self, player_mappings: flat.ControllableTeamInfo):
9595
self.team = player_mappings.team
9696
controllable = player_mappings.controllables[0]
9797
self.spawn_id = controllable.spawn_id

tests/atba/atba.bot.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ name = "ATBA_v5"
55
loadout_file = "../necto/loadout.toml"
66
# (OPTIONAL) - what you want the working directory set to
77
# This is relative to the location of this file
8-
location = ""
8+
root_dir = ""
99
# The command RLBot will call to start your bot on Windows
1010
# ex: "bot.exe" for compiled bots, or "python bot.py" if you don't want to freeze your python bot
1111
run_command = "..\\..\\venv\\Scripts\\python atba.py"

tests/hivemind/bot.toml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
[settings]
22
name = "Hives"
33
loadout_file = "../necto/loadout.toml"
4-
location = ""
54
run_command = "..\\..\\venv\\Scripts\\python bot.py"
65
run_command_linux = "../../venv/bin/python bot.py"
76
group_id = "botmaker/hives"

tests/hvatba.toml

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

tests/hvn.toml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@ auto_start_bots = true
55
[match]
66
game_mode = "Soccer"
77
game_map_upk = "Stadium_P"
8-
enable_state_setting = false
98

109
[mutators]
1110
match_length = "Unlimited"
@@ -15,5 +14,5 @@ type = "human"
1514
team = 0
1615

1716
[[cars]]
18-
config = "atba/atba.bot.toml"
17+
config = "necto/bot.toml"
1918
team = 1

0 commit comments

Comments
 (0)