Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion rlbot/managers/match.py
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ def start_match(

if wait_for_start:
self.wait_for_first_packet()
self.logger.info("Match has started.")
self.logger.debug("First packet received")

def disconnect(self):
"""
Expand Down
40 changes: 23 additions & 17 deletions tests/atba/atba.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ class Atba(Bot):

last_demoed = False
needs_render = True
next_teleport = 10

last_send = 0
controller = flat.ControllerState()
Expand Down Expand Up @@ -125,30 +126,30 @@ def get_output(self, packet: flat.GamePacket) -> flat.ControllerState:
steer_correction_radians = car_direction.correction_to(car_to_ball)

self.controller.steer = -steer_correction_radians
self.controller.throttle = 1
self.controller.throttle = 1.0

return self.controller

def test_state_setting(self, packet: flat.GamePacket):
self.set_game_state(
{
0: flat.DesiredBallState(
flat.DesiredPhysics(
velocity=flat.Vector3Partial(
z=packet.balls[0].physics.velocity.z + 10
if packet.match_info.seconds_elapsed > self.next_teleport:
self.next_teleport = packet.match_info.seconds_elapsed + 10
self.set_game_state(
{
0: flat.DesiredBallState(
flat.DesiredPhysics(
location=flat.Vector3Partial(0, 0, 100),
)
)
)
},
{
i: flat.DesiredCarState(
flat.DesiredPhysics(
velocity=flat.Vector3Partial(z=car.physics.velocity.z + 1)
},
{
i: flat.DesiredCarState(
flat.DesiredPhysics(
rotation=flat.RotatorPartial(yaw=0)
)
)
)
for i, car in enumerate(packet.players)
},
)
for i, car in enumerate(packet.players)
},
)

def test_rendering(self, packet: flat.GamePacket):
if not self.needs_render:
Expand All @@ -163,6 +164,11 @@ def test_rendering(self, packet: flat.GamePacket):
self.renderer.begin_rendering()

text = ["Hello world!", "I hope I'm centered!"]
self.renderer.draw_line_3d(
flat.CarAnchor(self.index),
flat.RenderAnchor(flat.Vector3(0, 0, 150), flat.CarAnchor(self.index)),
self.renderer.lime,
)
self.renderer.draw_string_3d(
"\n".join(text),
flat.CarAnchor(self.index),
Expand Down
1 change: 1 addition & 0 deletions tests/human_vs_atba.toml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ auto_start_bots = true
[match]
game_mode = "Soccer"
game_map_upk = "Stadium_P"
enable_rendering = true

[mutators]
match_length = "Unlimited"
Expand Down
2 changes: 1 addition & 1 deletion tests/render_test/render.py
Original file line number Diff line number Diff line change
Expand Up @@ -95,4 +95,4 @@ def do_render(self, radius: float):


if __name__ == "__main__":
RenderFun().run(wants_match_communications=False, wants_ball_predictions=False)
RenderFun("testing/render_test").run(wants_match_communications=False, wants_ball_predictions=False)
2 changes: 1 addition & 1 deletion tests/run_match.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

DIR = Path(__file__).parent

MATCH_CONFIG_PATH = DIR / "render_test.toml"
MATCH_CONFIG_PATH = DIR / "human_vs_atba.toml"
RLBOT_SERVER_FOLDER = DIR / "../../core/RLBotCS/bin/Release/"

if __name__ == "__main__":
Expand Down