1+ from random import randrange
12from time import time_ns
23
34from rlbot_flatbuffers import *
@@ -8,6 +9,31 @@ def __add__(self, other):
89 return MyVector (self .x + other .x , self .y + other .y , self .z + other .z )
910
1011
12+ def random_string ():
13+ return "" .join (chr (randrange (32 , 127 )) for _ in range (64 ))
14+
15+
16+ def random_player_config ():
17+ return PlayerConfiguration (
18+ variety = PlayerClass (Psyonix (1. )),
19+ name = random_string (),
20+ location = random_string (),
21+ run_command = random_string (),
22+ loadout = PlayerLoadout (
23+ loadout_paint = LoadoutPaint (),
24+ primary_color_lookup = Color (),
25+ secondary_color_lookup = Color (),
26+ )
27+ )
28+
29+
30+ def random_script_config ():
31+ return ScriptConfiguration (
32+ location = random_string (),
33+ run_command = random_string (),
34+ )
35+
36+
1137if __name__ == "__main__" :
1238 vec1 = MyVector (1 , 2 , 3 )
1339 vec2 = Vector3 (4 , 5 , 6 )
@@ -71,6 +97,26 @@ def __add__(self, other):
7197 except InvalidFlatbuffer as e :
7298 print (e )
7399
100+ match_settings = MatchSettings (
101+ game_path = random_string (),
102+ game_map_upk = random_string (),
103+ player_configurations = [random_player_config () for _ in range (128 )],
104+ script_configurations = [random_script_config () for _ in range (8 )],
105+ mutator_settings = MutatorSettings ()
106+ )
107+
108+ data = match_settings .pack ()
109+ print (f"MatchSettings size: { len (data )} bytes" )
110+
111+ renderPolyLine = RenderMessage (RenderType (PolyLine3D (
112+ [Vector3 () for _ in range (2048 )],
113+ )))
114+
115+ data = renderPolyLine .pack ()
116+ print (f"RenderMessage size: { len (data )} bytes" )
117+
118+ print ()
119+
74120 print ("Running quick benchmark..." )
75121
76122 num_trials = 100_000
0 commit comments