diff options
author | Tangil <21197843+TheBlocks@users.noreply.github.com> | 2023-10-19 03:26:47 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-10-18 21:26:47 -0400 |
commit | d4c21ac192dd722deb59077c3319a80cdd04d482 (patch) | |
tree | 8fe750cadb7c5278d21733cf86b24befa0756558 | |
parent | 84edaf7b9a75265ca11d4c06a01ca6bff2a7de5c (diff) |
Remove C# bot manager to move to new repo (#631)
As per issue #630 (https://github.com/RLBot/RLBot/issues/630), we are
moving the C# and Java bot managers out of this repo and into their own
repositories.
The C# bot manager will be moving to:
https://github.com/RLBot/csharp-manager
40 files changed, 0 insertions, 2512 deletions
@@ -13,9 +13,6 @@ xcopy /s /Y .\src\generated\python\rlbot .\src\main\python\rlbot\messages\ .\src\main\flatbuffers\flatc.exe --java -o .\src\generated\java\flatbuffers .\src\main\flatbuffers\rlbot.fbs -.\src\main\flatbuffers\flatc.exe --csharp -o .\src\generated\cs\flatbuffers .\src\main\flatbuffers\rlbot.fbs -xcopy /s /Y .\src\generated\cs\flatbuffers\rlbot .\src\main\cs\RLBotDotNet\RLBotDotNet - .\src\main\flatbuffers\flatc.exe --js -o .\src\generated\js\flatbuffers .\src\main\flatbuffers\rlbot.fbs echo. diff --git a/src/main/cs/RLBotDotNet/README.md b/src/main/cs/RLBotDotNet/README.md deleted file mode 100644 index 689d886d..00000000 --- a/src/main/cs/RLBotDotNet/README.md +++ /dev/null @@ -1,17 +0,0 @@ -# RLBotDotNet - -This is the .NET port of the RLBot bot manager. It was written in C#, but the DLL produced by this can be used by any .NET language. - -Please run setup.bat so that the Flatbuffers generated files go in the /flat folder. - -## Publishing to NuGet - -RLBotDotNet is available on NuGet at https://www.nuget.org/packages/RLBot.Framework. - -To publish new versions there: -1. Modify RLBotDotNet.csproj to have an incremented version number. -1. Modify RLBotDotNet.csproj to update the release notes, etc. -1. Make sure RLBotDotNet has been built with the Release configuration, on the "Any CPU" platform. - - This should generate `.nupkg` and `.snupkg` files. -1. Go to https://www.nuget.org/packages/manage/upload and log in with our rlbotofficial account. -1. Upload the `.nupkg` file, then upload the `.snupkg` file. diff --git a/src/main/cs/RLBotDotNet/RLBotDotNet.sln b/src/main/cs/RLBotDotNet/RLBotDotNet.sln deleted file mode 100644 index 0a99d856..00000000 --- a/src/main/cs/RLBotDotNet/RLBotDotNet.sln +++ /dev/null @@ -1,31 +0,0 @@ - -Microsoft Visual Studio Solution File, Format Version 12.00 -# Visual Studio Version 16 -VisualStudioVersion = 16.0.30709.132 -MinimumVisualStudioVersion = 10.0.40219.1 -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "RLBotDotNet", "RLBotDotNet\RLBotDotNet.csproj", "{F97C012E-6C20-4E76-A075-6A274D73A69F}" -EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "TestBot", "..\..\..\test\cs\TestBot\TestBot.csproj", "{60ABBF24-FE11-4B97-ACC6-991AC5F82E44}" -EndProject -Global - GlobalSection(SolutionConfigurationPlatforms) = preSolution - Debug|Any CPU = Debug|Any CPU - Release|Any CPU = Release|Any CPU - EndGlobalSection - GlobalSection(ProjectConfigurationPlatforms) = postSolution - {F97C012E-6C20-4E76-A075-6A274D73A69F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {F97C012E-6C20-4E76-A075-6A274D73A69F}.Debug|Any CPU.Build.0 = Debug|Any CPU - {F97C012E-6C20-4E76-A075-6A274D73A69F}.Release|Any CPU.ActiveCfg = Release|Any CPU - {F97C012E-6C20-4E76-A075-6A274D73A69F}.Release|Any CPU.Build.0 = Release|Any CPU - {60ABBF24-FE11-4B97-ACC6-991AC5F82E44}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {60ABBF24-FE11-4B97-ACC6-991AC5F82E44}.Debug|Any CPU.Build.0 = Debug|Any CPU - {60ABBF24-FE11-4B97-ACC6-991AC5F82E44}.Release|Any CPU.ActiveCfg = Release|Any CPU - {60ABBF24-FE11-4B97-ACC6-991AC5F82E44}.Release|Any CPU.Build.0 = Release|Any CPU - EndGlobalSection - GlobalSection(SolutionProperties) = preSolution - HideSolutionNode = FALSE - EndGlobalSection - GlobalSection(ExtensibilityGlobals) = postSolution - SolutionGuid = {DBD8483E-FB0D-4E0F-91A0-DBC1952037A9} - EndGlobalSection -EndGlobal diff --git a/src/main/cs/RLBotDotNet/RLBotDotNet/Bot.cs b/src/main/cs/RLBotDotNet/RLBotDotNet/Bot.cs deleted file mode 100644 index c94633bc..00000000 --- a/src/main/cs/RLBotDotNet/RLBotDotNet/Bot.cs +++ /dev/null @@ -1,265 +0,0 @@ -using rlbot.flat; -using RLBotDotNet.Utils; -using System; -using RLBotDotNet.Renderer; -using RLBotDotNet.GameState; - -namespace RLBotDotNet -{ - /// <summary> - /// Inherit from this class to make a bot. - /// Bot logic that should be executed every frame goes in <see cref="GetOutput(GameTickPacket)"/> - /// </summary> - public abstract class Bot : IDisposable - { - private const float MaxChatRate = 2.0f; - private const int MaxChatCount = 5; - - [Obsolete("This field is obsolete. Use Name instead.", true)] - public readonly string name; - - [Obsolete("This field is obsolete. Use Team instead.", true)] - public readonly int team; - - [Obsolete("This field is obsolete. Use Index instead.", true)] - public readonly int index; - - /// <summary> - /// The name given to the bot in its configuration file. - /// </summary> - public readonly string Name; - - /// <summary> - /// The team the bot is on (0 for blue, 1 for orange). - /// </summary> - public readonly int Team; - - /// <summary> - /// The index of the bot in the match. - /// </summary> - public readonly int Index; - - private DateTime lastChatTime; - private bool resetChatTime; - private int chatCounter; - private int lastMessageId = -1; - - /// <summary> - /// Creates a bot instance. To be used by the BotManager. - /// </summary> - public Bot(string botName, int botTeam, int botIndex) - { - Name = botName; - Team = botTeam; - Index = botIndex; - } - - /// <summary> - /// This method should contain the bot logic that should be executed every frame. - /// </summary> - /// <param name="gameTickPacket">The game data input.</param> - /// <returns>Should return the Controller outputs that the bot should execute.</returns> - public abstract Controller GetOutput(GameTickPacket gameTickPacket); - - /// <summary> - /// Can be used to draw onto the screen. - /// </summary> - public Renderer.Renderer Renderer { get; internal set; } - - /// <summary> - /// Gets information about the game that does not change, such as boost pad and goal locations. - /// </summary> - /// <exception cref="FlatbuffersPacketException">Throws when the game has not started yet.</exception> - protected FieldInfo GetFieldInfo() - { - try - { - return RLBotInterface.GetFieldInfo(); - } - catch (FlatbuffersPacketException) - { - throw new FlatbuffersPacketException("The game did not send any information. " + - "This could mean that the match has not started yet. " + - "This happens when you run the bot before (or as soon as) RLBot.exe gets started " + - "and the game has not started the match yet. This usually happens on the map loading screen."); - } - } - - /// <summary> - /// Gets a <see cref="BallPrediction"/> object containing the simulated path of the ball for the next 6 seconds. - /// Each slice of the prediction advances by 1/60 of a second. - /// </summary> - /// <example> - /// Sample code to get ball prediction and get the initial slice: - /// <code> - /// BallPrediction prediction = GetBallPrediction(); - /// PredictionSlide initialSlice = prediction.Slices(0).Value; - /// </code> - /// </example> - protected BallPrediction GetBallPrediction() - { - return RLBotInterface.GetBallPredictionData(); - } - - /// <summary> - /// Warning: This method has been deprecated. - /// </summary> - [ObsoleteAttribute("The RigidBodyTick has been deprecated. " + - "GetOutput gives all raw physics engine values, so there is no need to use GetRigidBodyTick.")] - protected RigidBodyTick GetRigidBodyTick() - { - return RLBotInterface.GetRigidBodyTick(); - } - - /// <summary> - /// Gets the configuration (possibly from RLBot.cfg) for the current match being played. - /// </summary> - /// <example> - /// Sample code to get current map: - /// <code> - /// MatchSettings matchSettings = GetMatchSettings(); - /// GameMap map = matchSettings.GameMap; - /// </code> - /// </example> - protected MatchSettings GetMatchSettings() - { - return RLBotInterface.GetMatchSettingsData(); - } - - /// <summary> - /// Passes the agent's quick chats to the other bots. - /// </summary> - /// <param name="teamOnly"> - /// If true, only bots on the agent's team will be able to see the quick chat.<br/> - /// If false, the quick chat sent is global and every bot will be able to see it. - /// </param> - /// <param name="quickChat">The quick chat that should be sent</param> - /// <remarks> - /// The agent is limited to 5 quick chats in a 2 second period starting from the first chat. - /// This means you can spread your chats out to be even within that 2 second period. - /// You could spam them in a short duration but they will be then throttled. - /// </remarks> - /// <exception cref="FlatbuffersPacketException">Throws when the game has not started yet.</exception> - /// <example> - /// Sample code to send "What a save!" globally: - /// <code> - /// SendQuickChatFromAgent(false, QuickChatSelection.Compliments_WhatASave); - /// </code> - /// </example> - protected void SendQuickChatFromAgent(bool teamOnly, QuickChatSelection quickChat) - { - try - { - TimeSpan timeSinceLastChat = DateTime.Now - lastChatTime; - if (!resetChatTime && timeSinceLastChat.TotalSeconds >= MaxChatRate) - { - resetChatTime = true; - } - - if (resetChatTime) - { - lastChatTime = DateTime.Now; - chatCounter = 0; - resetChatTime = false; - } - - if (chatCounter < MaxChatCount) - { - RLBotInterface.SendQuickChatFlat(Index, teamOnly, quickChat); - chatCounter++; - } - else - { - Console.WriteLine( - $"Quick chat disabled for {(int) (MaxChatRate - timeSinceLastChat.TotalSeconds)} seconds."); - } - } - catch (FlatbuffersPacketException) - { - throw new FlatbuffersPacketException("The game did not send any information. " + - "This could mean that the match has not started yet. " + - "This happens when you run the bot before (or as soon as) RLBot.exe gets started " + - "and the game has not started the match yet. This usually happens on the map loading screen."); - } - } - - /// <summary> - /// Gets all messages that have been sent since the last call to this method. - /// </summary> - /// <returns>List of new messages.</returns> - /// <example> - /// Sample code to print all messages: - /// <code> - /// QuickChatMessages messages = ReceiveQuickChat(); - /// for (int i = 0; i < messages.MessagesLength; i++) - /// { - /// QuickChat quickChat = messages.Messages(i).Value; - /// Console.WriteLine($"Received {quickChat.QuickChatSelection} from player #{quickChat.PlayerIndex}"); - /// } - /// </code> - /// </example> - public QuickChatMessages ReceiveQuickChat() - { - QuickChatMessages messages = RLBotInterface.ReceiveQuickChat(Index, Team, lastMessageId); - - if (messages.MessagesLength > 0) - lastMessageId = messages.Messages(messages.MessagesLength - 1).Value.MessageIndex; - - return messages; - } - - /// <summary> - /// Allows the bot to set the game's state just like in training mode. - /// </summary> - /// <param name="gameState">The game state that should be set.</param> - /// <example> - /// Sample code to set the game state: - /// <code> - /// GameState gameState = new GameState(); - /// CarState carState = new CarState - /// { - /// Boost = 87f, - /// PhysicsState = new PhysicsState( - /// velocity: new DesiredVector3(null, null, 500), - /// rotation: new DesiredRotator((float) Math.PI / 2, 0, 0), - /// angularVelocity: new DesiredVector3(0, 0, 0) - /// ) - /// }; - /// gameState.SetCarState(this.index, carState); - /// gameState.BallState.PhysicsState.Location = new DesiredVector3(0, 0, null); - /// gameState.GameInfoState.WorldGravityZ = 700f; - /// gameState.GameInfoState.GameSpeed = 0.8f; - /// SetGameState(gameState); - /// </code> - /// With the above code: - /// <list type="bullet"> - /// <item>The bot will fling itself upward with its front pointed to the ceiling.</item> - /// <item>The ball will warp to the middle of the field but without altering its z position.</item> - /// <item>The world gravity will act weakly upwards. Note: Setting gravity to 0 will reset the gravity to normal settings.</item> - /// <item>If you want to disable gravity, set the gravity to something very small like 0.0001.</item> - /// <item>The game's speed will be reduced to 80% of the normal speed.</item> - /// </list> - /// In the above example, the ball's X and Y locations will be set to 0, but the Z will be untouched. - /// </example> - /// <remarks> - /// A <c>null</c> means that the property will not be changed. - /// Warning: Setting gravity and game speed every frame will likely cause your game to lag! - /// It is strongly recommended you only set them when required (e.g. only at the start of the game). - /// </remarks> - protected void SetGameState(GameState.GameState gameState) - { - if (gameState == null) - throw new ArgumentNullException(nameof(gameState)); - - RLBotInterface.SetGameStatePacket(gameState.BuildGameStatePacket()); - } - - /// <summary> - /// This optional method will be called on bot shutdown and should contain code that cleans up resources used by the bot. - /// </summary> - public virtual void Dispose() - { - // Empty virtual Dispose() to preserve compatibility with previous versions of RLBot - } - } -}
\ No newline at end of file diff --git a/src/main/cs/RLBotDotNet/RLBotDotNet/Common/MediaColorExtensions.cs b/src/main/cs/RLBotDotNet/RLBotDotNet/Common/MediaColorExtensions.cs deleted file mode 100644 index ea7f35b6..00000000 --- a/src/main/cs/RLBotDotNet/RLBotDotNet/Common/MediaColorExtensions.cs +++ /dev/null @@ -1,22 +0,0 @@ -using FlatBuffers; -using rlbot.flat; - -namespace RLBotDotNet.Common -{ - /// <summary> - /// Extension methods for <see cref="System.Drawing.Color"/>. - /// </summary> - public static class MediaColorExtensions - { - /// <summary> - /// Converts the <see cref="System.Drawing.Color"/> to the offset color with the given <see cref="FlatBufferBuilder"/>. - /// </summary> - /// <param name="color">The <see cref="System.Drawing.Color"/> to convert.</param> - /// <param name="builder">The <see cref="FlatBufferBuilder"/> to use to create the offset color.</param> - /// <returns>The created offset color from the <see cref="System.Drawing.Color"/>.</returns> - public static Offset<Color> ToOffsetColor(this System.Drawing.Color color, FlatBufferBuilder builder) - { - return Color.CreateColor(builder, color.A, color.R, color.G, color.B); - } - } -}
\ No newline at end of file diff --git a/src/main/cs/RLBotDotNet/RLBotDotNet/Common/NumericVector2Extensions.cs b/src/main/cs/RLBotDotNet/RLBotDotNet/Common/NumericVector2Extensions.cs deleted file mode 100644 index d7de8a6e..00000000 --- a/src/main/cs/RLBotDotNet/RLBotDotNet/Common/NumericVector2Extensions.cs +++ /dev/null @@ -1,22 +0,0 @@ -using FlatBuffers; -using rlbot.flat; - -namespace RLBotDotNet.Common -{ - /// <summary> - /// Extension methods for <see cref="System.Numerics.Vector2"/>. - /// </summary> - public static class NumericVector2Extensions - { - /// <summary> - /// Converts the <see cref="System.Numerics.Vector2"/> to offset vector with the given <see cref="FlatBufferBuilder"/>. - /// </summary> - /// <param name="vector2">The <see cref="System.Numerics.Vector2"/> to convert.</param> - /// <param name="builder">The <see cref="FlatBufferBuilder"/> to use to create the offset vector.</param> - /// <returns>The created offset vector from the <see cref="System.Numerics.Vector2"/>.</returns> - public static Offset<Vector3> ToOffsetVector(this System.Numerics.Vector2 vector2, FlatBufferBuilder builder) - { - return Vector3.CreateVector3(builder, vector2.X, vector2.Y, 0); - } - } -}
\ No newline at end of file diff --git a/src/main/cs/RLBotDotNet/RLBotDotNet/Common/NumericVector3Extensions.cs b/src/main/cs/RLBotDotNet/RLBotDotNet/Common/NumericVector3Extensions.cs deleted file mode 100644 index ccb9b63d..00000000 --- a/src/main/cs/RLBotDotNet/RLBotDotNet/Common/NumericVector3Extensions.cs +++ /dev/null @@ -1,22 +0,0 @@ -using FlatBuffers; -using rlbot.flat; - -namespace RLBotDotNet.Common -{ - /// <summary> - /// Extension methods for <see cref="System.Numerics.Vector3"/>. - /// </summary> - public static class NumericVector3Extensions - { - /// <summary> - /// Converts the <see cref="System.Numerics.Vector3"/> to offset vector with the given <see cref="FlatBufferBuilder"/>. - /// </summary> - /// <param name="vector3">The <see cref="System.Numerics.Vector3"/> to convert.</param> - /// <param name="builder">The <see cref="FlatBufferBuilder"/> to use to create the offset vector.</param> - /// <returns>The created offset vector from the <see cref="System.Numerics.Vector3"/>.</returns> - public static Offset<Vector3> ToOffsetVector(this System.Numerics.Vector3 vector3, FlatBufferBuilder builder) - { - return Vector3.CreateVector3(builder, vector3.X, vector3.Y, vector3.Z); - } - } -}
\ No newline at end of file diff --git a/src/main/cs/RLBotDotNet/RLBotDotNet/Controller.cs b/src/main/cs/RLBotDotNet/RLBotDotNet/Controller.cs deleted file mode 100644 index 9fbef4dc..00000000 --- a/src/main/cs/RLBotDotNet/RLBotDotNet/Controller.cs +++ /dev/null @@ -1,18 +0,0 @@ -namespace RLBotDotNet -{ - /// <summary> - /// A struct that represents the outputs that the bot should perform. - /// </summary> - public struct Controller - { - public float Throttle; - public float Steer; - public float Pitch; - public float Yaw; - public float Roll; - public bool Jump; - public bool Boost; - public bool Handbrake; - public bool UseItem; - } -}
\ No newline at end of file diff --git a/src/main/cs/RLBotDotNet/RLBotDotNet/FlatBuffers.dll b/src/main/cs/RLBotDotNet/RLBotDotNet/FlatBuffers.dll Binary files differdeleted file mode 100644 index a0794782..00000000 --- a/src/main/cs/RLBotDotNet/RLBotDotNet/FlatBuffers.dll +++ /dev/null diff --git a/src/main/cs/RLBotDotNet/RLBotDotNet/GameState/BallState.cs b/src/main/cs/RLBotDotNet/RLBotDotNet/GameState/BallState.cs deleted file mode 100644 index 6843563c..00000000 --- a/src/main/cs/RLBotDotNet/RLBotDotNet/GameState/BallState.cs +++ /dev/null @@ -1,46 +0,0 @@ -using rlbot.flat; -using FlatBuffers; - -namespace RLBotDotNet.GameState -{ - public class BallState - { - private PhysicsState physicsState; - - public PhysicsState PhysicsState - { - get - { - if (physicsState == null) - physicsState = new PhysicsState(); - - return physicsState; - } - - set => physicsState = value; - } - - public BallState(PhysicsState physicsState = null) - { - PhysicsState = physicsState; - } - - public BallState(BallInfo ballInfo) - { - if (ballInfo.Physics.HasValue) - PhysicsState = new PhysicsState(ballInfo.Physics.Value); - } - - public Offset<DesiredBallState> ToFlatBuffer(FlatBufferBuilder builder) - { - int physicsStateOffset = PhysicsState?.ToFlatBuffer(builder).Value ?? -1; - - DesiredBallState.StartDesiredBallState(builder); - - if (PhysicsState != null) - DesiredBallState.AddPhysics(builder, new Offset<DesiredPhysics>(physicsStateOffset)); - - return DesiredBallState.EndDesiredBallState(builder); - } - } -}
\ No newline at end of file diff --git a/src/main/cs/RLBotDotNet/RLBotDotNet/GameState/CarState.cs b/src/main/cs/RLBotDotNet/RLBotDotNet/GameState/CarState.cs deleted file mode 100644 index a5e7b6fe..00000000 --- a/src/main/cs/RLBotDotNet/RLBotDotNet/GameState/CarState.cs +++ /dev/null @@ -1,66 +0,0 @@ -using rlbot.flat; -using FlatBuffers; - -namespace RLBotDotNet.GameState -{ - public class CarState - { - private PhysicsState physicsState; - - public bool? Jumped; - public bool? DoubleJumped; - public float? Boost; - - public PhysicsState PhysicsState - { - get - { - if (physicsState == null) - physicsState = new PhysicsState(); - - return physicsState; - } - - set => physicsState = value; - } - - public CarState(PhysicsState physicsState = null, bool? jumped = null, bool? doubleJumped = null, float? boost = null) - { - PhysicsState = physicsState; - Jumped = jumped; - DoubleJumped = doubleJumped; - Boost = boost; - } - - public CarState(PlayerInfo playerInfo) - { - if (playerInfo.Physics.HasValue) - PhysicsState = new PhysicsState(playerInfo.Physics.Value); - - Jumped = playerInfo.Jumped; - DoubleJumped = playerInfo.DoubleJumped; - Boost = playerInfo.Boost; - } - - public Offset<DesiredCarState> ToFlatBuffer(FlatBufferBuilder builder) - { - int physicsStateOffset = PhysicsState?.ToFlatBuffer(builder).Value ?? -1; - - DesiredCarState.StartDesiredCarState(builder); - - if (PhysicsState != null) - DesiredCarState.AddPhysics(builder, new Offset<DesiredPhysics>(physicsStateOffset)); - - if (Jumped.HasValue) - DesiredCarState.AddJumped(builder, Bool.CreateBool(builder, Jumped.Value)); - - if (DoubleJumped.HasValue) - DesiredCarState.AddDoubleJumped(builder, Bool.CreateBool(builder, DoubleJumped.Value)); - - if (Boost.HasValue) - DesiredCarState.AddBoostAmount(builder, Float.CreateFloat(builder, Boost.Value)); - - return DesiredCarState.EndDesiredCarState(builder); - } - } -}
\ No newline at end of file diff --git a/src/main/cs/RLBotDotNet/RLBotDotNet/GameState/DesiredRotator.cs b/src/main/cs/RLBotDotNet/RLBotDotNet/GameState/DesiredRotator.cs deleted file mode 100644 index 3481a8b6..00000000 --- a/src/main/cs/RLBotDotNet/RLBotDotNet/GameState/DesiredRotator.cs +++ /dev/null @@ -1,42 +0,0 @@ -using rlbot.flat; -using FlatBuffers; - -namespace RLBotDotNet.GameState -{ - public class DesiredRotator - { - public float? Pitch; - public float? Yaw; - public float? Roll; - - public DesiredRotator(float? pitch = null, float? yaw = null, float? roll = null) - { - Pitch = pitch; - Yaw = yaw; - Roll = roll; - } - - public DesiredRotator(Rotator rotator) - { - Pitch = rotator.Pitch; - Yaw = rotator.Yaw; - Roll = rotator.Roll; - } - - public Offset<RotatorPartial> ToFlatBuffer(FlatBufferBuilder builder) - { - RotatorPartial.StartRotatorPartial(builder); - - if (Pitch.HasValue) - RotatorPartial.AddPitch(builder, Float.CreateFloat(builder, Pitch.Value)); - - if (Yaw.HasValue) - RotatorPartial.AddYaw(builder, Float.CreateFloat(builder, Yaw.Value)); - - if (Roll.HasValue) - RotatorPartial.AddRoll(builder, Float.CreateFloat(builder, Roll.Value)); - - return RotatorPartial.EndRotatorPartial(builder); - } - } -}
\ No newline at end of file diff --git a/src/main/cs/RLBotDotNet/RLBotDotNet/GameState/DesiredVector3.cs b/src/main/cs/RLBotDotNet/RLBotDotNet/GameState/DesiredVector3.cs deleted file mode 100644 index bf6739ed..00000000 --- a/src/main/cs/RLBotDotNet/RLBotDotNet/GameState/DesiredVector3.cs +++ /dev/null @@ -1,51 +0,0 @@ -using rlbot.flat; -using FlatBuffers; - -namespace RLBotDotNet.GameState -{ - public class DesiredVector3 - { - public float? X; - public float? Y; - public float? Z; - - public static DesiredVector3 Zero => new DesiredVector3(0, 0, 0); - - public DesiredVector3(float? x = null, float? y = null, float? z = null) - { - X = x; - Y = y; - Z = z; - } - - public DesiredVector3(Vector3 vector) - { - X = vector.X; - Y = vector.Y; - Z = vector.Z; - } - - public DesiredVector3(System.Numerics.Vector3 vector) - { - X = vector.X; - Y = vector.Y; - Z = vector.Z; - } - - public Offset<Vector3Partial> ToFlatBuffer(FlatBufferBuilder builder) - { - Vector3Partial.StartVector3Partial(builder); - - if (X.HasValue) - Vector3Partial.AddX(builder, Float.CreateFloat(builder, X.Value)); - - if (Y.HasValue) - Vector3Partial.AddY(builder, Float.CreateFloat(builder, Y.Value)); - - if (Z.HasValue) - Vector3Partial.AddZ(builder, Float.CreateFloat(builder, Z.Value)); - - return Vector3Partial.EndVector3Partial(builder); - } - } -}
\ No newline at end of file diff --git a/src/main/cs/RLBotDotNet/RLBotDotNet/GameState/GameInfoState.cs b/src/main/cs/RLBotDotNet/RLBotDotNet/GameState/GameInfoState.cs deleted file mode 100644 index fefa08b9..00000000 --- a/src/main/cs/RLBotDotNet/RLBotDotNet/GameState/GameInfoState.cs +++ /dev/null @@ -1,40 +0,0 @@ -using rlbot.flat; -using FlatBuffers; - -namespace RLBotDotNet.GameState -{ - public class GameInfoState - { - public float? GameSpeed; - public float? WorldGravityZ; - public bool? Paused; - public bool? EndMatch; - - public GameInfoState(float? gameSpeed = null, float? worldGravityZ = null, bool? paused = null, bool? endMatch = null) - { - GameSpeed = gameSpeed; - WorldGravityZ = worldGravityZ; - Paused = paused; - EndMatch = endMatch; - } - - public Offset<DesiredGameInfoState> ToFlatBuffer(FlatBufferBuilder builder) - { - DesiredGameInfoState.StartDesiredGameInfoState(builder); - - if (GameSpeed.HasValue) - DesiredGameInfoState.AddGameSpeed(builder, Float.CreateFloat(builder, GameSpeed.Value)); - - if (WorldGravityZ.HasValue) - DesiredGameInfoState.AddWorldGravityZ(builder, Float.CreateFloat(builder, WorldGravityZ.Value)); - - if (Paused.HasValue) - DesiredGameInfoState.AddPaused(builder, Bool.CreateBool(builder, Paused.Value)); - - if (EndMatch.HasValue) - DesiredGameInfoState.AddEndMatch(builder, Bool.CreateBool(builder, EndMatch.Value)); - - return DesiredGameInfoState.EndDesiredGameInfoState(builder); - } - } -}
\ No newline at end of file diff --git a/src/main/cs/RLBotDotNet/RLBotDotNet/GameState/GameState.cs b/src/main/cs/RLBotDotNet/RLBotDotNet/GameState/GameState.cs deleted file mode 100644 index 3c3f8ca5..00000000 --- a/src/main/cs/RLBotDotNet/RLBotDotNet/GameState/GameState.cs +++ /dev/null @@ -1,135 +0,0 @@ -using System.Collections.Generic; -using System.Linq; -using rlbot.flat; -using FlatBuffers; - -namespace RLBotDotNet.GameState -{ - public class GameState - { - private Dictionary<int, CarState> carStates = new Dictionary<int, CarState>(); - private BallState ballState; - private GameInfoState gameInfoState; - - public BallState BallState - { - get - { - if (ballState == null) - ballState = new BallState(); - - return ballState; - } - - set => ballState = value; - } - - public GameInfoState GameInfoState - { - get - { - if (gameInfoState == null) - gameInfoState = new GameInfoState(); - - return gameInfoState; - } - - set => gameInfoState = value; - } - - public CarState GetCarState(int index) - { - if (!carStates.ContainsKey(index)) - carStates.Add(index, new CarState()); - - return carStates[index]; - } - - public void SetCarState(int index, CarState carState) - { - if (carStates.ContainsKey(index)) - carStates[index] = carState; - else - carStates.Add(index, carState); - } - - /// <summary> - /// Builds the flatbuffer containing the desired state. - /// This is only used internally. - /// </summary> - /// <returns></returns> - public GameStatePacket BuildGameStatePacket() - { - FlatBufferBuilder builder = new FlatBufferBuilder(100); - - int ballStateOffset = -1; - int gameInfoStateOffset = -1; - - if (BallState != null) - ballStateOffset = BallState.ToFlatBuffer(builder).Value; - - if (GameInfoState != null) - gameInfoStateOffset = GameInfoState.ToFlatBuffer(builder).Value; - - VectorOffset carStateVector = CreateCarStateVector(builder, carStates); - - DesiredGameState.StartDesiredGameState(builder); - - if (BallState != null) - DesiredGameState.AddBallState(builder, new Offset<DesiredBallState>(ballStateOffset)); - - if (GameInfoState != null) - DesiredGameState.AddGameInfoState(builder, new Offset<DesiredGameInfoState>(gameInfoStateOffset)); - - DesiredGameState.AddCarStates(builder, carStateVector); - - builder.Finish(DesiredGameState.EndDesiredGameState(builder).Value); - - return new GameStatePacket(builder.SizedByteArray()); - } - - /// <summary> - /// Creates a GameState from a GameTickPacket. Useful for saving a scenario and implementing "quicksave/quickload" functionality. - /// </summary> - /// <param name="gameTickPacket">The packet to create the GameState from.</param> - public static GameState CreateFromGameTickPacket(GameTickPacket gameTickPacket) - { - GameState gameState = new GameState(); - - if (gameTickPacket.Ball.HasValue) - { - gameState.BallState = new BallState(gameTickPacket.Ball.Value); - } - - for (int i = 0; i < gameTickPacket.PlayersLength; i++) - { - if (gameTickPacket.Players(i).HasValue) - { - gameState.SetCarState(i, new CarState(gameTickPacket.Players(i).Value)); - } - } - - return gameState; - } - - private static VectorOffset CreateCarStateVector(FlatBufferBuilder builder, Dictionary<int, CarState> carStates) - { - if (carStates.Count == 0) - return DesiredGameState.CreateCarStatesVector(builder, new Offset<DesiredCarState>[0]); - - int numCars = carStates.Keys.Max() + 1; - - Offset<DesiredCarState>[] carStateOffsets = new Offset<DesiredCarState>[numCars]; - - for (int i = 0; i < numCars; i++) - { - if (carStates.ContainsKey(i) && carStates[i] != null) - carStateOffsets[i] = carStates[i].ToFlatBuffer(builder); - else - carStateOffsets[i] = new CarState().ToFlatBuffer(builder); - } - - return DesiredGameState.CreateCarStatesVector(builder, carStateOffsets); - } - } -}
\ No newline at end of file diff --git a/src/main/cs/RLBotDotNet/RLBotDotNet/GameState/GameStatePacket.cs b/src/main/cs/RLBotDotNet/RLBotDotNet/GameState/GameStatePacket.cs deleted file mode 100644 index 412e376a..00000000 --- a/src/main/cs/RLBotDotNet/RLBotDotNet/GameState/GameStatePacket.cs +++ /dev/null @@ -1,12 +0,0 @@ -namespace RLBotDotNet.GameState -{ - public class GameStatePacket - { - public byte[] Data { get; } - - public GameStatePacket(byte[] data) - { - Data = data; - } - } -}
\ No newline at end of file diff --git a/src/main/cs/RLBotDotNet/RLBotDotNet/GameState/PhysicsState.cs b/src/main/cs/RLBotDotNet/RLBotDotNet/GameState/PhysicsState.cs deleted file mode 100644 index 6cc93e69..00000000 --- a/src/main/cs/RLBotDotNet/RLBotDotNet/GameState/PhysicsState.cs +++ /dev/null @@ -1,117 +0,0 @@ -using rlbot.flat; -using FlatBuffers; - -namespace RLBotDotNet.GameState -{ - public class PhysicsState - { - private DesiredVector3 location; - private DesiredVector3 velocity; - private DesiredRotator rotation; - private DesiredVector3 angularVelocity; - - #region Getters/Setters - - public DesiredVector3 Location - { - get - { - if (location == null) - location = new DesiredVector3(); - - return location; - } - - set => location = value; - } - - public DesiredVector3 Velocity - { - get - { - if (velocity == null) - velocity = new DesiredVector3(); - - return velocity; - } - - set => velocity = value; - } - - public DesiredRotator Rotation - { - get - { - if (rotation == null) - rotation = new DesiredRotator(); - - return rotation; - } - - set => rotation = value; - } - - public DesiredVector3 AngularVelocity - { - get - { - if (angularVelocity == null) - angularVelocity = new DesiredVector3(); - - return angularVelocity; - } - - set => angularVelocity = value; - } - - #endregion - - public PhysicsState(DesiredVector3 location = null, DesiredVector3 velocity = null, DesiredRotator rotation = null, - DesiredVector3 angularVelocity = null) - { - Location = location; - Velocity = velocity; - Rotation = rotation; - AngularVelocity = angularVelocity; - } - - public PhysicsState(Physics physics) - { - if (physics.Location.HasValue) - Location = new DesiredVector3(physics.Location.Value); - - if (physics.Velocity.HasValue) - Velocity = new DesiredVector3(physics.Velocity.Value); - - if (physics.Rotation.HasValue) - Rotation = new DesiredRotator(physics.Rotation.Value); - - if (physics.AngularVelocity.HasValue) - AngularVelocity = new DesiredVector3(physics.AngularVelocity.Value); - } - - public Offset<DesiredPhysics> ToFlatBuffer(FlatBufferBuilder builder) - { - int locationOffset = Location?.ToFlatBuffer(builder).Value ?? -1; - int velocityOffset = Velocity?.ToFlatBuffer(builder).Value ?? -1; - int rotationOffset = Rotation?.ToFlatBuffer(builder).Value ?? -1; - int angularVelocityOffset = AngularVelocity?.ToFlatBuffer(builder).Value ?? -1; - - DesiredPhysics.StartDesiredPhysics(builder); - - if (Location != null) - DesiredPhysics.AddLocation(builder, new Offset<Vector3Partial>(locationOffset)); - - if (Velocity != null) - DesiredPhysics.AddVelocity(builder, new Offset<Vector3Partial>(velocityOffset)); - - if (Rotation != null) - DesiredPhysics.AddRotation(builder, new Offset<RotatorPartial>(rotationOffset)); - - if (AngularVelocity != null) - DesiredPhysics.AddAngularVelocity(builder, new Offset<Vector3Partial>(angularVelocityOffset)); - - return DesiredPhysics.EndDesiredPhysics(builder); - } - } -}
\ No newline at end of file diff --git a/src/main/cs/RLBotDotNet/RLBotDotNet/Interface/ByteBufferStruct.cs b/src/main/cs/RLBotDotNet/RLBotDotNet/Interface/ByteBufferStruct.cs deleted file mode 100644 index 05add4c2..00000000 --- a/src/main/cs/RLBotDotNet/RLBotDotNet/Interface/ByteBufferStruct.cs +++ /dev/null @@ -1,13 +0,0 @@ -using System; - -namespace RLBotDotNet.Utils -{ - /// <summary> - /// This is the ByteBuffer struct used in the interface DLL. - /// </summary> - public struct ByteBufferStruct - { - public IntPtr ptr; - public int size; - } -}
\ No newline at end of file diff --git a/src/main/cs/RLBotDotNet/RLBotDotNet/Interface/FlatbuffersPacketException.cs b/src/main/cs/RLBotDotNet/RLBotDotNet/Interface/FlatbuffersPacketException.cs deleted file mode 100644 index 6c0abd9a..00000000 --- a/src/main/cs/RLBotDotNet/RLBotDotNet/Interface/FlatbuffersPacketException.cs +++ /dev/null @@ -1,16 +0,0 @@ -using System; - -namespace RLBotDotNet.Utils -{ - [Serializable] - public class FlatbuffersPacketException : Exception - { - public FlatbuffersPacketException() { } - public FlatbuffersPacketException(string message) : base(message) { } - public FlatbuffersPacketException(string message, Exception inner) : base(message, inner) { } - - protected FlatbuffersPacketException( - System.Runtime.Serialization.SerializationInfo info, - System.Runtime.Serialization.StreamingContext context) : base(info, context) { } - } -}
\ No newline at end of file diff --git a/src/main/cs/RLBotDotNet/RLBotDotNet/Interface/RLBotCoreException.cs b/src/main/cs/RLBotDotNet/RLBotDotNet/Interface/RLBotCoreException.cs deleted file mode 100644 index 0acdda16..00000000 --- a/src/main/cs/RLBotDotNet/RLBotDotNet/Interface/RLBotCoreException.cs +++ /dev/null @@ -1,14 +0,0 @@ -using System; -using System.Runtime.Serialization; - -namespace RLBotDotNet.Utils -{ - [Serializable] - public class RLBotCoreException : Exception - { - public RLBotCoreException() { } - public RLBotCoreException(string message) : base(message) { } - public RLBotCoreException(string message, Exception inner) : base(message, inner) { } - protected RLBotCoreException(SerializationInfo info, StreamingContext context) : base(info, context) { } - } -}
\ No newline at end of file diff --git a/src/main/cs/RLBotDotNet/RLBotDotNet/Interface/RLBotCoreStatus.cs b/src/main/cs/RLBotDotNet/RLBotDotNet/Interface/RLBotCoreStatus.cs deleted file mode 100644 index 739c2014..00000000 --- a/src/main/cs/RLBotDotNet/RLBotDotNet/Interface/RLBotCoreStatus.cs +++ /dev/null @@ -1,27 +0,0 @@ -namespace RLBotDotNet.Utils -{ - public enum RLBotCoreStatus - { - Success, - BufferOverfilled, - MessageLargerThanMax, - InvalidNumPlayers, - InvalidBotSkill, - InvalidHumanIndex, - InvalidName, - InvalidTeam, - InvalidTeamColorID, - InvalidCustomColorID, - InvalidGameValues, - InvalidThrottle, - InvalidSteer, - InvalidPitch, - InvalidYaw, - InvalidRoll, - InvalidPlayerIndex, - InvalidQuickChatPreset, - InvalidRenderType, - QuickChatRateExceeded, - NotInitialized - } -}
\ No newline at end of file diff --git a/src/main/cs/RLBotDotNet/RLBotDotNet/Interface/RLBotInterface.cs b/src/main/cs/RLBotDotNet/RLBotDotNet/Interface/RLBotInterface.cs deleted file mode 100644 index 17877095..00000000 --- a/src/main/cs/RLBotDotNet/RLBotDotNet/Interface/RLBotInterface.cs +++ /dev/null @@ -1,272 +0,0 @@ -using System; -using rlbot.flat; -using FlatBuffers; -using System.Runtime.InteropServices; -using RLBotDotNet.Renderer; -using RLBotDotNet.GameState; - -namespace RLBotDotNet.Utils -{ - /// <summary> - /// Contains all the methods provided by the interface DLL. - /// </summary> - public static class RLBotInterface - { - public const string InterfaceDllPath = "dll/RLBot_Core_Interface.dll"; - - #region DllImports - - [DllImport(InterfaceDllPath, CallingConvention = CallingConvention.Cdecl)] - [return: MarshalAs(UnmanagedType.I1)] - public extern static bool IsInitialized(); - - [DllImport(InterfaceDllPath, CallingConvention = CallingConvention.Cdecl)] - public extern static ByteBufferStruct UpdateLiveDataPacketFlatbuffer(); - - [DllImport(InterfaceDllPath, CallingConvention = CallingConvention.Cdecl)] - public extern static ByteBufferStruct FreshLiveDataPacketFlatbuffer(int timeoutMillis, int key); - - [DllImport(InterfaceDllPath, CallingConvention = CallingConvention.Cdecl)] - public extern static ByteBufferStruct UpdateRigidBodyTickFlatbuffer(); - - [DllImport(InterfaceDllPath, CallingConvention = CallingConvention.Cdecl)] - public extern static ByteBufferStruct UpdateFieldInfoFlatbuffer(); - - [DllImport(InterfaceDllPath, CallingConvention = CallingConvention.Cdecl)] - public extern static ByteBufferStruct GetBallPrediction(); - - [DllImport(InterfaceDllPath, CallingConvention = CallingConvention.Cdecl)] - public extern static int UpdatePlayerInputFlatbuffer(byte[] bytes, int size); - - [DllImport(InterfaceDllPath, CallingConvention = CallingConvention.Cdecl)] - public extern static int SendQuickChat(byte[] quickChatMessage, int protoSize); - - [DllImport(InterfaceDllPath, CallingConvention = CallingConvention.Cdecl)] - public extern static ByteBufferStruct ReceiveChat(int botIndex, int teamIndex, int lastMessageIndex); - - [DllImport(InterfaceDllPath, CallingConvention = CallingConvention.Cdecl)] - public extern static int RenderGroup(byte[] renderGroup, int protoSize); - - [DllImport(InterfaceDllPath, CallingConvention = CallingConvention.Cdecl)] - public extern static void Free(IntPtr ptr); - - [DllImport(InterfaceDllPath, CallingConvention = CallingConvention.Cdecl)] - public extern static int SetGameState(byte[] bytes, int size); - - [DllImport(InterfaceDllPath, CallingConvention = CallingConvention.Cdecl)] - public extern static ByteBufferStruct GetMatchSettings(); - - #endregion - - /// <summary> - /// Returns the current frame's GameTickPacket. - /// </summary> - /// <returns>The current frame's GameTickPacket.</returns> - public static GameTickPacket GetGameTickPacket() - { - ByteBufferStruct byteBuffer = UpdateLiveDataPacketFlatbuffer(); - if (byteBuffer.size < 4) - throw new FlatbuffersPacketException("Flatbuffers packet is too small. Match is probably not running!"); - - byte[] bufferBytes = new byte[byteBuffer.size]; - Marshal.Copy(byteBuffer.ptr, bufferBytes, 0, byteBuffer.size); - Free(byteBuffer.ptr); - - return GameTickPacket.GetRootAsGameTickPacket(new ByteBuffer(bufferBytes)); - } - - public static GameTickPacket WaitForFreshPacket(int timeoutMillis, int key) - { - ByteBufferStruct byteBuffer = FreshLiveDataPacketFlatbuffer(timeoutMillis, key); - if (byteBuffer.size < 4) - throw new FlatbuffersPacketException("Flatbuffers packet is too small. Match is probably not running!"); - - byte[] bufferBytes = new byte[byteBuffer.size]; - Marshal.Copy(byteBuffer.ptr, bufferBytes, 0, byteBuffer.size); - Free(byteBuffer.ptr); - - return GameTickPacket.GetRootAsGameTickPacket(new ByteBuffer(bufferBytes)); - } - - /// <summary> - /// Returns the current frame's RigidBodyTick. - /// </summary> - /// <returns>The current frame's RigidBodyTick.</returns> - public static RigidBodyTick GetRigidBodyTick() - { - ByteBufferStruct byteBuffer = UpdateRigidBodyTickFlatbuffer(); - if (byteBuffer.size < 4) - throw new FlatbuffersPacketException("Flatbuffers packet is too small. Match is probably not running!"); - - byte[] bufferBytes = new byte[byteBuffer.size]; - Marshal.Copy(byteBuffer.ptr, bufferBytes, 0, byteBuffer.size); - Free(byteBuffer.ptr); - - return RigidBodyTick.GetRootAsRigidBodyTick(new ByteBuffer(bufferBytes)); - } - - /// <summary> - /// Returns the game's FieldInfo. - /// </summary> - /// <returns>The game's FieldInfo.</returns> - public static FieldInfo GetFieldInfo() - { - ByteBufferStruct byteBuffer = UpdateFieldInfoFlatbuffer(); - if (byteBuffer.size < 4) - throw new FlatbuffersPacketException("Flatbuffers packet is too small. Match is probably not running!"); - - byte[] bufferBytes = new byte[byteBuffer.size]; - Marshal.Copy(byteBuffer.ptr, bufferBytes, 0, byteBuffer.size); - Free(byteBuffer.ptr); - - return FieldInfo.GetRootAsFieldInfo(new ByteBuffer(bufferBytes)); - } - - /// <summary> - /// Returns 6 seconds of the ball physics prediction. - /// </summary> - /// <returns>6 seconds of the ball physics prediction.</returns> - public static BallPrediction GetBallPredictionData() - { - ByteBufferStruct byteBuffer = GetBallPrediction(); - if (byteBuffer.size < 4) - throw new FlatbuffersPacketException("Flatbuffers packet is too small. Match is probably not running!"); - - byte[] bufferBytes = new byte[byteBuffer.size]; - Marshal.Copy(byteBuffer.ptr, bufferBytes, 0, byteBuffer.size); - Free(byteBuffer.ptr); - - return BallPrediction.GetRootAsBallPrediction(new ByteBuffer(bufferBytes)); - } - - - /// <summary> - /// Sets the bot's controller inputs. - /// </summary> - /// <param name="controller">The controller to set the inputs to.</param> - /// <param name="index">The index of the bot's car.</param> - public static void SetBotInput(Controller controller, int index) - { - FlatBufferBuilder builder = new FlatBufferBuilder(50); - - Offset<ControllerState> controllerStateOffset = ControllerState.CreateControllerState( - builder, - controller.Throttle, - controller.Steer, - controller.Pitch, - controller.Yaw, - controller.Roll, - controller.Jump, - controller.Boost, - controller.Handbrake, - controller.UseItem); - - Offset<PlayerInput> playerInputOffset = PlayerInput.CreatePlayerInput( - builder, - index, - controllerStateOffset); - - builder.Finish(playerInputOffset.Value); - byte[] bufferBytes = builder.SizedByteArray(); - int status = UpdatePlayerInputFlatbuffer(bufferBytes, bufferBytes.Length); - - if (status > 0) - throw NewRLBotCoreException((RLBotCoreStatus) status); - } - - - /// <summary> - /// Sends a quick chat flat message. - /// </summary> - /// <param name="playerIndex">The index of the bot's car.</param> - /// <param name="teamOnly">Flag indicating whether the quick chat message is for the player's team only or not.</param> - /// <param name="quickChat">The quick chat selection to send.</param> - public static void SendQuickChatFlat(int playerIndex, bool teamOnly, QuickChatSelection quickChat) - { - FlatBufferBuilder builder = new FlatBufferBuilder(50); - - var offset = QuickChat.CreateQuickChat( - builder, - quickChat, - playerIndex, - teamOnly); - - builder.Finish(offset.Value); - byte[] bufferBytes = builder.SizedByteArray(); - int status = SendQuickChat(bufferBytes, bufferBytes.Length); - - if (status > 0) - throw NewRLBotCoreException((RLBotCoreStatus) status); - } - - /// <summary> - /// Gets a list of chat messages. - /// </summary> - /// <param name="botIndex">Index of the receiving bot.</param> - /// <param name="teamIndex">Team index of the receiving bot.</param> - /// <param name="lastMessageIndex">Message index of the last received message.</param> - /// <returns>List of new messages.</returns> - public static QuickChatMessages ReceiveQuickChat(int botIndex, int teamIndex, int lastMessageIndex) - { - ByteBufferStruct byteBuffer = ReceiveChat(botIndex, teamIndex, lastMessageIndex); - if (byteBuffer.size < 4) - throw new FlatbuffersPacketException("Flatbuffers packet is too small. Match is probably not running!"); - - byte[] bufferBytes = new byte[byteBuffer.size]; - Marshal.Copy(byteBuffer.ptr, bufferBytes, 0, byteBuffer.size); - Free(byteBuffer.ptr); - - return QuickChatMessages.GetRootAsQuickChatMessages(new ByteBuffer(bufferBytes)); - } - - /// <summary> - /// Sets the current state of the game. - /// </summary> - /// <param name="gameState">The desired state.</param> - public static void SetGameStatePacket(GameStatePacket gameState) - { - byte[] data = gameState.Data; - int status = SetGameState(data, data.Length); - - if (status > 0) - throw NewRLBotCoreException((RLBotCoreStatus) status); - } - - /// <summary> - /// Renders a render packet to the screen. - /// </summary> - /// <param name="finishedRender">The render packet to render.</param> - public static void RenderPacket(RenderPacket finishedRender) - { - byte[] bytes = finishedRender.Bytes; - int status = RenderGroup(bytes, bytes.Length); - - if (status > 0) - throw NewRLBotCoreException((RLBotCoreStatus) status); - } - - /// <summary> - /// Returns the match settings that were most recently sent to RLBot. - /// Useful for determining the game mode, what map we're playing on, mutators, etc. - /// </summary> - /// <returns>The MatchSettings object, as defined in the flatbuffer spec.</returns> - public static MatchSettings GetMatchSettingsData() - { - ByteBufferStruct byteBuffer = GetMatchSettings(); - if (byteBuffer.size < 4) - throw new FlatbuffersPacketException("Flatbuffers packet is too small. Match settings are probably not available!"); - - byte[] bufferBytes = new byte[byteBuffer.size]; - Marshal.Copy(byteBuffer.ptr, bufferBytes, 0, byteBuffer.size); - Free(byteBuffer.ptr); - - return MatchSettings.GetRootAsMatchSettings(new ByteBuffer(bufferBytes)); - } - - private static RLBotCoreException NewRLBotCoreException(RLBotCoreStatus status) - { - // Possible to add more code here to make the exception messages more verbose. - return new RLBotCoreException(status.ToString()); - } - } -}
\ No newline at end of file diff --git a/src/main/cs/RLBotDotNet/RLBotDotNet/Manager/BotManager.cs b/src/main/cs/RLBotDotNet/RLBotDotNet/Manager/BotManager.cs deleted file mode 100644 index f803b602..00000000 --- a/src/main/cs/RLBotDotNet/RLBotDotNet/Manager/BotManager.cs +++ /dev/null @@ -1,289 +0,0 @@ -using rlbot.flat; -using RLBotDotNet.Utils; -using RLBotDotNet.Server; -using System; -using System.Collections.Concurrent; -using System.Diagnostics; -using System.Collections.Generic; -using System.Threading; -using System.Linq; -using System.IO; -using RLBotDotNet.Manager; -using RLBotDotNet.Renderer; - -namespace RLBotDotNet -{ - /// <summary> - /// Manages the C# bots and runs them. - /// </summary> - /// <typeparam name="T">The custom bot class that should be run.</typeparam> - public class BotManager<T> where T : Bot - { - private readonly ConcurrentDictionary<int, BotLoopRenderer> _renderers; - private List<BotProcess> botProcesses = new List<BotProcess>(); - private Thread serverThread; - - private readonly int frequency; - - /// <summary> - /// Constructs a new instance of BotManager. - /// </summary> - public BotManager() : this(60) { } - - /// <summary> - /// Constructs a new instance of BotManager. - /// </summary> - /// <param name="frequency">The frequency that the bot updates at: [1, 120]. Set to 0 to update at each new packet.</param> - public BotManager(int frequency) - { - _renderers = new ConcurrentDictionary<int, BotLoopRenderer>(); - - if (frequency > 120 || frequency < 0) - throw new ArgumentOutOfRangeException(nameof(frequency)); - - this.frequency = frequency; - } - - /// <summary> - /// Adds a bot to the <see cref="botProcesses"/> list if the index is not there already. - /// </summary> - private void RegisterBot(string name, int team, int index) - { - // Only add a bot if botProcesses doesn't contain the index given in the parameters. - if (botProcesses.Any(b => b.bot.Index == index)) - return; - - AutoResetEvent botRunEvent = new AutoResetEvent(false); - - // Create a bot instance, run it in a separate thread, and add it to botProcesses. - T bot = (T) Activator.CreateInstance(typeof(T), name, team, index); - Thread thread = new Thread(() => RunBot(bot, botRunEvent)); - thread.Start(); - - BotProcess botProcess = new BotProcess() - { - bot = bot, - thread = thread, - botRunEvent = botRunEvent - }; - - botProcesses.Add(botProcess); - Console.WriteLine($"Registered bot: name={name}, team={team}, index={index}"); - } - - /// <summary> - /// Calls the given bot's <see cref="Bot.GetOutput(GameTickPacket)"/> method and - /// updates its input through the interface DLL. - /// </summary> - private void RunBot(Bot bot, AutoResetEvent botRunEvent) - { - BotLoopRenderer renderer = GetRendererForBot(bot); - bot.Renderer = renderer; - - Console.WriteLine("Waiting for the RLBot Interface to initialize..."); - - while (!RLBotInterface.IsInitialized()) - Thread.Sleep(100); - - Console.WriteLine("The RLBot Interface has been successfully initialized!"); - Console.WriteLine("Running the bot loop..."); - - while (true) - { - try - { - renderer.StartPacket(); - GameTickPacket gameTickPacket = RLBotInterface.GetGameTickPacket(); - Controller botInput = bot.GetOutput(gameTickPacket); - RLBotInterface.SetBotInput(botInput, bot.Index); - renderer.FinishAndSendIfDifferent(); - } - catch (FlatbuffersPacketException) - { - // Ignore if the packet size is too small. No need to warn the user. - } - catch (Exception e) - { - // Don't crash the bot and give the user the details of the exception instead. - Console.WriteLine(e.GetType()); - Console.WriteLine(e.Message); - Console.WriteLine(e.StackTrace); - } - - botRunEvent.WaitOne(); - } - } - - /// <summary> - /// The main bot manager loop. This will continuously run the bots by setting <see cref="BotProcess.botRunEvent"/>. - /// </summary> - private void MainBotLoop() - { - if (frequency > 0) - { - // Retrieve packets at a fixed frequency. - - TimeSpan timerResolution = TimerResolutionInterop.CurrentResolution; - TimeSpan targetSleepTime = new TimeSpan(10000000 / frequency); - - Stopwatch stopwatch = new Stopwatch(); - while (true) - { - // Start the timer - stopwatch.Restart(); - - // Set off events that end up running the bot code later down the line - foreach (BotProcess proc in botProcesses) - { - proc.botRunEvent.Set(); - } - - // Sleep efficiently (but inaccurately) for as long as we can - TimeSpan maxInaccurateSleepTime = targetSleepTime - stopwatch.Elapsed - timerResolution; - if (maxInaccurateSleepTime > TimeSpan.Zero) - Thread.Sleep(maxInaccurateSleepTime); - - // We can sleep the rest of the time accurately with the use of a spin-wait, this will drastically reduce the amount of duplicate packets when running at higher frequencies. - while (stopwatch.Elapsed < targetSleepTime) ; - } - } - else - { - // Dynamically retrieve new packets. - while (true) - { - RLBotInterface.WaitForFreshPacket(100, 0); - - foreach (BotProcess proc in botProcesses) - { - proc.botRunEvent.Set(); - } - } - } - } - - /// <summary> - /// Stops the given bot's thread. - /// </summary> - /// <param name="botProcess">The bot process to stop.</param> - private void StopBotProcess(BotProcess botProcess) - { - botProcess.thread.Abort(); - Bot bot = botProcess.bot; - try - { - bot.Dispose(); - botProcess.botRunEvent.Dispose(); - } - catch (Exception e) - { - // Don't crash the bot and give the user the details of the exception instead. - Console.WriteLine("Bot threw an exception during termination."); - Console.WriteLine(e.GetType()); - Console.WriteLine(e.Message); - Console.WriteLine(e.StackTrace); - } - - Console.WriteLine($"Stopped bot: Name={bot.Name}, Team={bot.Team}, Index={bot.Index}"); - } - - /// <summary> - /// Start the server and be ready to manage the bots. - /// </summary> - /// <param name="port">The port that the manager listens to for the Python clients.</param> - public void Start(int port) - { - BotManagerServer server = new BotManagerServer(); - server.BotReceivedEvent += OnBotReceived; - serverThread = new Thread(() => server.Start(port)); - serverThread.Start(); - - // Don't start main loop until botProcesses has at least 1 bot - while (botProcesses.Count == 0) - Thread.Sleep(16); - - // Ensure best available resolution before starting the main loop to reduce CPU usage - TimerResolutionInterop.Query(out int minRes, out _, out int currRes); - if (currRes > minRes) TimerResolutionInterop.SetResolution(minRes); - - MainBotLoop(); - } - - /// <summary> - /// Method that is subscribed to <see cref="BotManagerServer.BotReceivedEvent"/>. - /// This method parses the event's message and calls the appropriate methods. - /// </summary> - /// <param name="message">The message from the event.</param> - private void OnBotReceived(string message) - { - try - { - string[] split = message.Split(new char[] {'\n'}, 5); - - if (split.Length < 2) - throw new Exception("Server received too few command arguments from client"); - - if (split[0] == "add") - { - PlaceInterfaceDlls(split[4]); - RegisterBot(split[1], int.Parse(split[2]), int.Parse(split[3])); - } - else if (split[0] == "remove") - { - int index = int.Parse(split[1]); - BotProcess proc = botProcesses.Find(b => b.bot.Index == index); - - // Only call the bot stopping/removing methods if proc references an object and not a default value. - // Referencing a default value happens when LINQ's Find method can't find any matches. - if (!proc.Equals(default(BotProcess))) - { - StopBotProcess(proc); - botProcesses.Remove(proc); - } - } - else - throw new Exception("Server received bad command from client: " + split[0]); - } - catch (Exception e) - { - Console.WriteLine(e.GetType()); - Console.WriteLine(e.Message); - Console.WriteLine(e.StackTrace); - } - } - - /// <summary> - /// Places the interface DLLs from the given directory into the bot's own DLL directory. - /// </summary> - /// <param name="dllDirectory">The directory to get the DLLs from</param> - private void PlaceInterfaceDlls(string dllDirectory) - { - if (Directory.Exists(dllDirectory)) - { - // The folder containing the bot runner executable MUST contain a dll folder containing an interface DLL. - // There is a 32 bit version and a 64 bit version of the interface DLL. - // We want to use the right one depending on the bitness we are running on. - string dllName; - if (Environment.Is64BitProcess) - dllName = "RLBot_Core_Interface.dll"; - else - dllName = "RLBot_Core_Interface_32.dll"; - - Directory.CreateDirectory("dll"); - try - { - File.Copy(Path.Combine(dllDirectory, dllName), RLBotInterface.InterfaceDllPath, true); - } - catch (IOException) - { - // DLL is being used, therefore don't copy. - } - } - } - - private BotLoopRenderer GetRendererForBot(Bot bot) - { - return _renderers.GetOrAdd(bot.Index, new BotLoopRenderer(bot.Index)); - } - } -}
\ No newline at end of file diff --git a/src/main/cs/RLBotDotNet/RLBotDotNet/Manager/BotProcess.cs b/src/main/cs/RLBotDotNet/RLBotDotNet/Manager/BotProcess.cs deleted file mode 100644 index 43cc2420..00000000 --- a/src/main/cs/RLBotDotNet/RLBotDotNet/Manager/BotProcess.cs +++ /dev/null @@ -1,11 +0,0 @@ -using System.Threading; - -namespace RLBotDotNet.Manager -{ - internal struct BotProcess - { - public Bot bot; - public Thread thread; - public AutoResetEvent botRunEvent; - } -}
\ No newline at end of file diff --git a/src/main/cs/RLBotDotNet/RLBotDotNet/Manager/TimerResolutionInterop.cs b/src/main/cs/RLBotDotNet/RLBotDotNet/Manager/TimerResolutionInterop.cs deleted file mode 100644 index 6e8538cc..00000000 --- a/src/main/cs/RLBotDotNet/RLBotDotNet/Manager/TimerResolutionInterop.cs +++ /dev/null @@ -1,19 +0,0 @@ -using System; -using System.Runtime.InteropServices; - -namespace RLBotDotNet.Utils -{ - public class TimerResolutionInterop - { - [DllImport("ntdll.dll", SetLastError = true)] - static extern int NtSetTimerResolution(int DesiredResolution, bool SetResolution, out int CurrentResolution); - public static void SetResolution(int desiredResolution) => NtSetTimerResolution(desiredResolution, true, out _); - - [DllImport("ntdll.dll", SetLastError = true)] - static extern int NtQueryTimerResolution(out int MinimumResolution, out int MaximumResolution, out int CurrentResolution); - public static void Query(out int minResolution, out int maxResolution, out int currResolution) => NtQueryTimerResolution(out minResolution, out maxResolution, out currResolution); - public static TimeSpan MinimumResolution { get { NtQueryTimerResolution(out int minRes, out _, out _); return new TimeSpan(minRes); } } - public static TimeSpan MaximumResolution { get { NtQueryTimerResolution(out _, out int maxRes, out _); return new TimeSpan(maxRes); } } - public static TimeSpan CurrentResolution { get { NtQueryTimerResolution(out _, out _, out int currRes); return new TimeSpan(currRes); } } - } -}
\ No newline at end of file diff --git a/src/main/cs/RLBotDotNet/RLBotDotNet/RLBotDotNet.csproj b/src/main/cs/RLBotDotNet/RLBotDotNet/RLBotDotNet.csproj deleted file mode 100644 index 1cffe05a..00000000 --- a/src/main/cs/RLBotDotNet/RLBotDotNet/RLBotDotNet.csproj +++ /dev/null @@ -1,89 +0,0 @@ -<Project Sdk="Microsoft.NET.Sdk"> - - <PropertyGroup> - <PackageId>RLBot.Framework</PackageId> - <Version>2.0.0</Version> - <Title>RLBot Framework</Title> - <Authors>Tangil Jahangir, Tyler Arehart, alion02, Whok, kipje13, ccman32, Brainlin</Authors> - <Company>RLBot</Company> - - <PackageLicenseExpression>MIT</PackageLicenseExpression> - <PackageProjectUrl>https://github.com/RLBot/RLBot</PackageProjectUrl> - <PackageIconUrl>https://raw.githubusercontent.com/RLBot/RLBot/master/src/main/cs/RLBotDotNet/RLBotDotNet/logo.png</PackageIconUrl> - <PackageIcon>logo.png</PackageIcon> - - <Description>RLBot is a framework for writing Rocket League bots in .NET languages.</Description> - <PackageReleaseNotes> - RLBot has been upgraded to .NET Standard 2.0, so you can now use .NET 5 with RLBot! - Please note that this release has **breaking changes**: - - The Renderer class uses System.Drawing.Color instead of System.Windows.Media.Color. - - The Bot class now has PascalCase for Name, Team, and Index. This is to keep it in line with common C# naming conventions. - For more information, visit the wiki: https://github.com/RLBot/RLBotCSharpExample/wiki/Upgrading-to-RLBotDotNet-2.x - </PackageReleaseNotes> - <Copyright>Copyright 2021</Copyright> - <PackageTags>rocket-league;rocketleague;ai;bot</PackageTags> - - <RepositoryUrl>https://github.com/RLBot/RLBot.git</RepositoryUrl> - <RepositoryType>git</RepositoryType> - <RepositoryBranch>master</RepositoryBranch> - - <IncludeSymbols>true</IncludeSymbols> - <SymbolPackageFormat>snupkg</SymbolPackageFormat> - - <GeneratePackageOnBuild>true</GeneratePackageOnBuild> - </PropertyGroup> - - <ItemGroup> - <None Include="logo.png"> - <Pack>true</Pack> - <PackagePath>\</PackagePath> - </None> - <None Include="FlatBuffers.dll"> - <Pack>true</Pack> - <PackagePath>lib\netstandard2.0</PackagePath> - </None> - </ItemGroup> - - <PropertyGroup> - <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> - <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform> - <ProjectGuid>{F97C012E-6C20-4E76-A075-6A274D73A69F}</ProjectGuid> - <OutputType>Library</OutputType> - <AppDesignerFolder>Properties</AppDesignerFolder> - <RootNamespace>RLBotDotNet</RootNamespace> - <AssemblyName>RLBotDotNet</AssemblyName> - <TargetFramework>netstandard2.0</TargetFramework> - <FileAlignment>512</FileAlignment> - </PropertyGroup> - - <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "> - <DebugSymbols>true</DebugSymbols> - <DebugType>full</DebugType> - <Optimize>false</Optimize> - <OutputPath>bin\Debug\</OutputPath> - <DefineConstants>DEBUG;TRACE</DefineConstants> - <ErrorReport>prompt</ErrorReport> - <WarningLevel>4</WarningLevel> - <DocumentationFile>bin\Debug\RLBotDotNet.xml</DocumentationFile> - </PropertyGroup> - - <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' "> - <DebugType>pdbonly</DebugType> - <Optimize>true</Optimize> - <OutputPath>bin\Release\</OutputPath> - <DefineConstants>TRACE</DefineConstants> - <ErrorReport>prompt</ErrorReport> - <WarningLevel>4</WarningLevel> - <DocumentationFile>bin\Release\RLBotDotNet.xml</DocumentationFile> - <NoWarn>CS1591</NoWarn> - </PropertyGroup> - - <ItemGroup> - <Reference Include="FlatBuffers, Version=1.0.0.0, Culture=neutral, processorArchitecture=AMD64"> - <SpecificVersion>False</SpecificVersion> - <HintPath>FlatBuffers.dll</HintPath> - </Reference> - <PackageReference Include="System.Numerics.Vectors" Version="4.5.0" /> - </ItemGroup> - -</Project> diff --git a/src/main/cs/RLBotDotNet/RLBotDotNet/Renderer/BotLoopRenderer.cs b/src/main/cs/RLBotDotNet/RLBotDotNet/Renderer/BotLoopRenderer.cs deleted file mode 100644 index cc0431d7..00000000 --- a/src/main/cs/RLBotDotNet/RLBotDotNet/Renderer/BotLoopRenderer.cs +++ /dev/null @@ -1,37 +0,0 @@ -using FlatBuffers; - -namespace RLBotDotNet.Renderer -{ - /// <summary> - /// Renderer for the bot loop. - /// </summary> - public class BotLoopRenderer : Renderer - { - private RenderPacket _previousPacket; - - internal BotLoopRenderer(int index) : base(index) - { - } - - /// <summary> - /// Starts the render packet. - /// </summary> - public void StartPacket() - { - Builder = new FlatBufferBuilder(1000); - } - - /// <summary> - /// Finishes the render packet and sends it if it's different from the last packet. - /// </summary> - public void FinishAndSendIfDifferent() - { - var packet = DoFinishPacket(); - if (!packet.Equals(_previousPacket)) - { - SendPacket(packet); - _previousPacket = packet; - } - } - } -}
\ No newline at end of file diff --git a/src/main/cs/RLBotDotNet/RLBotDotNet/Renderer/NamedRenderer.cs b/src/main/cs/RLBotDotNet/RLBotDotNet/Renderer/NamedRenderer.cs deleted file mode 100644 index 7fa7348b..00000000 --- a/src/main/cs/RLBotDotNet/RLBotDotNet/Renderer/NamedRenderer.cs +++ /dev/null @@ -1,37 +0,0 @@ -using FlatBuffers; - -namespace RLBotDotNet.Renderer -{ - /// <summary> - /// Renderer that uses a name as its index. - /// </summary> - public class NamedRenderer : Renderer - { - /// <summary> - /// Constructs a new instance of NamedRenderer using the render name as the index. - /// </summary> - /// <param name="renderName">The name to use as the render index.</param> - public NamedRenderer(string renderName) : base(renderName.GetHashCode()) { } - - /// <summary> - /// Starts the render packet. - /// </summary> - public void StartPacket() - { - Builder = new FlatBufferBuilder(1000); - } - - /// <summary> - /// Finishes and sends the render packet. - /// </summary> - public void FinishAndSend() - { - SendPacket(FinishPacket()); - } - - private RenderPacket FinishPacket() - { - return DoFinishPacket(); - } - } -}
\ No newline at end of file diff --git a/src/main/cs/RLBotDotNet/RLBotDotNet/Renderer/RenderPacket.cs b/src/main/cs/RLBotDotNet/RLBotDotNet/Renderer/RenderPacket.cs deleted file mode 100644 index b84068fb..00000000 --- a/src/main/cs/RLBotDotNet/RLBotDotNet/Renderer/RenderPacket.cs +++ /dev/null @@ -1,49 +0,0 @@ -using System; -using System.Collections; -using System.Collections.Generic; -using System.Linq; - -namespace RLBotDotNet.Renderer -{ - /// <summary> - /// Packet for render messages that get sent through the RLBot interface. - /// </summary> - public class RenderPacket - { - /// <summary> - /// Constructs a new instance of RenderPacket with the byte array of the render message. - /// </summary> - /// <param name="bytes">The bytes of the render message.</param> - public RenderPacket(byte[] bytes) - { - Bytes = bytes; - } - - /// <summary> - /// Gets the bytes of the render message. - /// </summary> - public byte[] Bytes { get; } - - /// <summary> - /// Determines the equality of the RenderPacket and the other object. - /// </summary> - /// <param name="obj">The object to test equality with.</param> - /// <returns>Returns true if the objects are equal, false otherwise.</returns> - public override bool Equals(object obj) - { - if (this == obj) return true; - if (obj == null || GetType() != obj.GetType()) return false; - RenderPacket that = (RenderPacket)obj; - return Bytes.SequenceEqual(that.Bytes); - } - - /// <summary> - /// Gets the hash code of the RenderPacket. - /// </summary> - /// <returns>Returns the hashcode of the RenderPacket.</returns> - public override int GetHashCode() - { - return ((IStructuralEquatable)Bytes).GetHashCode(EqualityComparer<byte>.Default); - } - } -}
\ No newline at end of file diff --git a/src/main/cs/RLBotDotNet/RLBotDotNet/Renderer/Renderer.cs b/src/main/cs/RLBotDotNet/RLBotDotNet/Renderer/Renderer.cs deleted file mode 100644 index a8182e47..00000000 --- a/src/main/cs/RLBotDotNet/RLBotDotNet/Renderer/Renderer.cs +++ /dev/null @@ -1,405 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Numerics; -using FlatBuffers; -using rlbot.flat; -using RLBotDotNet.Common; -using RLBotDotNet.Utils; -using Color = System.Drawing.Color; -using Vector3 = System.Numerics.Vector3; - -namespace RLBotDotNet.Renderer -{ - /// <summary> - /// Base Renderer used to draw in the game. - /// </summary> - public abstract class Renderer - { - private readonly int _index; - private readonly List<Offset<RenderMessage>> _renderMessageOffsets; - - /// <summary> - /// Constructs a new instance of Renderer with the index of the renderer. - /// </summary> - /// <param name="index">The index of the renderer.</param> - protected Renderer(int index) - { - _renderMessageOffsets = new List<Offset<RenderMessage>>(); - _index = index; - } - - /// <summary> - /// Gets and sets the FlatBufferBuilder used to build the render messages. - /// </summary> - protected FlatBufferBuilder Builder { get; set; } - - /// <summary> - /// Removes any draw calls that have been queued up and starts over. - /// Can be called at any time. - /// </summary> - public void ResetPacket() - { - Builder = null; - _renderMessageOffsets.Clear(); - } - - /// <summary> - /// If this renderer has previously drawn anything on the screen, it will be erased. - /// This can be called at any time. It will not interrupt any packet construction - /// that may be in progress. - /// </summary> - public void EraseFromScreen() - { - var eraseBuilder = new FlatBufferBuilder(10); - var vectorOffset = RenderGroup.CreateRenderMessagesVector(eraseBuilder, new Offset<RenderMessage>[0]); - RenderGroup.StartRenderGroup(eraseBuilder); - RenderGroup.AddRenderMessages(eraseBuilder, vectorOffset); - RenderGroup.AddId(eraseBuilder, _index); - eraseBuilder.Finish(RenderGroup.EndRenderGroup(eraseBuilder).Value); - - RenderPacket emptyPacket = new RenderPacket(eraseBuilder.SizedByteArray()); - SendPacket(emptyPacket); - } - - /// <summary> - /// Returns true if any draw calls have been queued up for the current packet. - /// </summary> - /// <returns></returns> - public bool HasContent() - { - return Builder != null && Builder.Offset > 0; - } - - /// <summary> - /// Draws a line in screen space. - /// </summary> - /// <param name="color">The color of the line.</param> - /// <param name="start">The start point of the line.</param> - /// <param name="end">The end point of the line.</param> - public void DrawLine2D(Color color, Vector2 start, Vector2 end) - { - var colorOffset = color.ToOffsetColor(Builder); - - RenderMessage.StartRenderMessage(Builder); - RenderMessage.AddRenderType(Builder, RenderType.DrawLine2D); - RenderMessage.AddColor(Builder, colorOffset); - RenderMessage.AddStart(Builder, start.ToOffsetVector(Builder)); - RenderMessage.AddEnd(Builder, end.ToOffsetVector(Builder)); - var finalOffset = RenderMessage.EndRenderMessage(Builder); - - _renderMessageOffsets.Add(finalOffset); - } - - /// <summary> - /// Draws a line joined by several points in screen space. - /// </summary> - /// <param name="color">The color of the line.</param> - /// <param name="vectors">The vectors of the line.</param> - public void DrawPolyLine2D(Color color, Vector2[] vectors) - { - if (vectors.Length < 2) - { - throw new ArgumentException("DrawPolyLine2D: vectors array must contain at least 2 vectors!"); - } - - var colorOffset = color.ToOffsetColor(Builder); - - for (int i = 0; i < vectors.Length - 1; i++) - { - RenderMessage.StartRenderMessage(Builder); - RenderMessage.AddRenderType(Builder, RenderType.DrawLine2D); - RenderMessage.AddColor(Builder, colorOffset); - RenderMessage.AddStart(Builder, vectors[i].ToOffsetVector(Builder)); - RenderMessage.AddEnd(Builder, vectors[i + 1].ToOffsetVector(Builder)); - var finalOffset = RenderMessage.EndRenderMessage(Builder); - _renderMessageOffsets.Add(finalOffset); - } - } - - /// <summary> - /// Draws a line between two points in world space. - /// </summary> - /// <param name="color">The color of the line.</param> - /// <param name="start">The start point of the line.</param> - /// <param name="end">The end point of the line.</param> - public void DrawLine3D(Color color, Vector3 start, Vector3 end) - { - var colorOffset = color.ToOffsetColor(Builder); - - RenderMessage.StartRenderMessage(Builder); - RenderMessage.AddRenderType(Builder, RenderType.DrawLine3D); - RenderMessage.AddColor(Builder, colorOffset); - RenderMessage.AddStart(Builder, start.ToOffsetVector(Builder)); - RenderMessage.AddEnd(Builder, end.ToOffsetVector(Builder)); - var finalOffset = RenderMessage.EndRenderMessage(Builder); - - _renderMessageOffsets.Add(finalOffset); - } - - /// <summary> - /// Draws a line joined by several points in world space. - /// </summary> - /// <param name="color">The color of the line.</param> - /// <param name="vectors">The vectors of the line.</param> - public void DrawPolyLine3D(Color color, Vector3[] vectors) - { - if (vectors.Length < 2) - { - throw new ArgumentException("DrawPolyLine3D: vectors array must contain at least 2 vectors!"); - } - - var colorOffset = color.ToOffsetColor(Builder); - - for (int i = 0; i < vectors.Length - 1; i++) - { - RenderMessage.StartRenderMessage(Builder); - RenderMessage.AddRenderType(Builder, RenderType.DrawLine3D); - RenderMessage.AddColor(Builder, colorOffset); - RenderMessage.AddStart(Builder, vectors[i].ToOffsetVector(Builder)); - RenderMessage.AddEnd(Builder, vectors[i + 1].ToOffsetVector(Builder)); - var finalOffset = RenderMessage.EndRenderMessage(Builder); - _renderMessageOffsets.Add(finalOffset); - } - } - - /// <summary> - /// Draws a line between two points in world space. - /// </summary> - /// <param name="color">The color of the line.</param> - /// <param name="start">The start point of the line.</param> - /// <param name="end">The end point of the line.</param> - public void DrawLine3D(Color color, rlbot.flat.Vector3 start, rlbot.flat.Vector3 end) - { - DrawLine3D(color, new Vector3(start.X, start.Y, start.Z), new Vector3(end.X, end.Y, end.Z)); - } - - /// <summary> - /// Draws a line joined by several points in screen space. - /// </summary> - /// <param name="color">The color of the line.</param> - /// <param name="vectors">The vectors of the line.</param> - public void DrawPolyLine3D(Color color, rlbot.flat.Vector3[] vectors) - { - Vector3[] outVectors = new Vector3[vectors.Length]; - for (int i = 0; i < vectors.Length; i++) - { - outVectors[i] = new Vector3(vectors[i].X, vectors[i].Y, vectors[i].Z); - } - - DrawPolyLine3D(color, outVectors); - } - - /// <summary> - /// Draws a 2D line which starts at a screen coordinate and ends at a world coordinate. - /// </summary> - /// <param name="color">The color of the line.</param> - /// <param name="start">The start point of the line.</param> - /// <param name="end">The end point of the line.</param> - public void DrawLine2D3D(Color color, Vector2 start, Vector3 end) - { - var colorOffset = color.ToOffsetColor(Builder); - - RenderMessage.StartRenderMessage(Builder); - RenderMessage.AddRenderType(Builder, RenderType.DrawLine2D_3D); - RenderMessage.AddColor(Builder, colorOffset); - RenderMessage.AddStart(Builder, start.ToOffsetVector(Builder)); - RenderMessage.AddEnd(Builder, end.ToOffsetVector(Builder)); - var finalOffset = RenderMessage.EndRenderMessage(Builder); - - _renderMessageOffsets.Add(finalOffset); - } - - /// <summary> - /// Draws a 2D line which starts at a screen coordinate and ends at a 3D coordinate. - /// </summary> - /// <param name="color">The color of the line.</param> - /// <param name="start">The start point of the line.</param> - /// <param name="end">The end point of the line.</param> - public void DrawLine2D3D(Color color, Vector2 start, rlbot.flat.Vector3 end) - { - DrawLine2D3D(color, start, new Vector3(end.X, end.Y, end.Z)); - } - - /// <summary> - /// Draws a 2D rectangle in screen space. - /// </summary> - /// <param name="color">The color of the rectangle.</param> - /// <param name="upperLeft">The upper left corner of the rectangle.</param> - /// <param name="width">The width in pixels.</param> - /// <param name="height">The height in pixels</param> - /// <param name="filled">Flag indicating whether the rectangle should be filled in</param> - public void DrawRectangle2D(Color color, Vector2 upperLeft, int width, int height, bool filled) - { - var colorOffset = color.ToOffsetColor(Builder); - - RenderMessage.StartRenderMessage(Builder); - RenderMessage.AddRenderType(Builder, RenderType.DrawRect2D); - RenderMessage.AddColor(Builder, colorOffset); - RenderMessage.AddStart(Builder, upperLeft.ToOffsetVector(Builder)); - RenderMessage.AddScaleX(Builder, width); - RenderMessage.AddScaleY(Builder, height); - RenderMessage.AddIsFilled(Builder, filled); - var finalOffset = RenderMessage.EndRenderMessage(Builder); - - _renderMessageOffsets.Add(finalOffset); - } - - /// <summary> - /// Draws a 2D rectangle at a 3D-tracked position in world space. - /// </summary> - /// <param name="color">The color of the rectangle.</param> - /// <param name="upperLeft">The upper left corner of the rectangle.</param> - /// <param name="width">The width in pixels.</param> - /// <param name="height">The height in pixels</param> - /// <param name="filled">Flag indicating whether the rectangle should be filled in</param> - public void DrawRectangle3D(Color color, Vector3 upperLeft, int width, int height, bool filled) - { - DrawRect3D(color, upperLeft, width, height, filled, false); - } - - /// <summary> - /// Draws a 2D rectangle at a 3D-tracked position in world space. - /// </summary> - /// <param name="color">The color of the rectangle.</param> - /// <param name="position">The upper left corner of the rectangle.</param> - /// <param name="width">The width in pixels.</param> - /// <param name="height">The height in pixels</param> - /// <param name="filled">Flag indicating whether the rectangle should be filled in</param> - public void DrawRectangle3D(Color color, rlbot.flat.Vector3 position, int width, int height, bool filled) - { - DrawRectangle3D(color, new Vector3(position.X, position.Y, position.Z), width, height, filled); - } - - /// <summary> - /// Draws a 2D rectangle at a 3D-tracked position in world space.<br/> - /// The given position is center of the rectangle. - /// </summary> - /// <param name="color">The color of the rectangle.</param> - /// <param name="position">The center of the rectangle.</param> - /// <param name="width">The width in pixels.</param> - /// <param name="height">The height in pixels</param> - /// <param name="filled">Flag indicating whether the rectangle should be filled in</param> - public void DrawCenteredRectangle3D(Color color, Vector3 position, int width, int height, bool filled) - { - DrawRect3D(color, position, width, height, filled, true); - } - - /// <summary> - /// Draws a 2D rectangle at a 3D-tracked position in world space.<br/> - /// The given position is center of the rectangle. - /// </summary> - /// <param name="color">The color of the rectangle.</param> - /// <param name="position">The center of the rectangle.</param> - /// <param name="width">The width in pixels.</param> - /// <param name="height">The height in pixels</param> - /// <param name="filled">Flag indicating whether the rectangle should be filled in</param> - public void DrawCenteredRectangle3D(Color color, rlbot.flat.Vector3 position, int width, int height, bool filled) - { - DrawCenteredRectangle3D(color, new Vector3(position.X, position.Y, position.Z), width, height, filled); - } - - /// <summary> - /// Draws text in screen space. - /// </summary> - /// <param name="text">The text to draw.</param> - /// <param name="color">The color of the string.</param> - /// <param name="upperLeft">The location of the upper left corner of the text.</param> - /// <param name="scaleX">The multiplier for the width of the text.</param> - /// <param name="scaleY">The multiplier for the height of the text</param> - public void DrawString2D(String text, Color color, Vector2 upperLeft, int scaleX, int scaleY) - { - var colorOffset = color.ToOffsetColor(Builder); - var textOffset = Builder.CreateString(text); - - RenderMessage.StartRenderMessage(Builder); - RenderMessage.AddRenderType(Builder, RenderType.DrawString2D); - RenderMessage.AddColor(Builder, colorOffset); - RenderMessage.AddStart(Builder, upperLeft.ToOffsetVector(Builder)); - RenderMessage.AddScaleX(Builder, scaleX); - RenderMessage.AddScaleY(Builder, scaleY); - RenderMessage.AddText(Builder, textOffset); - var finalOffset = RenderMessage.EndRenderMessage(Builder); - - _renderMessageOffsets.Add(finalOffset); - } - - /// <summary> - /// Draws text in 2D, but the upper-left corner is at a 3D-tracked position in world space. - /// </summary> - /// <param name="text">The text to draw.</param> - /// <param name="color">The color of the string.</param> - /// <param name="upperLeft">The location of the upper left corner of the text.</param> - /// <param name="scaleX">The multiplier for the width of the text.</param> - /// <param name="scaleY">The multiplier for the height of the text</param> - public void DrawString3D(String text, Color color, Vector3 upperLeft, int scaleX, int scaleY) - { - var colorOffset = color.ToOffsetColor(Builder); - var textOffset = Builder.CreateString(text); - - RenderMessage.StartRenderMessage(Builder); - RenderMessage.AddRenderType(Builder, RenderType.DrawString3D); - RenderMessage.AddColor(Builder, colorOffset); - RenderMessage.AddStart(Builder, upperLeft.ToOffsetVector(Builder)); - RenderMessage.AddScaleX(Builder, scaleX); - RenderMessage.AddScaleY(Builder, scaleY); - RenderMessage.AddText(Builder, textOffset); - var finalOffset = RenderMessage.EndRenderMessage(Builder); - - _renderMessageOffsets.Add(finalOffset); - } - - /// <summary> - /// Draws text in 2D, but the upper-left corner is at a 3D-tracked position in world space. - /// </summary> - /// <param name="text">The text to draw.</param> - /// <param name="color">The color of the string.</param> - /// <param name="upperLeft">The location of the upper left corner of the text.</param> - /// <param name="scaleX">The multiplier for the width of the text.</param> - /// <param name="scaleY">The multiplier for the height of the text</param> - public void DrawString3D(String text, Color color, rlbot.flat.Vector3 upperLeft, int scaleX, int scaleY) - { - DrawString3D(text, color, new Vector3(upperLeft.X, upperLeft.Y, upperLeft.Z), scaleX, scaleY); - } - - private void DrawRect3D(Color color, Vector3 position, int width, int height, bool filled, bool centered) - { - var colorOffset = color.ToOffsetColor(Builder); - RenderMessage.StartRenderMessage(Builder); - RenderMessage.AddRenderType(Builder, centered ? RenderType.DrawCenteredRect3D : RenderType.DrawRect3D); - RenderMessage.AddColor(Builder, colorOffset); - RenderMessage.AddStart(Builder, position.ToOffsetVector(Builder)); - RenderMessage.AddScaleX(Builder, width); - RenderMessage.AddScaleY(Builder, height); - RenderMessage.AddIsFilled(Builder, filled); - var finalOffset = RenderMessage.EndRenderMessage(Builder); - - _renderMessageOffsets.Add(finalOffset); - } - - /// <summary> - /// Sends the render packet to the RLBot interface. - /// </summary> - /// <param name="packet">The packet to send.</param> - protected void SendPacket(RenderPacket packet) - { - RLBotInterface.RenderPacket(packet); - } - - /// <summary> - /// Finishes the render packet and returns the complete packet. - /// </summary> - /// <returns>Returns the completed render packet.</returns> - protected RenderPacket DoFinishPacket() - { - var offsets = _renderMessageOffsets.ToArray(); - var messagesOffset = RenderGroup.CreateRenderMessagesVector(Builder, offsets); - var renderGroupOffset = RenderGroup.CreateRenderGroup(Builder, messagesOffset, _index); - - Builder.Finish(renderGroupOffset.Value); - var bytes = Builder.SizedByteArray(); - - ResetPacket(); - return new RenderPacket(bytes); - } - } -}
\ No newline at end of file diff --git a/src/main/cs/RLBotDotNet/RLBotDotNet/Server/BotManagerServer.cs b/src/main/cs/RLBotDotNet/RLBotDotNet/Server/BotManagerServer.cs deleted file mode 100644 index 735b9808..00000000 --- a/src/main/cs/RLBotDotNet/RLBotDotNet/Server/BotManagerServer.cs +++ /dev/null @@ -1,75 +0,0 @@ -using System; -using System.Net; -using System.Net.Sockets; -using System.Text; - -namespace RLBotDotNet.Server -{ - /// <summary> - /// Used for running a server to get bot data from Python clients.<br/> - /// E.g. Will receive "add MyBot 1 3 ", which means "Add a bot called MyBot to team 1 with index 3". - /// </summary> - public class BotManagerServer - { - private TcpListener listener; - public event Action<string> BotReceivedEvent; - - /// <summary> - /// Event that gets raised whenever a message is received from the Python client. - /// </summary> - protected virtual void OnBotReceived(string message) - { - if (!string.IsNullOrEmpty(message)) - BotReceivedEvent?.Invoke(message); - } - - /// <summary> - /// Starts the server, which continuously listens for clients until it is stopped. - /// </summary> - /// <param name="port">The port to run the server on.</param> - public void Start(int port) - { - if (listener != null) - { - Console.WriteLine("Cannot start the server as it is already running!"); - return; - } - - listener = new TcpListener(IPAddress.Parse("127.0.0.1"), port); - listener.Start(); - - Console.WriteLine($"Listening for clients on 127.0.0.1 on port {port}..."); - - while (true) - { - TcpClient client = listener.AcceptTcpClient(); - NetworkStream stream = client.GetStream(); - byte[] buffer = new byte[client.ReceiveBufferSize]; - int bytes = stream.Read(buffer, 0, client.ReceiveBufferSize); - - string receivedString = Encoding.ASCII.GetString(buffer, 0, bytes); - OnBotReceived(receivedString); - - // TODO: Do some verification to know that the data was sent correctly. - // E.g. Echo check - - client.Close(); - } - } - - /// <summary> - /// Stops the server if it is running. - /// </summary> - public void Stop() - { - if (listener == null) - { - Console.WriteLine("Cannot stop the server as it is not running!"); - return; - } - - listener.Stop(); - listener = null; - } - } -}
\ No newline at end of file diff --git a/src/main/cs/RLBotDotNet/RLBotDotNet/Server/BotReceivedEventArgs.cs b/src/main/cs/RLBotDotNet/RLBotDotNet/Server/BotReceivedEventArgs.cs deleted file mode 100644 index 0272c013..00000000 --- a/src/main/cs/RLBotDotNet/RLBotDotNet/Server/BotReceivedEventArgs.cs +++ /dev/null @@ -1,17 +0,0 @@ -using System; - -namespace RLBotDotNet.Server -{ - /// <summary> - /// Event arguments that contain the message of the client to the server. - /// </summary> - public class BotReceivedEventArgs : EventArgs - { - public string message; - - public BotReceivedEventArgs(string eventMessage) - { - message = eventMessage; - } - } -}
\ No newline at end of file diff --git a/src/main/cs/RLBotDotNet/RLBotDotNet/logo.png b/src/main/cs/RLBotDotNet/RLBotDotNet/logo.png Binary files differdeleted file mode 100644 index 3bf0e645..00000000 --- a/src/main/cs/RLBotDotNet/RLBotDotNet/logo.png +++ /dev/null diff --git a/src/test/cs/TestBot/ExampleBot.cs b/src/test/cs/TestBot/ExampleBot.cs deleted file mode 100644 index 2902375c..00000000 --- a/src/test/cs/TestBot/ExampleBot.cs +++ /dev/null @@ -1,105 +0,0 @@ -using System; -using RLBotDotNet; -using RLBotDotNet.GameState; -using rlbot.flat; -using Color = System.Drawing.Color; - -namespace TestBot -{ - // We want to our bot to derive from Bot, and then implement its abstract methods. - class ExampleBot : Bot - { - // We want the constructor for ExampleBot to extend from Bot, but we don't want to add anything to it. - public ExampleBot(string botName, int botTeam, int botIndex) : base(botName, botTeam, botIndex) { } - - public override Controller GetOutput(GameTickPacket gameTickPacket) - { - // This controller object will be returned at the end of the method. - // This controller will contain all the inputs that we want the bot to perform. - Controller controller = new Controller(); - - // Wrap gameTickPacket retrieving in a try-catch so that the bot doesn't crash whenever a value isn't present. - // A value may not be present if it was not sent. - // These are nullables so trying to get them when they're null will cause errors, therefore we wrap in try-catch. - try - { - // Store the required data from the gameTickPacket. - Vector3 ballLocation = gameTickPacket.Ball.Value.Physics.Value.Location.Value; - Vector3 carLocation = gameTickPacket.Players(this.Index).Value.Physics.Value.Location.Value; - Rotator carRotation = gameTickPacket.Players(this.Index).Value.Physics.Value.Rotation.Value; - - // Calculate to get the angle from the front of the bot's car to the ball. - double botToTargetAngle = Math.Atan2(ballLocation.Y - carLocation.Y, ballLocation.X - carLocation.X); - double botFrontToTargetAngle = botToTargetAngle - carRotation.Yaw; - // Correct the angle - if (botFrontToTargetAngle < -Math.PI) - botFrontToTargetAngle += 2 * Math.PI; - if (botFrontToTargetAngle > Math.PI) - botFrontToTargetAngle -= 2 * Math.PI; - - // Decide which way to steer in order to get to the ball. - if (botFrontToTargetAngle > 0) - controller.Steer = 1; - else - controller.Steer = -1; - - Renderer.DrawLine3D(Color.FromArgb(255, 255, 0), ballLocation, carLocation); - - // Get the ball prediction data. - BallPrediction prediction = GetBallPrediction(); - - // Loop through every 10th point so we don't render too many lines. - for (int i = 10; i < prediction.SlicesLength; i += 10) - { - Vector3 pointA = prediction.Slices(i - 10).Value.Physics.Value.Location.Value; - Vector3 pointB = prediction.Slices(i).Value.Physics.Value.Location.Value; - - Renderer.DrawLine3D(Color.FromArgb(255, 0, 255), pointA, pointB); - } - - // Test out setting game state - GameState gameState = new GameState(); - - // Make the ball hover in midair - gameState.BallState.PhysicsState = new PhysicsState(location: new DesiredVector3(z: 300), velocity: new DesiredVector3(z: 10)); - - // If the ball stops moving, fling the car at it - Vector3 ballVelocity = gameTickPacket.Ball.Value.Physics.Value.Velocity.Value; - if (ballVelocity.X * ballVelocity.X + ballVelocity.Y * ballVelocity.Y < 100000 && carLocation.Z < 100) - { - PhysicsState carPhysicsState = gameState.GetCarState(Index).PhysicsState; - carPhysicsState.Location = new DesiredVector3(ballLocation.X - 300, ballLocation.Y, 400); - carPhysicsState.Velocity = new DesiredVector3(500, 0, 0); - - if (gameTickPacket.Ball?.LatestTouch?.PlayerIndex is int playerIndex) - { - Console.WriteLine("Latest touch by " + playerIndex); - } - - MatchSettings matchSettings = GetMatchSettings(); - Console.WriteLine("Map: " + matchSettings.GameMap); - } - - SetGameState(gameState); - } - catch (Exception e) - { - Console.WriteLine(e.Message); - Console.WriteLine(e.StackTrace); - } - - // Set the throttle to 1 so the bot can move. - controller.Throttle = 1; - - controller.UseItem = controller.Steer > 0; // Spam items - - return controller; - } - - public override void Dispose() - { - // This bot doesn't initialize any resources that cannot be automatically released by the managed runtime (threads, various IDisposables, etc.). - // If it did, then it would release them here. - } - } -} diff --git a/src/test/cs/TestBot/Program.cs b/src/test/cs/TestBot/Program.cs deleted file mode 100644 index bdad56ff..00000000 --- a/src/test/cs/TestBot/Program.cs +++ /dev/null @@ -1,21 +0,0 @@ -using RLBotDotNet; -using System.IO; - -namespace TestBot -{ - class Program - { - static void Main(string[] args) - { - // Read the port from port.cfg. - const string file = "Python\\port.cfg"; - string text = File.ReadAllLines(file)[0]; - int port = int.Parse(text); - - // BotManager is a generic which takes in your bot as its T type. - BotManager<ExampleBot> botManager = new BotManager<ExampleBot>(0); - // Start the server on the port given in the port.cfg file. - botManager.Start(port); - } - } -} diff --git a/src/test/cs/TestBot/Python/TestBot.cfg b/src/test/cs/TestBot/Python/TestBot.cfg deleted file mode 100644 index 7a430cfd..00000000 --- a/src/test/cs/TestBot/Python/TestBot.cfg +++ /dev/null @@ -1,12 +0,0 @@ -[Locations] -# Path to loadout config. Can use relative path from here. -looks_config = ./appearance.cfg - -# Path to python file. Can use relative path from here. -python_file = ./TestBot.py - -# Name of the bot in-game -name = CSharpTestBot - -[Bot Parameters] -#dotnet_executable_path = <The relative path to your .exe>
\ No newline at end of file diff --git a/src/test/cs/TestBot/Python/TestBot.py b/src/test/cs/TestBot/Python/TestBot.py deleted file mode 100644 index b5b65359..00000000 --- a/src/test/cs/TestBot/Python/TestBot.py +++ /dev/null @@ -1,21 +0,0 @@ -import os - -from rlbot.agents.base_agent import BOT_CONFIG_AGENT_HEADER -from rlbot.agents.base_dotnet_agent import BaseDotNetAgent -from rlbot.parsing.custom_config import ConfigHeader, ConfigObject - - -class DotNetBot(BaseDotNetAgent): - def get_port_file_path(self): - # Look for a port.cfg file in the same directory as THIS python file. - return os.path.realpath(os.path.join(os.getcwd(), os.path.dirname(__file__), 'port.cfg')) - - def load_config(self, config_header: ConfigHeader): - self.dotnet_executable_path = config_header.getpath('dotnet_executable_path') - self.logger.info(".NET executable is configured as {}".format(self.dotnet_executable_path)) - - @staticmethod - def create_agent_configurations(config: ConfigObject): - params = config.get_header(BOT_CONFIG_AGENT_HEADER) - params.add_value('dotnet_executable_path', str, default=None, - description='Relative path to the executable that runs the .NET executable.')
\ No newline at end of file diff --git a/src/test/cs/TestBot/Python/appearance.cfg b/src/test/cs/TestBot/Python/appearance.cfg deleted file mode 100644 index c52678ae..00000000 --- a/src/test/cs/TestBot/Python/appearance.cfg +++ /dev/null @@ -1,49 +0,0 @@ -[Bot Loadout] -team_color_id = 60 -custom_color_id = 0 -car_id = 23 -decal_id = 0 -wheels_id = 1565 -boost_id = 35 -antenna_id = 0 -hat_id = 0 -paint_finish_id = 1681 -custom_finish_id = 1681 -engine_audio_id = 0 -trails_id = 3220 -goal_explosion_id = 3018 - -[Bot Loadout Orange] -team_color_id = 3 -custom_color_id = 0 -car_id = 23 -decal_id = 0 -wheels_id = 1565 -boost_id = 35 -antenna_id = 0 -hat_id = 0 -paint_finish_id = 1681 -custom_finish_id = 1681 -engine_audio_id = 0 -trails_id = 3220 -goal_explosion_id = 3018 - -[Bot Paint Blue] -car_paint_id = 12 -decal_paint_id = 0 -wheels_paint_id = 7 -boost_paint_id = 7 -antenna_paint_id = 0 -hat_paint_id = 0 -trails_paint_id = 2 -goal_explosion_paint_id = 0 - -[Bot Paint Orange] -car_paint_id = 12 -decal_paint_id = 0 -wheels_paint_id = 14 -boost_paint_id = 14 -antenna_paint_id = 0 -hat_paint_id = 0 -trails_paint_id = 14 -goal_explosion_paint_id = 0
\ No newline at end of file diff --git a/src/test/cs/TestBot/Python/port.cfg b/src/test/cs/TestBot/Python/port.cfg deleted file mode 100644 index d5f18f57..00000000 --- a/src/test/cs/TestBot/Python/port.cfg +++ /dev/null @@ -1 +0,0 @@ -55673 diff --git a/src/test/cs/TestBot/TestBot.csproj b/src/test/cs/TestBot/TestBot.csproj deleted file mode 100644 index 368e1b23..00000000 --- a/src/test/cs/TestBot/TestBot.csproj +++ /dev/null @@ -1,24 +0,0 @@ -<Project Sdk="Microsoft.NET.Sdk"> - <PropertyGroup> - <TargetFramework>net5.0</TargetFramework> - <OutputType>Exe</OutputType> - <GenerateAssemblyInfo>true</GenerateAssemblyInfo> - </PropertyGroup> - - <ItemGroup> - <ProjectReference Include="..\..\..\main\cs\RLBotDotNet\RLBotDotNet\RLBotDotNet.csproj" /> - </ItemGroup> - - <ItemGroup> - <None Update="Python\port.cfg"> - <CopyToOutputDirectory>Always</CopyToOutputDirectory> - </None> - <Content Include="Python\TestBot.py" /> - </ItemGroup> - - <ItemGroup> - <PackageReference Include="Microsoft.CSharp" Version="4.7.0" /> - <PackageReference Include="System.Data.DataSetExtensions" Version="4.5.0" /> - <PackageReference Include="System.Numerics.Vectors" Version="4.5.0" /> - </ItemGroup> -</Project>
\ No newline at end of file |