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/Conversion/FlatToCommand.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
using Microsoft.Extensions.Logging;
using rlbot.flat;
using RLBot.Flat;
using RLBotCS.ManagerTools;

namespace RLBotCS.Conversion;
Expand Down
4 changes: 2 additions & 2 deletions RLBotCS/Conversion/FlatToModel.cs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
using Bridge.Models.Command;
using Bridge.Models.Control;
using Bridge.State;
using rlbot.flat;
using RLBot.Flat;
using Color = System.Drawing.Color;
using LoadoutPaint = Bridge.Models.Command.LoadoutPaint;
using Physics = Bridge.Models.Phys.Physics;
Expand Down Expand Up @@ -66,7 +66,7 @@ internal static RenderAnchor ToRenderAnchor(RenderAnchorT offset, GameState game

internal static Color ToColor(ColorT c) => Color.FromArgb(c.A, c.R, c.G, c.B);

internal static Rotator ToRotator(rlbot.flat.Rotator r) =>
internal static Rotator ToRotator(RLBot.Flat.Rotator r) =>
new Rotator(r.Pitch, r.Yaw, r.Roll);

internal static Loadout ToLoadout(PlayerLoadoutT l, uint team)
Expand Down
26 changes: 13 additions & 13 deletions RLBotCS/Conversion/GameStateToFlat.cs
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
using Bridge.Models.Message;
using Bridge.Packet;
using Bridge.State;
using rlbot.flat;
using RLBot.Flat;
using RLBotCS.Model;
using CollisionShapeUnion = rlbot.flat.CollisionShapeUnion;
using CollisionShapeUnion = RLBot.Flat.CollisionShapeUnion;
using MatchPhase = Bridge.Models.Message.MatchPhase;
using Rotator = Bridge.Models.Phys.Rotator;
using Vector2 = Bridge.Models.Phys.Vector2;
Expand Down Expand Up @@ -86,17 +86,17 @@ public static GamePacketT ToFlatBuffers(this GameState gameState)
balls.Add(new() { Physics = ballPhysics, Shape = collisionShape });
}

rlbot.flat.MatchPhase matchPhase = gameState.MatchPhase switch
RLBot.Flat.MatchPhase matchPhase = gameState.MatchPhase switch
{
MatchPhase.Inactive => rlbot.flat.MatchPhase.Inactive,
MatchPhase.Countdown => rlbot.flat.MatchPhase.Countdown,
MatchPhase.Kickoff => rlbot.flat.MatchPhase.Kickoff,
MatchPhase.Active => rlbot.flat.MatchPhase.Active,
MatchPhase.GoalScored => rlbot.flat.MatchPhase.GoalScored,
MatchPhase.Replay => rlbot.flat.MatchPhase.Replay,
MatchPhase.Paused => rlbot.flat.MatchPhase.Paused,
MatchPhase.Ended => rlbot.flat.MatchPhase.Ended,
_ => rlbot.flat.MatchPhase.Inactive,
MatchPhase.Inactive => RLBot.Flat.MatchPhase.Inactive,
MatchPhase.Countdown => RLBot.Flat.MatchPhase.Countdown,
MatchPhase.Kickoff => RLBot.Flat.MatchPhase.Kickoff,
MatchPhase.Active => RLBot.Flat.MatchPhase.Active,
MatchPhase.GoalScored => RLBot.Flat.MatchPhase.GoalScored,
MatchPhase.Replay => RLBot.Flat.MatchPhase.Replay,
MatchPhase.Paused => RLBot.Flat.MatchPhase.Paused,
MatchPhase.Ended => RLBot.Flat.MatchPhase.Ended,
_ => RLBot.Flat.MatchPhase.Inactive,
};

MatchInfoT matchInfo = new()
Expand Down Expand Up @@ -170,7 +170,7 @@ public static GamePacketT ToFlatBuffers(this GameState gameState)
Name = car.Name,
Team = car.Team,
Boost = car.Boost,
SpawnId = car.SpawnId,
PlayerId = car.PlayerId,
ScoreInfo = new()
{
Score = car.ScoreInfo.Score,
Expand Down
2 changes: 1 addition & 1 deletion RLBotCS/Conversion/PsyonixLoadouts.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
using System.Collections.Frozen;
using rlbot.flat;
using RLBot.Flat;

namespace RLBotCS.Conversion;

Expand Down
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.6.10");
Console.WriteLine("RLBotServer v5.beta.7.0");
Environment.Exit(0);
}

Expand Down
12 changes: 6 additions & 6 deletions RLBotCS/ManagerTools/AgentMapping.cs
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
using rlbot.flat;
using RLBot.Flat;
using RLBotCS.Model;

