From 489913496f33d09b3ff8fc5b83213e281d69efc5 Mon Sep 17 00:00:00 2001 From: Virx Date: Sat, 24 May 2025 02:46:02 -0400 Subject: [PATCH 1/3] Update to new schema `rlbot.flat` -> `RLBot.Flat` --- RLBotCS/Conversion/FlatToCommand.cs | 2 +- RLBotCS/Conversion/FlatToModel.cs | 4 +- RLBotCS/Conversion/GameStateToFlat.cs | 24 +-- RLBotCS/Conversion/PsyonixLoadouts.cs | 2 +- RLBotCS/Main.cs | 2 +- RLBotCS/ManagerTools/AgentMapping.cs | 2 +- RLBotCS/ManagerTools/BallPredictor.cs | 2 +- RLBotCS/ManagerTools/ConfigParser.cs | 2 +- RLBotCS/ManagerTools/ConfigValidator.cs | 2 +- RLBotCS/ManagerTools/LaunchManager.cs | 22 +-- RLBotCS/ManagerTools/Logging.cs | 3 +- RLBotCS/ManagerTools/MatchStarter.cs | 3 +- RLBotCS/ManagerTools/PerfMonitor.cs | 2 +- RLBotCS/ManagerTools/PlayerSpawner.cs | 2 +- RLBotCS/ManagerTools/QuickChat.cs | 2 +- RLBotCS/ManagerTools/Rendering.cs | 2 +- RLBotCS/RLBotCS.csproj | 2 +- RLBotCS/Server/BridgeContext.cs | 2 +- RLBotCS/Server/BridgeHandler.cs | 2 +- RLBotCS/Server/BridgeMessage/AddRenders.cs | 2 +- RLBotCS/Server/BridgeMessage/EndMatch.cs | 2 +- RLBotCS/Server/BridgeMessage/Input.cs | 2 +- RLBotCS/Server/BridgeMessage/SetGameState.cs | 2 +- .../Server/BridgeMessage/SetInitLoadout.cs | 2 +- RLBotCS/Server/BridgeMessage/ShowQuickChat.cs | 2 +- RLBotCS/Server/BridgeMessage/StartMatch.cs | 2 +- .../Server/BridgeMessage/StateSetLoadout.cs | 2 +- RLBotCS/Server/FlatBuffersSession.cs | 168 ++++++------------ .../ServerMessage/DistributeFieldInfo.cs | 2 +- .../ServerMessage/DistributeGamePacket.cs | 2 +- RLBotCS/Server/ServerMessage/SendMatchComm.cs | 2 +- RLBotCS/Server/ServerMessage/ServerContext.cs | 2 +- RLBotCS/Server/ServerMessage/StartMatch.cs | 2 +- RLBotCS/Server/SocketSpecStreamReader.cs | 59 ------ RLBotCS/Server/SocketSpecStreamWriter.cs | 65 ------- RLBotCS/Server/SpecStreamReader.cs | 48 +++++ RLBotCS/Server/SpecStreamWriter.cs | 58 ++++++ RLBotCS/Types/DataType.cs | 53 ------ RLBotCS/Types/TypedPayload.cs | 21 --- RLBotCSTests/ConfigParserTest.cs | 2 +- RLBotCSTests/ConfigValidatorTest.cs | 2 +- RLBotCSTests/FlatbufferTest.cs | 2 +- RLBotCSTests/GameState.cs | 2 +- flatbuffers-schema | 2 +- generate-flatbuffers.bat | 10 +- generate-flatbuffers.sh | 9 +- 46 files changed, 229 insertions(+), 382 deletions(-) delete mode 100644 RLBotCS/Server/SocketSpecStreamReader.cs delete mode 100644 RLBotCS/Server/SocketSpecStreamWriter.cs create mode 100644 RLBotCS/Server/SpecStreamReader.cs create mode 100644 RLBotCS/Server/SpecStreamWriter.cs delete mode 100644 RLBotCS/Types/DataType.cs delete mode 100644 RLBotCS/Types/TypedPayload.cs diff --git a/RLBotCS/Conversion/FlatToCommand.cs b/RLBotCS/Conversion/FlatToCommand.cs index d439ed0..59b067c 100644 --- a/RLBotCS/Conversion/FlatToCommand.cs +++ b/RLBotCS/Conversion/FlatToCommand.cs @@ -1,5 +1,5 @@ using Microsoft.Extensions.Logging; -using rlbot.flat; +using RLBot.Flat; using RLBotCS.ManagerTools; namespace RLBotCS.Conversion; diff --git a/RLBotCS/Conversion/FlatToModel.cs b/RLBotCS/Conversion/FlatToModel.cs index f4a5edd..e760ea6 100644 --- a/RLBotCS/Conversion/FlatToModel.cs +++ b/RLBotCS/Conversion/FlatToModel.cs @@ -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; @@ -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) diff --git a/RLBotCS/Conversion/GameStateToFlat.cs b/RLBotCS/Conversion/GameStateToFlat.cs index 176b27c..bc59bf3 100644 --- a/RLBotCS/Conversion/GameStateToFlat.cs +++ b/RLBotCS/Conversion/GameStateToFlat.cs @@ -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; @@ -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() diff --git a/RLBotCS/Conversion/PsyonixLoadouts.cs b/RLBotCS/Conversion/PsyonixLoadouts.cs index 726bb4e..327529e 100644 --- a/RLBotCS/Conversion/PsyonixLoadouts.cs +++ b/RLBotCS/Conversion/PsyonixLoadouts.cs @@ -1,5 +1,5 @@ using System.Collections.Frozen; -using rlbot.flat; +using RLBot.Flat; namespace RLBotCS.Conversion; diff --git a/RLBotCS/Main.cs b/RLBotCS/Main.cs index b209b32..e74e4ea 100644 --- a/RLBotCS/Main.cs +++ b/RLBotCS/Main.cs @@ -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); } diff --git a/RLBotCS/ManagerTools/AgentMapping.cs b/RLBotCS/ManagerTools/AgentMapping.cs index 1e71137..0bc4c6b 100644 --- a/RLBotCS/ManagerTools/AgentMapping.cs +++ b/RLBotCS/ManagerTools/AgentMapping.cs @@ -1,4 +1,4 @@ -using rlbot.flat; +using RLBot.Flat; using RLBotCS.Model; namespace RLBotCS.ManagerTools; diff --git a/RLBotCS/ManagerTools/BallPredictor.cs b/RLBotCS/ManagerTools/BallPredictor.cs index 7677d66..ebb66b5 100644 --- a/RLBotCS/ManagerTools/BallPredictor.cs +++ b/RLBotCS/ManagerTools/BallPredictor.cs @@ -1,5 +1,5 @@ using System.Runtime.InteropServices; -using rlbot.flat; +using RLBot.Flat; using RLBotCS.Model; namespace RLBotCS.ManagerTools; diff --git a/RLBotCS/ManagerTools/ConfigParser.cs b/RLBotCS/ManagerTools/ConfigParser.cs index a5df60d..a417518 100644 --- a/RLBotCS/ManagerTools/ConfigParser.cs +++ b/RLBotCS/ManagerTools/ConfigParser.cs @@ -1,7 +1,7 @@ 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; diff --git a/RLBotCS/ManagerTools/ConfigValidator.cs b/RLBotCS/ManagerTools/ConfigValidator.cs index 193b485..36b61e0 100644 --- a/RLBotCS/ManagerTools/ConfigValidator.cs +++ b/RLBotCS/ManagerTools/ConfigValidator.cs @@ -1,5 +1,5 @@ using Microsoft.Extensions.Logging; -using rlbot.flat; +using RLBot.Flat; using RLBotCS.Conversion; using RLBotCS.Model; diff --git a/RLBotCS/ManagerTools/LaunchManager.cs b/RLBotCS/ManagerTools/LaunchManager.cs index 4bcf08b..b0dc231 100644 --- a/RLBotCS/ManagerTools/LaunchManager.cs +++ b/RLBotCS/ManagerTools/LaunchManager.cs @@ -154,7 +154,7 @@ private static void LaunchGameViaHeroic() } public static void LaunchBots( - List bots, + List bots, int rlbotSocketsPort ) { @@ -199,7 +199,7 @@ int rlbotSocketsPort } public static void LaunchScripts( - List scripts, + List scripts, int rlbotSocketsPort ) { @@ -246,7 +246,7 @@ int rlbotSocketsPort } public static void LaunchRocketLeague( - rlbot.flat.Launcher launcherPref, + RLBot.Flat.Launcher launcherPref, string extraArg, int gamePort ) @@ -254,7 +254,7 @@ 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; @@ -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 @@ -333,7 +333,7 @@ int gamePort }).Start(); break; - case rlbot.flat.Launcher.Custom: + case RLBot.Flat.Launcher.Custom: if (extraArg.ToLower() == "legendary") { LaunchGameViaLegendary(); @@ -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; @@ -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(); @@ -381,7 +381,7 @@ int gamePort } throw new NotSupportedException($"Unexpected launcher, \"{extraArg}\""); - case rlbot.flat.Launcher.NoLaunch: + case RLBot.Flat.Launcher.NoLaunch: break; } #endif diff --git a/RLBotCS/ManagerTools/Logging.cs b/RLBotCS/ManagerTools/Logging.cs index 9db7d97..f39c364 100644 --- a/RLBotCS/ManagerTools/Logging.cs +++ b/RLBotCS/ManagerTools/Logging.cs @@ -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; } diff --git a/RLBotCS/ManagerTools/MatchStarter.cs b/RLBotCS/ManagerTools/MatchStarter.cs index 976ffb9..a664d7d 100644 --- a/RLBotCS/ManagerTools/MatchStarter.cs +++ b/RLBotCS/ManagerTools/MatchStarter.cs @@ -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; @@ -36,6 +36,7 @@ class MatchStarter(int gamePort, int rlbotSocketsPort) public void ResetMatchStarting() { + Logger.LogDebug("Reset MatchStarter"); _deferredMatchConfig = null; _matchConfig = null; HasSpawnedMap = false; diff --git a/RLBotCS/ManagerTools/PerfMonitor.cs b/RLBotCS/ManagerTools/PerfMonitor.cs index d25b02c..f8bec8c 100644 --- a/RLBotCS/ManagerTools/PerfMonitor.cs +++ b/RLBotCS/ManagerTools/PerfMonitor.cs @@ -1,5 +1,5 @@ using Bridge.State; -using rlbot.flat; +using RLBot.Flat; namespace RLBotCS.ManagerTools; diff --git a/RLBotCS/ManagerTools/PlayerSpawner.cs b/RLBotCS/ManagerTools/PlayerSpawner.cs index 66982a4..525438c 100644 --- a/RLBotCS/ManagerTools/PlayerSpawner.cs +++ b/RLBotCS/ManagerTools/PlayerSpawner.cs @@ -2,7 +2,7 @@ using Bridge.Models.Command; using Bridge.Models.Message; using Bridge.State; -using rlbot.flat; +using RLBot.Flat; using RLBotCS.Conversion; namespace RLBotCS.ManagerTools; diff --git a/RLBotCS/ManagerTools/QuickChat.cs b/RLBotCS/ManagerTools/QuickChat.cs index 51c4d25..b0243ed 100644 --- a/RLBotCS/ManagerTools/QuickChat.cs +++ b/RLBotCS/ManagerTools/QuickChat.cs @@ -1,5 +1,5 @@ using Bridge.State; -using rlbot.flat; +using RLBot.Flat; using RLBotCS.Model; namespace RLBotCS.ManagerTools; diff --git a/RLBotCS/ManagerTools/Rendering.cs b/RLBotCS/ManagerTools/Rendering.cs index 241ba40..6382a51 100644 --- a/RLBotCS/ManagerTools/Rendering.cs +++ b/RLBotCS/ManagerTools/Rendering.cs @@ -2,7 +2,7 @@ using Bridge.Controller; using Bridge.State; using Bridge.TCP; -using rlbot.flat; +using RLBot.Flat; using RLBotCS.Conversion; using Color = System.Drawing.Color; diff --git a/RLBotCS/RLBotCS.csproj b/RLBotCS/RLBotCS.csproj index bf394bb..69b1dc6 100644 --- a/RLBotCS/RLBotCS.csproj +++ b/RLBotCS/RLBotCS.csproj @@ -64,7 +64,7 @@ - + diff --git a/RLBotCS/Server/BridgeContext.cs b/RLBotCS/Server/BridgeContext.cs index a3a6d33..ad18703 100644 --- a/RLBotCS/Server/BridgeContext.cs +++ b/RLBotCS/Server/BridgeContext.cs @@ -3,7 +3,7 @@ using Bridge.State; using Bridge.TCP; using Microsoft.Extensions.Logging; -using rlbot.flat; +using RLBot.Flat; using RLBotCS.ManagerTools; using RLBotCS.Server.BridgeMessage; using RLBotCS.Server.ServerMessage; diff --git a/RLBotCS/Server/BridgeHandler.cs b/RLBotCS/Server/BridgeHandler.cs index 3d71073..66303de 100644 --- a/RLBotCS/Server/BridgeHandler.cs +++ b/RLBotCS/Server/BridgeHandler.cs @@ -2,7 +2,7 @@ using Bridge.Conversion; using Bridge.TCP; using Microsoft.Extensions.Logging; -using rlbot.flat; +using RLBot.Flat; using RLBotCS.Conversion; using RLBotCS.ManagerTools; using RLBotCS.Server.BridgeMessage; diff --git a/RLBotCS/Server/BridgeMessage/AddRenders.cs b/RLBotCS/Server/BridgeMessage/AddRenders.cs index df5d7c9..5e478fe 100644 --- a/RLBotCS/Server/BridgeMessage/AddRenders.cs +++ b/RLBotCS/Server/BridgeMessage/AddRenders.cs @@ -1,4 +1,4 @@ -using rlbot.flat; +using RLBot.Flat; namespace RLBotCS.Server.BridgeMessage; diff --git a/RLBotCS/Server/BridgeMessage/EndMatch.cs b/RLBotCS/Server/BridgeMessage/EndMatch.cs index 58f5259..290314f 100644 --- a/RLBotCS/Server/BridgeMessage/EndMatch.cs +++ b/RLBotCS/Server/BridgeMessage/EndMatch.cs @@ -1,4 +1,4 @@ -namespace RLBotCS.Server.BridgeMessage; +namespace RLBotCS.Server.BridgeMessage; record EndMatch() : IBridgeMessage { diff --git a/RLBotCS/Server/BridgeMessage/Input.cs b/RLBotCS/Server/BridgeMessage/Input.cs index 5455e9f..e0bfdc0 100644 --- a/RLBotCS/Server/BridgeMessage/Input.cs +++ b/RLBotCS/Server/BridgeMessage/Input.cs @@ -1,5 +1,5 @@ using Microsoft.Extensions.Logging; -using rlbot.flat; +using RLBot.Flat; using RLBotCS.Conversion; using PlayerInput = Bridge.Models.Control.PlayerInput; diff --git a/RLBotCS/Server/BridgeMessage/SetGameState.cs b/RLBotCS/Server/BridgeMessage/SetGameState.cs index e77e854..a006b07 100644 --- a/RLBotCS/Server/BridgeMessage/SetGameState.cs +++ b/RLBotCS/Server/BridgeMessage/SetGameState.cs @@ -1,4 +1,4 @@ -using rlbot.flat; +using RLBot.Flat; using RLBotCS.Conversion; namespace RLBotCS.Server.BridgeMessage; diff --git a/RLBotCS/Server/BridgeMessage/SetInitLoadout.cs b/RLBotCS/Server/BridgeMessage/SetInitLoadout.cs index cf7d226..8d24a45 100644 --- a/RLBotCS/Server/BridgeMessage/SetInitLoadout.cs +++ b/RLBotCS/Server/BridgeMessage/SetInitLoadout.cs @@ -1,5 +1,5 @@ using Microsoft.Extensions.Logging; -using rlbot.flat; +using RLBot.Flat; namespace RLBotCS.Server.BridgeMessage; diff --git a/RLBotCS/Server/BridgeMessage/ShowQuickChat.cs b/RLBotCS/Server/BridgeMessage/ShowQuickChat.cs index 2957eac..fbed66e 100644 --- a/RLBotCS/Server/BridgeMessage/ShowQuickChat.cs +++ b/RLBotCS/Server/BridgeMessage/ShowQuickChat.cs @@ -1,4 +1,4 @@ -using rlbot.flat; +using RLBot.Flat; namespace RLBotCS.Server.BridgeMessage; diff --git a/RLBotCS/Server/BridgeMessage/StartMatch.cs b/RLBotCS/Server/BridgeMessage/StartMatch.cs index dd2168e..f7db8c9 100644 --- a/RLBotCS/Server/BridgeMessage/StartMatch.cs +++ b/RLBotCS/Server/BridgeMessage/StartMatch.cs @@ -1,4 +1,4 @@ -using rlbot.flat; +using RLBot.Flat; using RLBotCS.Server.ServerMessage; namespace RLBotCS.Server.BridgeMessage; diff --git a/RLBotCS/Server/BridgeMessage/StateSetLoadout.cs b/RLBotCS/Server/BridgeMessage/StateSetLoadout.cs index b2453a9..bbe78b0 100644 --- a/RLBotCS/Server/BridgeMessage/StateSetLoadout.cs +++ b/RLBotCS/Server/BridgeMessage/StateSetLoadout.cs @@ -2,7 +2,7 @@ using Bridge.Models.Message; using Bridge.State; using Microsoft.Extensions.Logging; -using rlbot.flat; +using RLBot.Flat; using RLBotCS.Conversion; namespace RLBotCS.Server.BridgeMessage; diff --git a/RLBotCS/Server/FlatBuffersSession.cs b/RLBotCS/Server/FlatBuffersSession.cs index 25b32e5..d2aa983 100644 --- a/RLBotCS/Server/FlatBuffersSession.cs +++ b/RLBotCS/Server/FlatBuffersSession.cs @@ -2,12 +2,11 @@ using System.Threading.Channels; using Google.FlatBuffers; using Microsoft.Extensions.Logging; -using rlbot.flat; +using RLBot.Flat; using RLBotCS.ManagerTools; using RLBotCS.Model; using RLBotCS.Server.BridgeMessage; using RLBotCS.Server.ServerMessage; -using RLBotCS.Types; using StartMatch = RLBotCS.Server.ServerMessage.StartMatch; namespace RLBotCS.Server; @@ -42,8 +41,8 @@ class FlatBuffersSession private readonly TcpClient _client; private readonly int _clientId; - private readonly SocketSpecStreamReader _socketSpecReader; - private readonly SocketSpecStreamWriter _socketSpecWriter; + private readonly SpecStreamReader _socketSpecReader; + private readonly SpecStreamWriter _socketSpecWriter; private readonly Channel _incomingMessages; private readonly ChannelWriter _rlbotServer; @@ -72,8 +71,6 @@ class FlatBuffersSession private bool _sessionForceClosed; private bool _closed; - private readonly FlatBufferBuilder _messageBuilder = new(1 << 10); - public string ClientName => _agentId != "" ? $"client {_clientId} (index {string.Join("+", _playerIdPairs.Select(p => p.Index))}, team {_team}, aid {_agentId})" @@ -98,22 +95,27 @@ bool stateSettingIsEnabled _stateSettingIsEnabled = stateSettingIsEnabled; NetworkStream stream = _client.GetStream(); - _socketSpecReader = new SocketSpecStreamReader(stream); - _socketSpecWriter = new SocketSpecStreamWriter(stream); + _socketSpecReader = new SpecStreamReader(stream); + _socketSpecWriter = new SpecStreamWriter(stream); } - private async Task ParseClientMessage(TypedPayload message) + private async Task ParseClientMessage(InterfacePacket msg) { - ByteBuffer byteBuffer = new(message.Payload.Array, message.Payload.Offset); - - switch (message.Type) + switch (msg.MessageType) { - case DataType.None: + case InterfaceMessage.NONE: + Logger.LogError( + $"Received a message with type NONE from {ClientName}. " + + "Something has gone very wrong. Disconnecting." + ); + return false; + + case InterfaceMessage.DisconnectSignal: // The client requested that we close the connection return false; - case DataType.ConnectionSettings when !_connectionEstablished: - var readyMsg = ConnectionSettings.GetRootAsConnectionSettings(byteBuffer); + case InterfaceMessage.ConnectionSettings when !_connectionEstablished: + var readyMsg = msg.MessageAsConnectionSettings(); _agentId = readyMsg.AgentId ?? ""; _wantsBallPredictions = readyMsg.WantsBallPredictions; @@ -136,11 +138,11 @@ await _rlbotServer.WriteAsync( _connectionEstablished = true; break; - case DataType.SetLoadout when _connectionEstablished: + case InterfaceMessage.SetLoadout when _connectionEstablished: if (_isReady && !_stateSettingIsEnabled) break; - var setLoadout = SetLoadout.GetRootAsSetLoadout(byteBuffer).UnPack(); + var setLoadout = msg.MessageAsSetLoadout().UnPack(); if (_isReady) { @@ -177,7 +179,7 @@ await _bridge.WriteAsync( break; - case DataType.InitComplete when _connectionEstablished && !_isReady: + case InterfaceMessage.InitComplete when _connectionEstablished && !_isReady: if (_closeBetweenMatches) { await _bridge.WriteAsync(new SessionReady(_clientId)); @@ -187,13 +189,13 @@ await _bridge.WriteAsync( _isReady = true; break; - case DataType.StopCommand: - var stopCommand = StopCommand.GetRootAsStopCommand(byteBuffer); + case InterfaceMessage.StopCommand: + var stopCommand = msg.MessageAsStopCommand(); await _rlbotServer.WriteAsync(new StopMatch(stopCommand.ShutdownServer)); break; - case DataType.StartCommand: - var startCommand = StartCommand.GetRootAsStartCommand(byteBuffer); + case InterfaceMessage.StartCommand: + var startCommand = msg.MessageAsStartCommand(); var parser = new ConfigParser(); if ( parser.TryLoadMatchConfig(startCommand.ConfigPath, out var tomlMatchConfig) @@ -204,18 +206,16 @@ await _bridge.WriteAsync( } break; - case DataType.MatchConfig: - var matchConfig = MatchConfiguration - .GetRootAsMatchConfiguration(byteBuffer) - .UnPack(); + case InterfaceMessage.MatchConfiguration: + var matchConfig = msg.MessageAsMatchConfiguration().UnPack(); if (ConfigValidator.Validate(matchConfig)) { await _rlbotServer.WriteAsync(new StartMatch(matchConfig)); } break; - case DataType.PlayerInput when _connectionEstablished: - var playerInputMsg = PlayerInput.GetRootAsPlayerInput(byteBuffer).UnPack(); + case InterfaceMessage.PlayerInput when _connectionEstablished: + var playerInputMsg = msg.MessageAsPlayerInput().UnPack(); // ensure the provided index is a bot we control if ( @@ -238,8 +238,8 @@ await _bridge.WriteAsync( await _bridge.WriteAsync(new Input(playerInputMsg)); break; - case DataType.MatchComms: - var matchComms = MatchComm.GetRootAsMatchComm(byteBuffer).UnPack(); + case InterfaceMessage.MatchComm: + var matchComms = msg.MessageAsMatchComm().UnPack(); if (_agentId != "") { @@ -274,53 +274,39 @@ await _rlbotServer.WriteAsync( break; - case DataType.RenderGroup: + case InterfaceMessage.RenderGroup: if (!_renderingIsEnabled) break; - var renderingGroup = RenderGroup.GetRootAsRenderGroup(byteBuffer).UnPack(); + var renderingGroup = msg.MessageAsRenderGroup().UnPack(); await _bridge.WriteAsync( new AddRenders(_clientId, renderingGroup.Id, renderingGroup.RenderMessages) ); break; - case DataType.RemoveRenderGroup: + case InterfaceMessage.RemoveRenderGroup: if (!_renderingIsEnabled) break; - var removeRenderGroup = RemoveRenderGroup.GetRootAsRemoveRenderGroup( - byteBuffer - ); + var removeRenderGroup = msg.MessageAsRemoveRenderGroup(); await _bridge.WriteAsync(new RemoveRenders(_clientId, removeRenderGroup.Id)); break; - case DataType.DesiredGameState: + case InterfaceMessage.DesiredGameState: if (!_stateSettingIsEnabled) break; - var desiredGameState = DesiredGameState - .GetRootAsDesiredGameState(byteBuffer) - .UnPack(); + var desiredGameState = msg.MessageAsDesiredGameState().UnPack(); await _bridge.WriteAsync(new SetGameState(desiredGameState)); break; - - case DataType.GamePacket: - case DataType.FieldInfo: - case DataType.BallPrediction: - default: - Logger.LogError( - $"Core got unexpected message type {message.Type} from client. " - + $"Got ConnectionSettings: {_connectionEstablished}." - ); - break; } return true; } - private void SendPayloadToClient(TypedPayload payload) + private void SendPayloadToClient(CoreMessageUnion payload) { try { @@ -345,37 +331,22 @@ private async Task HandleInternalMessages() switch (message) { case SessionMessage.FieldInfo m: - _messageBuilder.Clear(); - _messageBuilder.Finish(FieldInfo.Pack(_messageBuilder, m.Info).Value); - - SendPayloadToClient( - TypedPayload.FromFlatBufferBuilder(DataType.FieldInfo, _messageBuilder) - ); + SendPayloadToClient(CoreMessageUnion.FromFieldInfo(m.Info)); break; case SessionMessage.MatchConfig m: - _messageBuilder.Clear(); - _messageBuilder.Finish( - MatchConfiguration.Pack(_messageBuilder, m.Config).Value - ); - - SendPayloadToClient( - TypedPayload.FromFlatBufferBuilder( - DataType.MatchConfig, - _messageBuilder - ) - ); + SendPayloadToClient(CoreMessageUnion.FromMatchConfiguration(m.Config)); break; case SessionMessage.PlayerIdPairs m: _team = m.Team; _playerIdPairs = m.IdMaps; - List controllables = new( - _playerIdPairs.Select(playerInfo => new ControllableInfoT() + List controllables = _playerIdPairs + .Select(playerInfo => new ControllableInfoT() { Index = playerInfo.Index, SpawnId = playerInfo.SpawnId, }) - ); + .ToList(); ControllableTeamInfoT playerMappings = new() { @@ -383,16 +354,8 @@ private async Task HandleInternalMessages() Controllables = controllables, }; - _messageBuilder.Clear(); - _messageBuilder.Finish( - ControllableTeamInfo.Pack(_messageBuilder, playerMappings).Value - ); - SendPayloadToClient( - TypedPayload.FromFlatBufferBuilder( - DataType.ControllableTeamInfo, - _messageBuilder - ) + CoreMessageUnion.FromControllableTeamInfo(playerMappings) ); Logger.LogDebug("Reserved agents for {}", ClientName); @@ -400,30 +363,10 @@ private async Task HandleInternalMessages() break; case SessionMessage.DistributeBallPrediction m when _isReady && _wantsBallPredictions: - _messageBuilder.Clear(); - _messageBuilder.Finish( - BallPrediction.Pack(_messageBuilder, m.BallPrediction).Value - ); - - SendPayloadToClient( - TypedPayload.FromFlatBufferBuilder( - DataType.BallPrediction, - _messageBuilder - ) - ); + SendPayloadToClient(CoreMessageUnion.FromBallPrediction(m.BallPrediction)); break; case SessionMessage.DistributeGameState m when _isReady: - _messageBuilder.Clear(); - _messageBuilder.Finish( - GamePacket.Pack(_messageBuilder, m.GameState).Value - ); - - SendPayloadToClient( - TypedPayload.FromFlatBufferBuilder( - DataType.GamePacket, - _messageBuilder - ) - ); + SendPayloadToClient(CoreMessageUnion.FromGamePacket(m.GameState)); foreach (var (index, gotInput) in _gotInput) { @@ -453,15 +396,7 @@ private async Task HandleInternalMessages() } } - _messageBuilder.Clear(); - _messageBuilder.Finish(MatchComm.Pack(_messageBuilder, m.Message).Value); - - SendPayloadToClient( - TypedPayload.FromFlatBufferBuilder( - DataType.MatchComms, - _messageBuilder - ) - ); + SendPayloadToClient(CoreMessageUnion.FromMatchComm(m.Message)); break; case SessionMessage.StopMatch m @@ -473,7 +408,7 @@ private async Task HandleInternalMessages() private async Task HandleClientMessages() { - await foreach (TypedPayload message in _socketSpecReader.ReadAllAsync()) + await foreach (InterfacePacket message in _socketSpecReader.ReadAllAsync()) { // if the session is closed, ignore any incoming messages // this should allow the client to close cleanly @@ -528,12 +463,9 @@ public void Cleanup() // try to politely close the connection try { - TypedPayload msg = new() - { - Type = DataType.None, - Payload = new ArraySegment([1]), - }; - SendPayloadToClient(msg); + SendPayloadToClient( + CoreMessageUnion.FromDisconnectSignal(new DisconnectSignalT()) + ); } catch (Exception) { diff --git a/RLBotCS/Server/ServerMessage/DistributeFieldInfo.cs b/RLBotCS/Server/ServerMessage/DistributeFieldInfo.cs index e2c163f..6647178 100644 --- a/RLBotCS/Server/ServerMessage/DistributeFieldInfo.cs +++ b/RLBotCS/Server/ServerMessage/DistributeFieldInfo.cs @@ -1,5 +1,5 @@ using Bridge.State; -using rlbot.flat; +using RLBot.Flat; using GoalInfo = Bridge.Packet.GoalInfo; namespace RLBotCS.Server.ServerMessage; diff --git a/RLBotCS/Server/ServerMessage/DistributeGamePacket.cs b/RLBotCS/Server/ServerMessage/DistributeGamePacket.cs index 91eb6f3..33d9268 100644 --- a/RLBotCS/Server/ServerMessage/DistributeGamePacket.cs +++ b/RLBotCS/Server/ServerMessage/DistributeGamePacket.cs @@ -1,4 +1,4 @@ -using rlbot.flat; +using RLBot.Flat; using RLBotCS.ManagerTools; namespace RLBotCS.Server.ServerMessage; diff --git a/RLBotCS/Server/ServerMessage/SendMatchComm.cs b/RLBotCS/Server/ServerMessage/SendMatchComm.cs index 13dd2ea..11ff10c 100644 --- a/RLBotCS/Server/ServerMessage/SendMatchComm.cs +++ b/RLBotCS/Server/ServerMessage/SendMatchComm.cs @@ -1,5 +1,5 @@ using Microsoft.Extensions.Logging; -using rlbot.flat; +using RLBot.Flat; namespace RLBotCS.Server.ServerMessage; diff --git a/RLBotCS/Server/ServerMessage/ServerContext.cs b/RLBotCS/Server/ServerMessage/ServerContext.cs index 8b43e95..2af005f 100644 --- a/RLBotCS/Server/ServerMessage/ServerContext.cs +++ b/RLBotCS/Server/ServerMessage/ServerContext.cs @@ -1,7 +1,7 @@ using System.Net.Sockets; using System.Threading.Channels; using Microsoft.Extensions.Logging; -using rlbot.flat; +using RLBot.Flat; using RLBotCS.ManagerTools; using RLBotCS.Server.BridgeMessage; diff --git a/RLBotCS/Server/ServerMessage/StartMatch.cs b/RLBotCS/Server/ServerMessage/StartMatch.cs index 0219a57..9e453ba 100644 --- a/RLBotCS/Server/ServerMessage/StartMatch.cs +++ b/RLBotCS/Server/ServerMessage/StartMatch.cs @@ -1,5 +1,5 @@ using System.Diagnostics; -using rlbot.flat; +using RLBot.Flat; using RLBotCS.ManagerTools; using RLBotCS.Server.BridgeMessage; diff --git a/RLBotCS/Server/SocketSpecStreamReader.cs b/RLBotCS/Server/SocketSpecStreamReader.cs deleted file mode 100644 index 5b206f2..0000000 --- a/RLBotCS/Server/SocketSpecStreamReader.cs +++ /dev/null @@ -1,59 +0,0 @@ -using System.Net.Sockets; -using RLBotCS.Types; - -namespace RLBotCS.Server; - -/** - * https://wiki.rlbot.org/framework/sockets-specification/ - */ -class SocketSpecStreamReader -{ - private BufferedStream _bufferedStream; - private byte[] _ushortReader = new byte[2]; - private byte[] _payloadReader = new byte[ushort.MaxValue]; - - public SocketSpecStreamReader(NetworkStream stream) - { - _bufferedStream = new BufferedStream(stream, 4 + ushort.MaxValue); - } - - internal async IAsyncEnumerable ReadAllAsync() - { - while (true) - { - DataType dataType; - ushort payloadSize; - - try - { - await _bufferedStream.ReadExactlyAsync(_ushortReader); - dataType = ReadDataType(_ushortReader); - - await _bufferedStream.ReadExactlyAsync(_ushortReader); - payloadSize = ReadPayloadSize(_ushortReader); - - await _bufferedStream.ReadExactlyAsync(_payloadReader, 0, payloadSize); - } - catch (Exception) - { - break; - } - - yield return new() - { - Type = dataType, - Payload = new(_payloadReader, 0, payloadSize), - }; - } - } - - private static DataType ReadDataType(Span bytes) - { - return (DataType)((bytes[0] << 8) | bytes[1]); - } - - private static ushort ReadPayloadSize(Span bytes) - { - return (ushort)((bytes[0] << 8) | bytes[1]); - } -} diff --git a/RLBotCS/Server/SocketSpecStreamWriter.cs b/RLBotCS/Server/SocketSpecStreamWriter.cs deleted file mode 100644 index 6f51ce9..0000000 --- a/RLBotCS/Server/SocketSpecStreamWriter.cs +++ /dev/null @@ -1,65 +0,0 @@ -using Microsoft.Extensions.Logging; -using RLBotCS.ManagerTools; -using RLBotCS.Types; - -namespace RLBotCS.Server; - -/** - * Communicates with bots and scripts over TCP according to the spec - * defined at https://wiki.rlbot.org/framework/sockets-specification/ - */ -class SocketSpecStreamWriter(Stream stream) -{ - private static readonly ILogger Logger = Logging.GetLogger("SocketSpecStreamWriter"); - - private readonly byte[] _dataTypeBuffer = new byte[2]; - private readonly byte[] _messageLengthBuffer = new byte[2]; - private readonly byte[] _messageBuffer = new byte[4 + ushort.MaxValue]; - - private void PrepareMessageLength(ushort length) => - WriteBigEndian(length, _messageLengthBuffer); - - private void PrepareDataType(DataType dataType) => - WriteBigEndian((ushort)dataType, _dataTypeBuffer); - - private static void WriteBigEndian(ushort value, byte[] buffer) - { - buffer[0] = (byte)((value >> 8) & 0xFF); - buffer[1] = (byte)(value & 0xFF); - } - - internal void Write(TypedPayload message) - { - if (message.Payload.Count > ushort.MaxValue) - { - // Can't send if the message size is bigger than our header can describe. - Logger.LogError( - $"Cannot send message because size of {message.Payload.Count} cannot be described by a ushort." - ); - return; - } - - if (message.Payload.Count == 0 || message.Payload.Array == null) - { - Logger.LogWarning("Cannot send an empty message."); - return; - } - - PrepareDataType(message.Type); - PrepareMessageLength((ushort)message.Payload.Count); - - Array.Copy(_dataTypeBuffer, 0, _messageBuffer, 0, 2); - Array.Copy(_messageLengthBuffer, 0, _messageBuffer, 2, 2); - Array.Copy( - message.Payload.Array, - message.Payload.Offset, - _messageBuffer, - 4, - message.Payload.Count - ); - - stream.Write(_messageBuffer, 0, 4 + message.Payload.Count); - } - - internal void Send() => stream.Flush(); -} diff --git a/RLBotCS/Server/SpecStreamReader.cs b/RLBotCS/Server/SpecStreamReader.cs new file mode 100644 index 0000000..d5a2eb1 --- /dev/null +++ b/RLBotCS/Server/SpecStreamReader.cs @@ -0,0 +1,48 @@ +using System.Net.Sockets; +using Google.FlatBuffers; +using RLBot.Flat; + +namespace RLBotCS.Server; + +/** + * https://wiki.rlbot.org/framework/sockets-specification/ + */ +class SpecStreamReader +{ + private BufferedStream _bufferedStream; + private byte[] _ushortReader = new byte[2]; + private byte[] _payloadReader = new byte[ushort.MaxValue]; + + public SpecStreamReader(NetworkStream stream) + { + _bufferedStream = new BufferedStream(stream, 2 + ushort.MaxValue); + } + + internal async IAsyncEnumerable ReadAllAsync() + { + while (true) + { + ushort payloadSize; + + try + { + await _bufferedStream.ReadExactlyAsync(_ushortReader); + payloadSize = ReadBigEndian(_ushortReader); + + await _bufferedStream.ReadExactlyAsync(_payloadReader, 0, payloadSize); + } + catch (Exception) + { + break; + } + + ByteBuffer byteBuffer = new(_payloadReader, 0); + yield return InterfacePacket.GetRootAsInterfacePacket(byteBuffer); + } + } + + private static ushort ReadBigEndian(Span bytes) + { + return (ushort)((bytes[0] << 8) | bytes[1]); + } +} diff --git a/RLBotCS/Server/SpecStreamWriter.cs b/RLBotCS/Server/SpecStreamWriter.cs new file mode 100644 index 0000000..94e3366 --- /dev/null +++ b/RLBotCS/Server/SpecStreamWriter.cs @@ -0,0 +1,58 @@ +using Google.FlatBuffers; +using Microsoft.Extensions.Logging; +using RLBot.Flat; +using RLBotCS.ManagerTools; + +namespace RLBotCS.Server; + +/** + * Communicates with bots and scripts over TCP according to the spec + * defined at https://wiki.rlbot.org/framework/sockets-specification/ + */ +class SpecStreamWriter(Stream stream) +{ + private static readonly ILogger Logger = Logging.GetLogger("SpecStreamWriter"); + + private readonly FlatBufferBuilder _messageBuilder = new(1 << 12); + private readonly byte[] _messageBuffer = new byte[2 + ushort.MaxValue]; + + private static void WriteBigEndian(ushort value, byte[] buffer) + { + buffer[0] = (byte)((value >> 8) & 0xFF); + buffer[1] = (byte)(value & 0xFF); + } + + internal void Write(CoreMessageUnion message) + { + var packet = new CorePacketT { Message = message }; + + _messageBuilder.Clear(); + _messageBuilder.Finish(CorePacket.Pack(_messageBuilder, packet).Value); + ArraySegment payload = _messageBuilder.DataBuffer.ToArraySegment( + _messageBuilder.DataBuffer.Position, + _messageBuilder.DataBuffer.Length - _messageBuilder.DataBuffer.Position + ); + + if (payload.Count > ushort.MaxValue) + { + // Can't send if the message size is bigger than our header can describe. + Logger.LogError( + $"Cannot send message because size of {payload.Count} cannot be described by a ushort." + ); + return; + } + + if (payload.Count == 0 || payload.Array == null) + { + Logger.LogWarning("Cannot send an empty message."); + return; + } + + WriteBigEndian((ushort)payload.Count, _messageBuffer); + Array.Copy(payload.Array, payload.Offset, _messageBuffer, 2, payload.Count); + + stream.Write(_messageBuffer, 0, 2 + payload.Count); + } + + internal void Send() => stream.Flush(); +} diff --git a/RLBotCS/Types/DataType.cs b/RLBotCS/Types/DataType.cs deleted file mode 100644 index 8fbba68..0000000 --- a/RLBotCS/Types/DataType.cs +++ /dev/null @@ -1,53 +0,0 @@ -namespace RLBotCS.Types; - -/** - * https://wiki.rlbot.org/framework/sockets-specification/#data-types - */ -public enum DataType : ushort -{ - None, - - /// - /// Arrives at a high rate according to https://wiki.rlbot.org/botmaking/tick-rate/ except - /// "desired tick rate" is not relevant here - /// - GamePacket, - - /// - /// Sent once when a match starts, or when you first connect. - /// - FieldInfo, - - /// - /// Sent once when a match starts, or when you first connect. - /// - StartCommand, - MatchConfig, - PlayerInput, - DesiredGameState, - RenderGroup, - RemoveRenderGroup, - MatchComms, - BallPrediction, - - /// - /// Clients must send this after connecting to the socket. - /// - ConnectionSettings, - - /// - /// used to end a match and shut down bots (optionally the server as well) - /// - StopCommand, - - /// - /// Use to dynamically set the loadout of a bot - /// - SetLoadout, - - /// - /// Indicates that a connection is ready to receive `GameTickPacket`s - /// - InitComplete, - ControllableTeamInfo, -} diff --git a/RLBotCS/Types/TypedPayload.cs b/RLBotCS/Types/TypedPayload.cs deleted file mode 100644 index abd8f65..0000000 --- a/RLBotCS/Types/TypedPayload.cs +++ /dev/null @@ -1,21 +0,0 @@ -using Google.FlatBuffers; - -namespace RLBotCS.Types; - -public class TypedPayload -{ - public DataType Type; - public ArraySegment Payload; - - public static TypedPayload FromFlatBufferBuilder(DataType type, FlatBufferBuilder builder) - { - return new TypedPayload - { - Type = type, - Payload = builder.DataBuffer.ToArraySegment( - builder.DataBuffer.Position, - builder.DataBuffer.Length - builder.DataBuffer.Position - ), - }; - } -} diff --git a/RLBotCSTests/ConfigParserTest.cs b/RLBotCSTests/ConfigParserTest.cs index cdfa766..af11636 100644 --- a/RLBotCSTests/ConfigParserTest.cs +++ b/RLBotCSTests/ConfigParserTest.cs @@ -1,7 +1,7 @@ using System; using System.IO; using Microsoft.VisualStudio.TestTools.UnitTesting; -using rlbot.flat; +using RLBot.Flat; using RLBotCS.ManagerTools; namespace RLBotCSTests; diff --git a/RLBotCSTests/ConfigValidatorTest.cs b/RLBotCSTests/ConfigValidatorTest.cs index 3ed71b8..4ebb068 100644 --- a/RLBotCSTests/ConfigValidatorTest.cs +++ b/RLBotCSTests/ConfigValidatorTest.cs @@ -1,5 +1,5 @@ using Microsoft.VisualStudio.TestTools.UnitTesting; -using rlbot.flat; +using RLBot.Flat; using RLBotCS.ManagerTools; namespace RLBotCSTests; diff --git a/RLBotCSTests/FlatbufferTest.cs b/RLBotCSTests/FlatbufferTest.cs index 9eaad04..2935f49 100644 --- a/RLBotCSTests/FlatbufferTest.cs +++ b/RLBotCSTests/FlatbufferTest.cs @@ -3,7 +3,7 @@ using System.Linq; using Google.FlatBuffers; using Microsoft.VisualStudio.TestTools.UnitTesting; -using rlbot.flat; +using RLBot.Flat; namespace RLBotCSTests; diff --git a/RLBotCSTests/GameState.cs b/RLBotCSTests/GameState.cs index 9b7f8d1..0e843d4 100644 --- a/RLBotCSTests/GameState.cs +++ b/RLBotCSTests/GameState.cs @@ -2,7 +2,7 @@ using Bridge.State; using Google.FlatBuffers; using Microsoft.VisualStudio.TestTools.UnitTesting; -using rlbot.flat; +using RLBot.Flat; using RLBotCS.Conversion; namespace RLBotCSTests; diff --git a/flatbuffers-schema b/flatbuffers-schema index 805c3cb..478c5a8 160000 --- a/flatbuffers-schema +++ b/flatbuffers-schema @@ -1 +1 @@ -Subproject commit 805c3cb5f0cd8aa13b940d98f9af59914aab0012 +Subproject commit 478c5a8a0607c244543df790f66c9006bc53b035 diff --git a/generate-flatbuffers.bat b/generate-flatbuffers.bat index e508125..9003582 100644 --- a/generate-flatbuffers.bat +++ b/generate-flatbuffers.bat @@ -4,11 +4,15 @@ cd /D "%~dp0" echo Generating flatbuffers header file... -.\flatbuffers-schema\flatc.exe --csharp --gen-all --gen-object-api --gen-onefile -o .\FlatBuffer .\flatbuffers-schema\rlbot.fbs +.\flatbuffers-schema\binaries\flatc.exe --csharp --gen-all --gen-object-api --gen-onefile -o .\FlatBuffer .\flatbuffers-schema\schema\rlbot.fbs IF EXIST .\FlatBuffer\rlbot.cs del .\FlatBuffer\rlbot.cs -REM the file produced is called rlbot_generated.cs, rename it to rlbot.cs after removing the old one -ren .\FlatBuffer\rlbot_generated.cs rlbot.cs +REM the file produced is called rlbot_generated.cs, rename it to RLBot.cs after removing the old one +ren .\FlatBuffer\rlbot_generated.cs RLBot.cs + +REM CMD doesn't have native text replacement tools, use PowerShell +REM Replaces 'rlbot.flat' with 'RLBot.Flat' +powershell -Command "(Get-Content .\FlatBuffer\RLBot.cs) -replace 'rlbot\.flat', 'RLBot.Flat' | Set-Content .\FlatBuffer\RLBot.cs" echo Done. \ No newline at end of file diff --git a/generate-flatbuffers.sh b/generate-flatbuffers.sh index 75e920a..d69dd77 100755 --- a/generate-flatbuffers.sh +++ b/generate-flatbuffers.sh @@ -2,10 +2,11 @@ cd "$(dirname "$0")" echo Generating flatbuffers header file... -./flatbuffers-schema/flatc --gen-all --csharp --gen-object-api --gen-onefile -o ./FlatBuffer ./flatbuffers-schema/rlbot.fbs +./flatbuffers-schema/binaries/flatc --gen-all --csharp --gen-object-api --gen-onefile -o ./FlatBuffer ./flatbuffers-schema/schema/rlbot.fbs -# the file produced is called rlbot_generated.cs, rename it to rlbot.cs after removing the old one -rm -f ./FlatBuffer/rlbot.cs -mv ./FlatBuffer/rlbot_generated.cs ./FlatBuffer/rlbot.cs +# the file produced is called rlbot_generated.cs, rename it to RLBot.cs after removing the old one +rm -f ./FlatBuffer/RLBot.cs +mv ./FlatBuffer/rlbot_generated.cs ./FlatBuffer/RLBot.cs +sed -i 's/rlbot\.flat/RLBot.Flat/g' ./FlatBuffer/RLBot.cs echo Done. \ No newline at end of file From 0cfe8e948e7fecd1892158af615f82fd280b5f8d Mon Sep 17 00:00:00 2001 From: Virx Date: Sun, 25 May 2025 16:20:08 -0400 Subject: [PATCH 2/3] `SpawnId` -> `PlayerId` --- RLBotCS/Conversion/GameStateToFlat.cs | 2 +- RLBotCS/ManagerTools/AgentMapping.cs | 10 +++++----- RLBotCS/ManagerTools/ConfigParser.cs | 5 ++--- RLBotCS/ManagerTools/ConfigValidator.cs | 4 ++-- RLBotCS/ManagerTools/MatchStarter.cs | 4 ++-- RLBotCS/ManagerTools/PlayerSpawner.cs | 14 +++++++------- RLBotCS/Model/AgentMetadata.cs | 4 ++-- .../Server/BridgeMessage/SetInitLoadout.cs | 12 ++++++------ .../Server/BridgeMessage/StateSetLoadout.cs | 2 +- RLBotCS/Server/FlatBuffersSession.cs | 5 ++--- RLBotCS/lib/Bridge.dll | Bin 141824 -> 141824 bytes flatbuffers-schema | 2 +- 12 files changed, 31 insertions(+), 33 deletions(-) diff --git a/RLBotCS/Conversion/GameStateToFlat.cs b/RLBotCS/Conversion/GameStateToFlat.cs index bc59bf3..9ca3f0e 100644 --- a/RLBotCS/Conversion/GameStateToFlat.cs +++ b/RLBotCS/Conversion/GameStateToFlat.cs @@ -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, diff --git a/RLBotCS/ManagerTools/AgentMapping.cs b/RLBotCS/ManagerTools/AgentMapping.cs index 0bc4c6b..7cc860b 100644 --- a/RLBotCS/ManagerTools/AgentMapping.cs +++ b/RLBotCS/ManagerTools/AgentMapping.cs @@ -6,7 +6,7 @@ namespace RLBotCS.ManagerTools; public struct PlayerIdPair { public uint Index; - public int SpawnId; + public int PlayerId; } public class AgentMapping @@ -38,7 +38,7 @@ public void SetAgents(MatchConfigurationT matchConfig) playerConfig.Team, playerConfig.Name, playerConfig.AgentId, - playerConfig.SpawnId + playerConfig.PlayerId ) ); } @@ -53,7 +53,7 @@ public void SetAgents(MatchConfigurationT matchConfig) Team.Scripts, scriptConfig.Name, scriptConfig.AgentId, - scriptConfig.SpawnId + scriptConfig.ScriptId ) ); } @@ -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 ); } @@ -99,7 +99,7 @@ public void SetAgents(MatchConfigurationT matchConfig) new PlayerIdPair { Index = playerMetadata.Index, - SpawnId = playerMetadata.SpawnId, + PlayerId = playerMetadata.PlayerId, } ); } diff --git a/RLBotCS/ManagerTools/ConfigParser.cs b/RLBotCS/ManagerTools/ConfigParser.cs index a417518..4c2dbcf 100644 --- a/RLBotCS/ManagerTools/ConfigParser.cs +++ b/RLBotCS/ManagerTools/ConfigParser.cs @@ -1,5 +1,4 @@ using System.Diagnostics; -using System.Runtime.InteropServices; using Microsoft.Extensions.Logging; using RLBot.Flat; using RLBotCS.Model; @@ -346,7 +345,7 @@ private PlayerConfigurationT ParseCarTable(TomlTable table, string matchConfigPa Hivemind = false, RootDir = "", RunCommand = "", - SpawnId = 0, + PlayerId = 0, }; } @@ -409,7 +408,7 @@ private PlayerConfigurationT LoadPlayerConfig( RunCommand = GetRunCommand(settings), Hivemind = GetValue(settings, Fields.AgentHivemind, false), RootDir = rootDir, - SpawnId = 0, + PlayerId = 0, Variety = variety, }; } diff --git a/RLBotCS/ManagerTools/ConfigValidator.cs b/RLBotCS/ManagerTools/ConfigValidator.cs index 36b61e0..bb54c9a 100644 --- a/RLBotCS/ManagerTools/ConfigValidator.cs +++ b/RLBotCS/ManagerTools/ConfigValidator.cs @@ -161,7 +161,7 @@ List players break; } - player.SpawnId = + player.PlayerId = player.Variety.Type == PlayerClass.Human ? 0 : $"{player.AgentId}/{player.Team}/{i}".GetHashCode(); @@ -209,7 +209,7 @@ List 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; diff --git a/RLBotCS/ManagerTools/MatchStarter.cs b/RLBotCS/ManagerTools/MatchStarter.cs index a664d7d..6cfbbca 100644 --- a/RLBotCS/ManagerTools/MatchStarter.cs +++ b/RLBotCS/ManagerTools/MatchStarter.cs @@ -272,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})" ); @@ -285,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})" ); diff --git a/RLBotCS/ManagerTools/PlayerSpawner.cs b/RLBotCS/ManagerTools/PlayerSpawner.cs index 525438c..2b810d9 100644 --- a/RLBotCS/ManagerTools/PlayerSpawner.cs +++ b/RLBotCS/ManagerTools/PlayerSpawner.cs @@ -18,7 +18,7 @@ public void SpawnBot(PlayerConfigurationT config, BotSkill skill, uint desiredIn { PlayerMetadata? alreadySpawnedPlayer = _gameState .PlayerMapping.GetKnownPlayers() - .FirstOrDefault(kp => config.SpawnId == kp.SpawnId); + .FirstOrDefault(kp => config.PlayerId == kp.PlayerId); if (alreadySpawnedPlayer != null) // We've already spawned this player, don't duplicate them. return; @@ -36,7 +36,7 @@ public void SpawnBot(PlayerConfigurationT config, BotSkill skill, uint desiredIn new SpawnTracker { CommandId = commandId, - SpawnId = config.SpawnId, + PlayerId = config.PlayerId, DesiredPlayerIndex = desiredIndex, IsCustomBot = skill == BotSkill.Custom, IsBot = true, @@ -51,7 +51,7 @@ public void SpawnHuman(PlayerConfigurationT config, uint desiredIndex) PlayerMetadata? alreadySpawnedPlayer = _gameState .PlayerMapping.GetKnownPlayers() - .FirstOrDefault(kp => config.SpawnId == kp.SpawnId); + .FirstOrDefault(kp => config.PlayerId == kp.PlayerId); if (alreadySpawnedPlayer != null) { _gameState.PlayerMapping.QueueIndexChange( @@ -65,7 +65,7 @@ public void SpawnHuman(PlayerConfigurationT config, uint desiredIndex) new SpawnTracker { CommandId = 0, // Human spawning must use command id 0 for reasons in bridge - SpawnId = config.SpawnId, + PlayerId = config.PlayerId, DesiredPlayerIndex = desiredIndex, IsBot = false, IsCustomBot = false, @@ -79,13 +79,13 @@ public void MakeHumanSpectate() spawnCommandQueue.AddConsoleCommand("spectate"); } - public void DespawnPlayers(List spawnIds) + public void DespawnPlayers(List playerIds) { - foreach (int spawnId in spawnIds) + foreach (int playerId in playerIds) { PlayerMetadata? player = _gameState .PlayerMapping.GetKnownPlayers() - .FirstOrDefault(p => p.SpawnId == spawnId); + .FirstOrDefault(p => p.PlayerId == playerId); if (player != null) { diff --git a/RLBotCS/Model/AgentMetadata.cs b/RLBotCS/Model/AgentMetadata.cs index 17b823a..6c547f2 100644 --- a/RLBotCS/Model/AgentMetadata.cs +++ b/RLBotCS/Model/AgentMetadata.cs @@ -1,12 +1,12 @@ namespace RLBotCS.Model; -public class AgentMetadata(uint index, uint team, string name, string agentId, int spawnId) +public class AgentMetadata(uint index, uint team, string name, string agentId, int playerId) { public readonly uint Index = index; public readonly uint Team = team; public readonly string Name = name; public readonly string AgentId = agentId; - public readonly int SpawnId = spawnId; + public readonly int PlayerId = playerId; public int? ClientId { get; private set; } = null; public bool Ready { get; set; } = false; diff --git a/RLBotCS/Server/BridgeMessage/SetInitLoadout.cs b/RLBotCS/Server/BridgeMessage/SetInitLoadout.cs index 8d24a45..96d2b18 100644 --- a/RLBotCS/Server/BridgeMessage/SetInitLoadout.cs +++ b/RLBotCS/Server/BridgeMessage/SetInitLoadout.cs @@ -7,7 +7,7 @@ namespace RLBotCS.Server.BridgeMessage; /// Sets the loadout of a bot that has yet to ready up and spawn (replaces loadout generators from v4). /// See also for loadout change during matches. /// -record SetInitLoadout(PlayerLoadoutT Loadout, int SpawnId) : IBridgeMessage +record SetInitLoadout(PlayerLoadoutT Loadout, int PlayerId) : IBridgeMessage { public void HandleMessage(BridgeContext context) { @@ -22,18 +22,18 @@ public void HandleMessage(BridgeContext context) { // BUG: If "wait_for_agents=false" then you cannot use the new 'loadout generators' context.Logger.LogWarning( - "Cannot set initial loadout of bot with spawn id {}. Cars have already spawned.", - SpawnId + "Cannot set initial loadout of bot with player id {}. Cars have already spawned.", + PlayerId ); return; } - var player = matchConfig.PlayerConfigurations.Find(p => p.SpawnId == SpawnId); + var player = matchConfig.PlayerConfigurations.Find(p => p.PlayerId == PlayerId); if (player is null) { context.Logger.LogError( - "Cannot set loadout of player with spawn id {}. No such player exists.", - SpawnId + "Cannot set loadout of player with player id {}. No such player exists.", + PlayerId ); return; } diff --git a/RLBotCS/Server/BridgeMessage/StateSetLoadout.cs b/RLBotCS/Server/BridgeMessage/StateSetLoadout.cs index bbe78b0..a59b1a3 100644 --- a/RLBotCS/Server/BridgeMessage/StateSetLoadout.cs +++ b/RLBotCS/Server/BridgeMessage/StateSetLoadout.cs @@ -46,7 +46,7 @@ public void HandleMessage(BridgeContext context) new SpawnTracker { CommandId = commandId, - SpawnId = meta.SpawnId, + PlayerId = meta.PlayerId, DesiredPlayerIndex = meta.PlayerIndex, IsCustomBot = true, IsBot = true, diff --git a/RLBotCS/Server/FlatBuffersSession.cs b/RLBotCS/Server/FlatBuffersSession.cs index d2aa983..7d9e803 100644 --- a/RLBotCS/Server/FlatBuffersSession.cs +++ b/RLBotCS/Server/FlatBuffersSession.cs @@ -1,6 +1,5 @@ using System.Net.Sockets; using System.Threading.Channels; -using Google.FlatBuffers; using Microsoft.Extensions.Logging; using RLBot.Flat; using RLBotCS.ManagerTools; @@ -163,7 +162,7 @@ await _bridge.WriteAsync( if (maybeIdPair is { } pair) { await _bridge.WriteAsync( - new SetInitLoadout(setLoadout.Loadout, pair.SpawnId) + new SetInitLoadout(setLoadout.Loadout, pair.PlayerId) ); } else @@ -344,7 +343,7 @@ private async Task HandleInternalMessages() .Select(playerInfo => new ControllableInfoT() { Index = playerInfo.Index, - SpawnId = playerInfo.SpawnId, + Identifier = playerInfo.PlayerId, }) .ToList(); diff --git a/RLBotCS/lib/Bridge.dll b/RLBotCS/lib/Bridge.dll index 5cd02cafc08dbccaf6d148cd268a4e09b5e7e4e5..a14d6ed9860e9a4f24c7c9d61c2536190e18edcc 100644 GIT binary patch delta 16191 zcmc(Gd0bW1+W&ga#6ivg9N?V8kdYQ1W)MVjL=jUd#fY3TH83^JOugkzJ!opCSefL` zk5i^4xAdy_Qe3Z8dNs@PW-6Md4H{;qHag_c_4hpAy;1A!z0>cHmp*;h`abis*4lfY z$;t+MWrO{h*_LnL=yzaR)oWE`vjk&Yq~y=0K6R~i*;Kw)uzhG|R5Nu!b&YAJK8g^m zi0m3;Q@^vXbv0AzUXk1dyp`q6R8olGvoT_mr6huh#PU_xY;%itKkzRsaj6K}V6v&6 zYD3TzsVZDSc6)$R+LS9ya2@84b26J+twi#Sni_3W)sX+rpTnl+!goiw*mMYYo08S3Xqo%C#Gp<69Qu{VroL2C(H$WOr~0t-BR0W5 zMo6GhkQ~rM`^08bjA)mk*FMoQ-{h1MM{$}+^Wk_`Fe8J1!+wjrTa6HWiJOKRYC4Uo5i5DQ{5+oe`X1szZ_uN9295 zEJdq#^Qy0;No}JfbYtiW-luk9U%B}lG!twE>;^mwoDwSX7deC+*QHvw5E`2>(YA}M z%BQ$kKE~%sSfas-wA~>TM`hY+8Dh0iJH;i;af(T?YR56cmD#k5Le)TKl@zY#X$5RT z^R;_q*s4tuhruo}xnET&JDY^DLjs?M1#my2Z4gV+{w_m%?Swc~Mu@`%^#L4O!eN5i z1&1m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$DU)0CL^uUJk|s&=#Qn|FTh zTJ+SI(cf>)cDAW^d`WZLrRR*uY1^iv-Kfm$w(Umc4lmCfnK?YWB7ek)Hf?h&D)REP z%d>OJ+m(;xn(gvwEERU1{I+Nn`0Q)M%gS*{wc%9)Sk|A(`* jLglmV2)1m?x(fa;k0se`lg$yz*{58MtdDD@oz(sx|HJ$U diff --git a/flatbuffers-schema b/flatbuffers-schema index 478c5a8..8922aa5 160000 --- a/flatbuffers-schema +++ b/flatbuffers-schema @@ -1 +1 @@ -Subproject commit 478c5a8a0607c244543df790f66c9006bc53b035 +Subproject commit 8922aa53c8c59812e153ec173f88525c4adc1de8 From e917369caffcecb4621d8c67aecea8574a6bda6a Mon Sep 17 00:00:00 2001 From: Virx Date: Sun, 25 May 2025 16:48:25 -0400 Subject: [PATCH 3/3] Update test --- RLBotCSTests/PlayerMappingTest.cs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/RLBotCSTests/PlayerMappingTest.cs b/RLBotCSTests/PlayerMappingTest.cs index 0644bc0..9f4b4cc 100644 --- a/RLBotCSTests/PlayerMappingTest.cs +++ b/RLBotCSTests/PlayerMappingTest.cs @@ -17,7 +17,7 @@ public void Init() [TestMethod] public void TestSpawnProcess() { - int spawnId = 2398249; + int playerId = 2398249; string agentId = "dev/abot"; uint desiredIndex = 2; ushort actorId = 2398; @@ -25,7 +25,7 @@ public void TestSpawnProcess() var spawnTracker = new SpawnTracker() { - SpawnId = spawnId, + PlayerId = playerId, AgentId = agentId, CommandId = commandId, DesiredPlayerIndex = desiredIndex, @@ -39,7 +39,7 @@ public void TestSpawnProcess() var metadata = _playerMapping.ApplyCarSpawn(actorId, commandId); Assert.AreEqual(desiredIndex, _playerMapping.PlayerIndexFromActorId(actorId)); - Assert.AreEqual(spawnId, metadata.SpawnId); + Assert.AreEqual(playerId, metadata.PlayerId); Assert.AreEqual(agentId, metadata.AgentId); Assert.IsTrue(metadata.IsBot); Assert.IsTrue(!metadata.IsCustomBot); @@ -51,7 +51,7 @@ public void TestSpawnProcess() Assert.AreEqual(0u, _playerMapping.PlayerIndexFromActorId(111)); Assert.IsNotNull(index); Assert.AreEqual(0u, index); - Assert.AreNotEqual(0, metadata2.SpawnId); + Assert.AreNotEqual(0, metadata2.PlayerId); Assert.AreEqual(desiredIndex, _playerMapping.PlayerIndexFromActorId(actorId)); Assert.IsTrue(!metadata2.IsBot); Assert.IsTrue(!metadata2.IsCustomBot);