Skip to content

Commit f1f7364

Browse files
committed
Update to the latest spec
1 parent f40fcd4 commit f1f7364

5 files changed

Lines changed: 87 additions & 34 deletions

File tree

Cargo.lock

Lines changed: 14 additions & 14 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

pybench.py

Lines changed: 60 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -153,9 +153,64 @@ def test_loop():
153153
print(f"Minimum time per: {min(times) / 1000:.1f}us")
154154

155155

156+
def test_renders():
157+
print("Testing rendering")
158+
159+
times = []
160+
161+
for _ in range(20_000):
162+
start = time_ns()
163+
164+
renders = [
165+
flat.RenderMessage(
166+
flat.Line3D(
167+
flat.RenderAnchor(world=flat.Vector3(0, 0, 0)),
168+
flat.RenderAnchor(
169+
relative=flat.CarAnchor(0, flat.Vector3(1, 1, 1))
170+
),
171+
flat.Color(255, a=150),
172+
)
173+
),
174+
flat.RenderMessage(
175+
flat.Line3D(
176+
flat.RenderAnchor(world=flat.Vector3(0, 0, 0)),
177+
flat.RenderAnchor(
178+
relative=flat.CarAnchor(0, flat.Vector3(1, 1, 1))
179+
),
180+
flat.Color(255, a=150),
181+
)
182+
),
183+
flat.RenderMessage(
184+
flat.Line3D(
185+
flat.RenderAnchor(world=flat.Vector3(0, 0, 0)),
186+
flat.RenderAnchor(
187+
relative=flat.CarAnchor(0, flat.Vector3(1, 1, 1))
188+
),
189+
flat.Color(255, a=150),
190+
)
191+
),
192+
flat.RenderMessage(
193+
flat.String3D(
194+
"Hello, world!", flat.RenderAnchor(world=flat.Vector3(0, 0, 0)), 1
195+
)
196+
),
197+
]
198+
199+
render_group = flat.RenderGroup(renders)
200+
render_group.pack()
201+
202+
times.append(time_ns() - start)
203+
204+
avg_time_ns = sum(times) / len(times)
205+
print(f"Average time per: {avg_time_ns / 1000:.1f}us")
206+
print(f"Minimum time per: {min(times) / 1000:.1f}us")
207+
208+
156209
if __name__ == "__main__":
157-
test_gtp()
158-
print()
159-
test_ballpred()
160-
print()
161-
test_loop()
210+
# test_gtp()
211+
# print()
212+
# test_ballpred()
213+
# print()
214+
# test_loop()
215+
# print()
216+
test_renders()

pytest.py

Lines changed: 11 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -43,25 +43,25 @@ def random_script_config():
4343
eval(repr(player_info))
4444
print()
4545

46-
connection_settings = ConnectionSettings("rlbot/abot", True, close_between_matches=True)
46+
connection_settings = ConnectionSettings(
47+
"rlbot/abot", True, close_between_matches=True
48+
)
4749
print(hash(connection_settings))
4850
print(connection_settings)
4951
eval(repr(connection_settings))
5052
print()
5153

52-
dgs = DesiredGameState(
53-
game_info_state=DesiredGameInfoState(game_speed=2, end_match=Bool())
54-
)
54+
dgs = DesiredGameState(match_info=DesiredMatchInfo(game_speed=2))
5555

56-
match dgs.game_info_state:
57-
case DesiredGameInfoState():
58-
dgs.game_info_state.world_gravity_z = Float(-650)
56+
match dgs.match_info:
57+
case DesiredMatchInfo():
58+
dgs.match_info.world_gravity_z = Float(-650)
5959
case _:
6060
assert False
6161

62-
match dgs.game_info_state.end_match:
63-
case Bool(val):
64-
dgs.game_info_state.end_match.val = not val
62+
match dgs.match_info.game_speed:
63+
case Float(val):
64+
dgs.match_info.game_speed.val = not val
6565
case _:
6666
assert False
6767

@@ -190,9 +190,7 @@ def random_script_config():
190190
)
191191
for _ in range(16)
192192
],
193-
game_info_state=DesiredGameInfoState(
194-
game_speed=1, world_gravity_z=-650, end_match=True
195-
),
193+
match_info=DesiredMatchInfo(game_speed=1, world_gravity_z=-650),
196194
console_commands=[ConsoleCommand("dump_items")],
197195
)
198196
total_make_time += time_ns() - start

src/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -194,8 +194,8 @@ pynamedmodule! {
194194
DesiredBallState,
195195
DesiredBoostState,
196196
DesiredCarState,
197-
DesiredGameInfoState,
198197
DesiredGameState,
198+
DesiredMatchInfo,
199199
DesiredPhysics,
200200
ExistingMatchBehavior,
201201
FieldInfo,

0 commit comments

Comments
 (0)