@@ -18,6 +18,7 @@ int rlbotSocketsPort
1818
1919 private MatchSettingsT ? _deferredMatchSettings ;
2020 private MatchSettingsT ? _matchSettings ;
21+ private Dictionary < string , string > _hivemindNameMap = new ( ) ;
2122 private int _expectedConnections ;
2223 private int _connectionReadies ;
2324
@@ -92,6 +93,7 @@ public void MapSpawned(string MapName)
9293 private void PreprocessMatch ( MatchSettingsT matchSettings )
9394 {
9495 Dictionary < string , int > playerNames = [ ] ;
96+ _hivemindNameMap . Clear ( ) ;
9597
9698 foreach ( var playerConfig in matchSettings . PlayerConfigurations )
9799 {
@@ -108,6 +110,9 @@ private void PreprocessMatch(MatchSettingsT matchSettings)
108110 playerConfig . Name = playerName ;
109111 }
110112
113+ if ( playerConfig . Hivemind )
114+ _hivemindNameMap [ playerConfig . Name ] = playerName ;
115+
111116 if ( playerConfig . SpawnId == 0 )
112117 playerConfig . SpawnId = playerConfig . Name . GetHashCode ( ) ;
113118
@@ -116,18 +121,19 @@ private void PreprocessMatch(MatchSettingsT matchSettings)
116121 playerConfig . AgentId ??= "" ;
117122 }
118123
124+ Dictionary < string , int > scriptNames = [ ] ;
119125 foreach ( var scriptConfig in matchSettings . ScriptConfigurations )
120126 {
121127 // De-duplicating similar names, Overwrites original value
122128 string scriptName = scriptConfig . Name ?? "" ;
123- if ( playerNames . TryGetValue ( scriptName , out int value ) )
129+ if ( scriptNames . TryGetValue ( scriptName , out int value ) )
124130 {
125- playerNames [ scriptName ] = ++ value ;
131+ scriptNames [ scriptName ] = ++ value ;
126132 scriptConfig . Name = scriptName + $ " ({ value } )";
127133 }
128134 else
129135 {
130- playerNames [ scriptName ] = 0 ;
136+ scriptNames [ scriptName ] = 0 ;
131137 scriptConfig . Name = scriptName ;
132138 }
133139
@@ -162,7 +168,7 @@ private void StartBots(MatchSettingsT matchSettings)
162168 + "_"
163169 + playerConfig . RunCommand
164170 + "_"
165- + playerConfig . Name
171+ + _hivemindNameMap [ playerConfig . Name ]
166172 + "_"
167173 + playerConfig . Team ;
168174
@@ -175,6 +181,8 @@ private void StartBots(MatchSettingsT matchSettings)
175181 }
176182 }
177183
184+ _hivemindNameMap . Clear ( ) ;
185+
178186 _connectionReadies = 0 ;
179187 _expectedConnections = matchSettings . ScriptConfigurations . Count + processes . Count ;
180188
0 commit comments