Skip to content

Commit

Permalink
Avoid repeated positions
Browse files Browse the repository at this point in the history
when using bot multiplier (riders with identical positions will be filtered out by the client)
  • Loading branch information
oldnapalm committed Sep 26, 2023
1 parent 21b3b5a commit 8c450bf
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion standalone.py
Original file line number Diff line number Diff line change
Expand Up @@ -570,6 +570,7 @@ def load_bots():
for (root, dirs, files) in os.walk(path):
for f in files:
if f.endswith('.bin'):
positions = []
for n in range(0, multiplier):
p = profile_pb2.PlayerProfile()
p.CopyFrom(zo.random_profile(p))
Expand All @@ -580,9 +581,11 @@ def load_bots():
bot.route = udp_node_msgs_pb2.Ghost()
with open(os.path.join(root, f), 'rb') as fd:
bot.route.ParseFromString(fd.read())
positions = list(range(len(bot.route.states)))
random.shuffle(positions)
else:
bot.route = global_bots[i + 1000000].route
bot.position = random.randrange(len(bot.route.states))
bot.position = positions.pop()
if not loop_riders:
loop_riders = data['riders'].copy()
random.shuffle(loop_riders)
Expand Down

0 comments on commit 8c450bf

Please sign in to comment.