Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion RLBotCS/Main.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

if (args.Length > 0 && args[0] == "--version")
{
Console.WriteLine("RLBotServer v5.beta.5.2");
Console.WriteLine("RLBotServer v5.beta.6.0");
Environment.Exit(0);
}

Expand Down
37 changes: 31 additions & 6 deletions RLBotCS/ManagerTools/ConfigParser.cs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,9 @@ public static class Fields
public const string RlBotTable = "rlbot";
public const string RlBotLauncher = "launcher";
public const string RlBotLauncherArg = "launcher_arg";
public const string RlBotAutoStartBots = "auto_start_bots";
public const string RlBotAutoStartAgents = "auto_start_agents";
public const string RlBotAutoStartAgentsOld = "auto_start_bots";
public const string RlBotWaitForAgents = "wait_for_agents";

public const string MatchTable = "match";
public const string MatchGameMode = "game_mode";
Expand Down Expand Up @@ -64,6 +66,7 @@ public static class Fields
public const string AgentTeam = "team";
public const string AgentType = "type";
public const string AgentSkill = "skill";
public const string AgentAutoStart = "auto_start";
public const string AgentName = "name";
public const string AgentLoadoutFile = "loadout_file";
public const string AgentConfigFile = "config_file";
Expand Down Expand Up @@ -345,6 +348,12 @@ private PlayerConfigurationT ParseCarTable(TomlTable table, string matchConfigPa
};
}

bool autoStart = GetValue(table, Fields.AgentAutoStart, true);
if (!autoStart)
{
player.RunCommand = "";
}

return player;
}

Expand Down Expand Up @@ -636,11 +645,21 @@ public MatchConfigurationT LoadMatchConfig(string path)
Launcher.Steam
);
matchConfig.LauncherArg = GetValue(rlbotTable, Fields.RlBotLauncherArg, "");
matchConfig.AutoStartBots = GetValue(
matchConfig.AutoStartAgents = GetValue(
rlbotTable,
Fields.RlBotAutoStartBots,
Fields.RlBotAutoStartAgents,
true
);
matchConfig.WaitForAgents = GetValue(rlbotTable, Fields.RlBotWaitForAgents, true);
// TODO: Remove in future version
if (rlbotTable.ContainsKey(Fields.RlBotAutoStartAgentsOld))
{
bool autoStartBots = GetValue(rlbotTable, Fields.RlBotAutoStartAgentsOld, true);
matchConfig.AutoStartAgents = autoStartBots;
matchConfig.WaitForAgents = autoStartBots;
Logger.LogWarning($"'{Fields.RlBotAutoStartAgentsOld}' is deprecated. Please use " +
$"'{Fields.RlBotAutoStartAgents}' and '{Fields.RlBotWaitForAgents}' instead.");
}
}

TomlTableArray players = GetValue<TomlTableArray>(outerTable, Fields.CarsList, []);
Expand Down Expand Up @@ -677,9 +696,15 @@ public MatchConfigurationT LoadMatchConfig(string path)
)
)
{
matchConfig.ScriptConfigurations.Add(
LoadScriptConfig(absoluteConfigPath)
);
var script = LoadScriptConfig(absoluteConfigPath);

bool autoStart = GetValue(scripts[i], Fields.AgentAutoStart, true);
if (!autoStart)
{
script.RunCommand = "";
}

matchConfig.ScriptConfigurations.Add(script);
}
}
else
Expand Down
10 changes: 2 additions & 8 deletions RLBotCS/ManagerTools/LaunchManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -144,10 +144,7 @@ int rlbotSocketsPort
{
if (bot.RunCommand == "")
{
Logger.LogWarning(
"Bot {} must be started manually since 'run_command' is empty.",
bot.Name
);
Logger.LogWarning("Bot {} must be started manually.", bot.Name);
continue;
}

Expand Down Expand Up @@ -192,10 +189,7 @@ int rlbotSocketsPort
{
if (script.RunCommand == "")
{
Logger.LogWarning(
"Script {} must be started manually since 'run_command' is empty.",
script.Name
);
Logger.LogWarning("Script {} must be started manually.", script.Name);
continue;
}

Expand Down
4 changes: 2 additions & 2 deletions RLBotCS/ManagerTools/MatchStarter.cs
Original file line number Diff line number Diff line change
Expand Up @@ -220,7 +220,7 @@ private void StartBotsAndScripts(MatchConfigurationT matchConfig)
_connectionsReady = 0;
_expectedConnections = matchConfig.ScriptConfigurations.Count + processes.Count;

if (matchConfig.AutoStartBots)
if (matchConfig.AutoStartAgents)
{
LaunchManager.LaunchBots(processes.Values.ToList(), rlbotSocketsPort);
LaunchManager.LaunchScripts(matchConfig.ScriptConfigurations, rlbotSocketsPort);
Expand Down Expand Up @@ -397,7 +397,7 @@ private bool SpawnCars(MatchConfigurationT matchConfig, bool force = false)
return false;

bool doSpawning =
force || !matchConfig.AutoStartBots || _expectedConnections <= _connectionsReady;
force || !matchConfig.WaitForAgents || _expectedConnections <= _connectionsReady;

if (!doSpawning)
{
Expand Down
1 change: 0 additions & 1 deletion RLBotCS/Server/FlatBuffersSession.cs
Original file line number Diff line number Diff line change
Expand Up @@ -489,7 +489,6 @@ public void Cleanup()
Logger.LogInformation($"Closing session {_clientId} :: {clientName}");

bool wasReady = _isReady;

_connectionEstablished = false;
_isReady = false;
_incomingMessages.Writer.TryComplete();
Expand Down
7 changes: 6 additions & 1 deletion RLBotCSTests/ConfigParserTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,8 @@ public void EmptyVsDefaultMatchConfig()

Assert.AreEqual(emptyMC.Launcher, defaultMC.Launcher);
Assert.AreEqual(emptyMC.LauncherArg, defaultMC.LauncherArg);
Assert.AreEqual(emptyMC.AutoStartBots, defaultMC.AutoStartBots);
Assert.AreEqual(emptyMC.AutoStartAgents, defaultMC.AutoStartAgents);
Assert.AreEqual(emptyMC.WaitForAgents, defaultMC.WaitForAgents);
Assert.AreEqual(emptyMC.GameMapUpk, defaultMC.GameMapUpk);
Assert.AreEqual(
emptyMC.PlayerConfigurations.Count,
Expand Down Expand Up @@ -137,6 +138,10 @@ public void EdgeCases()
Assert.AreEqual(0u, loadoutP2.LoadoutPaint.HatPaintId);
Assert.AreEqual(12u, loadoutP2.LoadoutPaint.TrailsPaintId);
Assert.AreEqual(12u, loadoutP2.LoadoutPaint.GoalExplosionPaintId);

// Set to "" due to `auto_start=false`
Assert.AreEqual("", edgeMC.PlayerConfigurations[3].RunCommand);
Assert.AreEqual("", edgeMC.ScriptConfigurations[0].RunCommand);
}

[TestMethod]
Expand Down
8 changes: 8 additions & 0 deletions RLBotCSTests/TestTomls/edge.toml
Original file line number Diff line number Diff line change
Expand Up @@ -26,3 +26,11 @@ skill = "mega pro" # Ignored
[[cars]]
config_file = "phantom/../edge.bot.toml"
team = "orange"

[[cars]]
config_file = "normal.bot.toml"
auto_start = false

[[scripts]]
config_file = "normal.script.toml"
auto_start = false
2 changes: 1 addition & 1 deletion flatbuffers-schema