Skip to content

Commit b2da576

Browse files
authored
Merge pull request #19 from NicEastvillage/testing_leftovers
Some testing modifications
2 parents d049371 + 004b5fc commit b2da576

File tree

5 files changed

+27
-20
lines changed

5 files changed

+27
-20
lines changed

rlbot/managers/match.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,7 @@ def start_match(
122122

123123
if wait_for_start:
124124
self.wait_for_first_packet()
125-
self.logger.info("Match has started.")
125+
self.logger.debug("First packet received")
126126

127127
def disconnect(self):
128128
"""

tests/atba/atba.py

Lines changed: 23 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,7 @@ class Atba(Bot):
5757

5858
last_demoed = False
5959
needs_render = True
60+
next_teleport = 10
6061

6162
last_send = 0
6263
controller = flat.ControllerState()
@@ -125,30 +126,30 @@ def get_output(self, packet: flat.GamePacket) -> flat.ControllerState:
125126
steer_correction_radians = car_direction.correction_to(car_to_ball)
126127

127128
self.controller.steer = -steer_correction_radians
128-
self.controller.throttle = 1
129+
self.controller.throttle = 1.0
129130

130131
return self.controller
131132

132133
def test_state_setting(self, packet: flat.GamePacket):
133-
self.set_game_state(
134-
{
135-
0: flat.DesiredBallState(
136-
flat.DesiredPhysics(
137-
velocity=flat.Vector3Partial(
138-
z=packet.balls[0].physics.velocity.z + 10
134+
if packet.match_info.seconds_elapsed > self.next_teleport:
135+
self.next_teleport = packet.match_info.seconds_elapsed + 10
136+
self.set_game_state(
137+
{
138+
0: flat.DesiredBallState(
139+
flat.DesiredPhysics(
140+
location=flat.Vector3Partial(0, 0, 100),
139141
)
140142
)
141-
)
142-
},
143-
{
144-
i: flat.DesiredCarState(
145-
flat.DesiredPhysics(
146-
velocity=flat.Vector3Partial(z=car.physics.velocity.z + 1)
143+
},
144+
{
145+
i: flat.DesiredCarState(
146+
flat.DesiredPhysics(
147+
rotation=flat.RotatorPartial(yaw=0)
148+
)
147149
)
148-
)
149-
for i, car in enumerate(packet.players)
150-
},
151-
)
150+
for i, car in enumerate(packet.players)
151+
},
152+
)
152153

153154
def test_rendering(self, packet: flat.GamePacket):
154155
if not self.needs_render:
@@ -163,6 +164,11 @@ def test_rendering(self, packet: flat.GamePacket):
163164
self.renderer.begin_rendering()
164165

165166
text = ["Hello world!", "I hope I'm centered!"]
167+
self.renderer.draw_line_3d(
168+
flat.CarAnchor(self.index),
169+
flat.RenderAnchor(flat.Vector3(0, 0, 150), flat.CarAnchor(self.index)),
170+
self.renderer.lime,
171+
)
166172
self.renderer.draw_string_3d(
167173
"\n".join(text),
168174
flat.CarAnchor(self.index),

tests/human_vs_atba.toml

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

910
[mutators]
1011
match_length = "Unlimited"

tests/render_test/render.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,4 +95,4 @@ def do_render(self, radius: float):
9595

9696

9797
if __name__ == "__main__":
98-
RenderFun().run(wants_match_communications=False, wants_ball_predictions=False)
98+
RenderFun("testing/render_test").run(wants_match_communications=False, wants_ball_predictions=False)

tests/run_match.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66

77
DIR = Path(__file__).parent
88

9-
MATCH_CONFIG_PATH = DIR / "render_test.toml"
9+
MATCH_CONFIG_PATH = DIR / "human_vs_atba.toml"
1010
RLBOT_SERVER_FOLDER = DIR / "../../core/RLBotCS/bin/Release/"
1111

1212
if __name__ == "__main__":

0 commit comments

Comments
 (0)