namespace RLBotCS.ManagerTools;

public struct PlayerIdPair
{
public uint Index;
public int SpawnId;
public int PlayerId;
}

public class AgentMapping
Expand Down Expand Up @@ -38,7 +38,7 @@ public void SetAgents(MatchConfigurationT matchConfig)
playerConfig.Team,
playerConfig.Name,
playerConfig.AgentId,
playerConfig.SpawnId
playerConfig.PlayerId
)
);
}
Expand All @@ -53,7 +53,7 @@ public void SetAgents(MatchConfigurationT matchConfig)
Team.Scripts,
scriptConfig.Name,
scriptConfig.AgentId,
scriptConfig.SpawnId
scriptConfig.ScriptId
)
);
}
Expand All @@ -69,7 +69,7 @@ public void SetAgents(MatchConfigurationT matchConfig)
player.SetClient(clientId);

return (
new PlayerIdPair { Index = player.Index, SpawnId = player.SpawnId },
new PlayerIdPair { Index = player.Index, PlayerId = player.PlayerId },
player.Team
);
}
Expand Down Expand Up @@ -99,7 +99,7 @@ public void SetAgents(MatchConfigurationT matchConfig)
new PlayerIdPair
{
Index = playerMetadata.Index,
SpawnId = playerMetadata.SpawnId,
PlayerId = playerMetadata.PlayerId,
}
);
}
Expand Down
2 changes: 1 addition & 1 deletion RLBotCS/ManagerTools/BallPredictor.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
using System.Runtime.InteropServices;
using rlbot.flat;
using RLBot.Flat;
using RLBotCS.Model;

namespace RLBotCS.ManagerTools;
Expand Down
7 changes: 3 additions & 4 deletions RLBotCS/ManagerTools/ConfigParser.cs
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
using System.Diagnostics;
using System.Runtime.InteropServices;
using Microsoft.Extensions.Logging;
using rlbot.flat;
using RLBot.Flat;
using RLBotCS.Model;
using Tomlyn;
using Tomlyn.Model;
Expand Down Expand Up @@ -346,7 +345,7 @@ private PlayerConfigurationT ParseCarTable(TomlTable table, string matchConfigPa
Hivemind = false,
RootDir = "",
RunCommand = "",
SpawnId = 0,
PlayerId = 0,
};
}

Expand Down Expand Up @@ -409,7 +408,7 @@ private PlayerConfigurationT LoadPlayerConfig(
RunCommand = GetRunCommand(settings),
Hivemind = GetValue(settings, Fields.AgentHivemind, false),
RootDir = rootDir,
SpawnId = 0,
PlayerId = 0,
Variety = variety,
};
}
Expand Down
6 changes: 3 additions & 3 deletions RLBotCS/ManagerTools/ConfigValidator.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
using Microsoft.Extensions.Logging;
using rlbot.flat;
using RLBot.Flat;
using RLBotCS.Conversion;
using RLBotCS.Model;

Expand Down Expand Up @@ -161,7 +161,7 @@ List<PlayerConfigurationT> players
break;
}

player.SpawnId =
player.PlayerId =
player.Variety.Type == PlayerClass.Human
? 0
: $"{player.AgentId}/{player.Team}/{i}".GetHashCode();
Expand Down Expand Up @@ -209,7 +209,7 @@ List<ScriptConfigurationT> scripts
script.Name ??= "";
script.RunCommand ??= "";
script.RootDir ??= "";
script.SpawnId = $"{script.AgentId}/{Team.Scripts}/{i}".GetHashCode();
script.ScriptId = $"{script.AgentId}/{Team.Scripts}/{i}".GetHashCode();
}

return valid;
Expand Down
22 changes: 11 additions & 11 deletions RLBotCS/ManagerTools/LaunchManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,7 @@ private static void LaunchGameViaHeroic()
}

public static void LaunchBots(
List<rlbot.flat.PlayerConfigurationT> bots,
List<RLBot.Flat.PlayerConfigurationT> bots,
int rlbotSocketsPort
)
{
Expand Down Expand Up @@ -199,7 +199,7 @@ int rlbotSocketsPort
}

public static void LaunchScripts(
List<rlbot.flat.ScriptConfigurationT> scripts,
List<RLBot.Flat.ScriptConfigurationT> scripts,
int rlbotSocketsPort
)
{
Expand Down Expand Up @@ -246,15 +246,15 @@ int rlbotSocketsPort
}

