File tree Expand file tree Collapse file tree 1 file changed +6
-0
lines changed Expand file tree Collapse file tree 1 file changed +6
-0
lines changed Original file line number Diff line number Diff line change @@ -92,6 +92,9 @@ def init_params(self, **kwargs):
9292 self .spawn_in_formation = kwargs .pop ("spawn_in_formation" , True )
9393 self .only_blue_formation = kwargs .pop ("only_blue_formation" , True )
9494 self .formation_agents_per_column = kwargs .pop ("formation_agents_per_column" , 2 )
95+ self .randomise_formation_indices = kwargs .pop (
96+ "randomise_formation_indices" , False
97+ )
9598 self .formation_noise = kwargs .pop ("formation_noise" , 0.2 )
9699
97100 # Ai config
@@ -391,6 +394,9 @@ def reset_agents(self, env_index: int = None):
391394 )
392395
393396 def _spawn_formation (self , agents , blue , env_index ):
397+ if self .randomise_formation_indices :
398+ order = torch .randperm (len (agents )).tolist ()
399+ agents = [agents [i ] for i in order ]
394400 agent_index = 0
395401 endpoint = - (self .pitch_length / 2 + self .goal_depth ) * (1 if blue else - 1 )
396402 for x in torch .linspace (
You can’t perform that action at this time.
0 commit comments