public static void LaunchRocketLeague(
rlbot.flat.Launcher launcherPref,
RLBot.Flat.Launcher launcherPref,
string extraArg,
int gamePort
)
{
#if WINDOWS
switch (launcherPref)
{
case rlbot.flat.Launcher.Steam:
case RLBot.Flat.Launcher.Steam:
string steamPath = GetWindowsSteamPath();
Process steam = new();
steam.StartInfo.FileName = steamPath;
Expand All @@ -266,7 +266,7 @@ int gamePort
);
steam.Start();
break;
case rlbot.flat.Launcher.Epic:
case RLBot.Flat.Launcher.Epic:
bool nonRLBotGameRunning = IsRocketLeagueRunning();

// we don't need to start the game because there's another instance of non-rlbot rocket league open
Expand Down Expand Up @@ -333,7 +333,7 @@ int gamePort
}).Start();

break;
case rlbot.flat.Launcher.Custom:
case RLBot.Flat.Launcher.Custom:
if (extraArg.ToLower() == "legendary")
{
LaunchGameViaLegendary();
Expand All @@ -346,13 +346,13 @@ int gamePort
}

throw new NotSupportedException($"Unexpected launcher, \"{extraArg}\"");
case rlbot.flat.Launcher.NoLaunch:
case RLBot.Flat.Launcher.NoLaunch:
break;
}
#else
switch (launcherPref)
{
case rlbot.flat.Launcher.Steam:
case RLBot.Flat.Launcher.Steam:
string args = string.Join("%20", GetIdealArgs(gamePort));
Process rocketLeague = new();
rocketLeague.StartInfo.WindowStyle = ProcessWindowStyle.Hidden;
Expand All @@ -364,11 +364,11 @@ int gamePort
);
rocketLeague.Start();
break;
case rlbot.flat.Launcher.Epic:
case RLBot.Flat.Launcher.Epic:
throw new NotSupportedException(
"Epic Games Store is not directly supported on Linux."
);
case rlbot.flat.Launcher.Custom:
case RLBot.Flat.Launcher.Custom:
if (extraArg.ToLower() == "legendary")
{
LaunchGameViaLegendary();
Expand All @@ -381,7 +381,7 @@ int gamePort
}

throw new NotSupportedException($"Unexpected launcher, \"{extraArg}\"");
case rlbot.flat.Launcher.NoLaunch:
case RLBot.Flat.Launcher.NoLaunch:
break;
}
#endif
Expand Down
3 changes: 2 additions & 1 deletion RLBotCS/ManagerTools/Logging.cs
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,8 @@ public class Logging : ILogger

public Logging(string name, LogLevel minLevel)
{
_name = name.PadLeft(16);
// Longest logger: "FlatBuffersSession" with 18 characters
_name = name.PadLeft(18);
_minLevel = minLevel;
}

Expand Down
7 changes: 4 additions & 3 deletions RLBotCS/ManagerTools/MatchStarter.cs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
using System.Diagnostics;
using Bridge.Models.Message;
using Microsoft.Extensions.Logging;
using rlbot.flat;
using RLBot.Flat;
using MatchPhase = Bridge.Models.Message.MatchPhase;

namespace RLBotCS.ManagerTools;
Expand Down Expand Up @@ -36,6 +36,7 @@ class MatchStarter(int gamePort, int rlbotSocketsPort)

public void ResetMatchStarting()
{
Logger.LogDebug("Reset MatchStarter");
_deferredMatchConfig = null;
_matchConfig = null;
HasSpawnedMap = false;
Expand Down Expand Up @@ -271,7 +272,7 @@ private void LoadMatch(MatchConfigurationT matchConfig, PlayerSpawner spawner)

if (matchConfig.PlayerConfigurations.Count <= i)
{
toDespawnIds.Add(lastPlayerConfig.SpawnId);
toDespawnIds.Add(lastPlayerConfig.PlayerId);
toDespawnNames.Add(
$"{lastPlayerConfig.AgentId} (index {i}, team {lastPlayerConfig.Team})"
);
Expand All @@ -284,7 +285,7 @@ private void LoadMatch(MatchConfigurationT matchConfig, PlayerSpawner spawner)
|| lastPlayerConfig.Team != playerConfig.Team
)
{
toDespawnIds.Add(lastPlayerConfig.SpawnId);
toDespawnIds.Add(lastPlayerConfig.PlayerId);
toDespawnNames.Add(
$"{lastPlayerConfig.AgentId} (index {i}, team {lastPlayerConfig.Team})"
);
Expand Down
2 changes: 1 addition & 1 deletion RLBotCS/ManagerTools/PerfMonitor.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
using Bridge.State;
using rlbot.flat;
using RLBot.Flat;

namespace RLBotCS.ManagerTools;

Expand Down
Loading