Skip to content

Commit

Permalink
Several enhancements, upgrades and new features! (#36)
Browse files Browse the repository at this point in the history
* Implement RenderAnchor

Update with Bridge refactors
Fix core crashing after any client suddenly closed

* Add GameState serialize from default regression test

* Update to new flatbuffers spec

* Replace `.editorconfig` with CSharpier-specific config

* Update `rl_ball_sym` binaries

* Much better heatseeker ball prediction

* Support for new flatbuffers spec

Small rewrite to `FlatBufferSession.cs` for safety & more async

* Update Bridge.dll

* Update BallPredictor.cs

* Use WmiLight instead of System.Management

* Spawn human in the last index

* Fix IsBot always being false

Fix unit ball pred unit test
Add more to player mapping test to prevent regression

* Add `PublishWmiLightStaticallyLinked` like the docs say

... just in case
  • Loading branch information
VirxEC authored Jul 15, 2024
1 parent 5965cb6 commit 154a67b
Show file tree
Hide file tree
Showing 32 changed files with 589 additions and 593 deletions.
4 changes: 4 additions & 0 deletions .csharpierrc.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
printWidth: 115
useTabs: false
tabWidth: 4
endOfLine: auto
221 changes: 0 additions & 221 deletions .editorconfig

This file was deleted.

59 changes: 31 additions & 28 deletions RLBotCS/Conversion/FlatToCommand.cs
Original file line number Diff line number Diff line change
Expand Up @@ -30,13 +30,25 @@ private static string MapMatchLength(MatchLength matchLength) =>
private static string MapMaxScore(MaxScore maxScore) =>
maxScore switch
{
MaxScore.Unlimited => "",
MaxScore.Default => "",
MaxScore.One_Goal => "Max1",
MaxScore.Three_Goals => "Max3",
MaxScore.Five_Goals => "Max5",
MaxScore.Seven_Goals => "Max7",
MaxScore.Unlimited => "UnlimitedScore",
_ => throw new ArgumentOutOfRangeException(nameof(maxScore), maxScore, null)
};

private static string MapMultiBall(MultiBall multiBall) =>
multiBall switch
{
MultiBall.One => "",
MultiBall.Two => "TwoBalls",
MultiBall.Four => "FourBalls",
MultiBall.Six => "SixBalls",
_ => throw new ArgumentOutOfRangeException(nameof(multiBall), multiBall, null)
};

private static string MapOvertime(OvertimeOption option) =>
option switch
{
Expand Down Expand Up @@ -82,6 +94,9 @@ private static string MapBallType(BallTypeOption option) =>
BallTypeOption.Cube => "Ball_CubeBall",
BallTypeOption.Puck => "Ball_Puck",
BallTypeOption.Basketball => "Ball_BasketBall",
BallTypeOption.Beachball => "Ball_BeachBall",
BallTypeOption.Anniversary => "Ball_Anniversary",
BallTypeOption.Haunted => "Ball_Haunted",
_ => throw new ArgumentOutOfRangeException(nameof(option), option, null)
};

Expand All @@ -92,6 +107,8 @@ private static string MapBallWeight(BallWeightOption option) =>
BallWeightOption.Light => "LightBall",
BallWeightOption.Heavy => "HeavyBall",
BallWeightOption.Super_Light => "SuperLightBall",
BallWeightOption.Curve_Ball => "MagnusBall",
BallWeightOption.Beach_Ball_Curve => "MagnusBeachBall",
_ => throw new ArgumentOutOfRangeException(nameof(option), option, null)
};

Expand Down Expand Up @@ -137,6 +154,8 @@ private static string MapRumble(RumbleOption option) =>
RumbleOption.Spring_Loaded => "ItemsModeSprings",
RumbleOption.Spikes_Only => "ItemsModeSpikes",
RumbleOption.Spike_Rush => "ItemsModeRugby",
RumbleOption.Haunted_Ball_Beam => "ItemsModeHauntedBallBeam",
RumbleOption.Tactical => "ItemsModeSelection",
_ => throw new ArgumentOutOfRangeException(nameof(option), option, null)
};

Expand All @@ -157,6 +176,7 @@ private static string MapGravity(GravityOption option) =>
GravityOption.Low => "LowGravity",
GravityOption.High => "HighGravity",
GravityOption.Super_High => "SuperGravity",
GravityOption.Reverse => "ReverseGravity",
_ => throw new ArgumentOutOfRangeException(nameof(option), option, null)
};

Expand All @@ -176,7 +196,7 @@ private static string MapRespawnTime(RespawnTimeOption option) =>
{
RespawnTimeOption.Three_Seconds => "",
RespawnTimeOption.Two_Seconds => "TwoSecondsRespawn",
RespawnTimeOption.One_Seconds => "OneSecondsRespawn",
RespawnTimeOption.One_Second => "OneSecondsRespawn",
RespawnTimeOption.Disable_Goal_Reset => "DisableGoalDelay",
_ => throw new ArgumentOutOfRangeException(nameof(option), option, null)
};
Expand Down Expand Up @@ -212,14 +232,18 @@ public static string MakeOpenCommand(MatchSettingsT matchSettings)
if (!matchSettings.InstantStart)
command += "?Playtest";

// Parse mutator settings
command += "?GameTags=PlayerCount8";

if (matchSettings.Freeplay)
command += ",Freeplay";

if (matchSettings.MutatorSettings is not { } mutatorSettings)
return command;

// Parse mutator settings
command += GetOption(MapMatchLength(mutatorSettings.MatchLength));
command += GetOption(MapMaxScore(mutatorSettings.MaxScore));
command += GetOption(MapMultiBall(mutatorSettings.MultiBall));
command += GetOption(MapOvertime(mutatorSettings.OvertimeOption));
command += GetOption(MapSeriesLength(mutatorSettings.SeriesLengthOption));
command += GetOption(MapGameSpeed(mutatorSettings.GameSpeedOption));
Expand All @@ -229,7 +253,7 @@ public static string MakeOpenCommand(MatchSettingsT matchSettings)
command += GetOption(MapBallSize(mutatorSettings.BallSizeOption));
command += GetOption(MapBallBounciness(mutatorSettings.BallBouncinessOption));
command += GetOption(MapBoost(mutatorSettings.BoostOption));
command += GetOption(MapRumble(mutatorSettings.RumbleOption)); //TODO - probably doesn't work
command += GetOption(MapRumble(mutatorSettings.RumbleOption));
command += GetOption(MapBoostStrength(mutatorSettings.BoostStrengthOption));
command += GetOption(MapGravity(mutatorSettings.GravityOption));
command += GetOption(MapDemolish(mutatorSettings.DemolishOption));
Expand All @@ -238,30 +262,9 @@ public static string MakeOpenCommand(MatchSettingsT matchSettings)
return command;
}

private static string MakeGameSpeedCommand(float gameSpeed) => "Set WorldInfo TimeDilation " + gameSpeed;

public static string MakeGameSpeedCommandFromOption(GameSpeedOption gameSpeed) =>
MakeGameSpeedCommand(
gameSpeed switch
{
GameSpeedOption.Slo_Mo => 0.5f,
GameSpeedOption.Time_Warp => 1.5f,
_ => 1.0f,
}
);

private static string MakeGravityCommand(float gravity) => "Set WorldInfo WorldGravityZ " + gravity;

public static string MakeGravityCommandFromOption(GravityOption gravityOption) =>
MakeGravityCommand(
gravityOption switch
{
GravityOption.Low => -325,
GravityOption.High => -1137.5f,
GravityOption.Super_High => -3250,
_ => -650,
}
);
public static string MakeGameSpeedCommand(float gameSpeed) => "Set WorldInfo TimeDilation " + gameSpeed;

public static string MakeGravityCommand(float gravity) => "Set WorldInfo WorldGravityZ " + gravity;

public static string MakeAutoSaveReplayCommand() => "QueSaveReplay";
}
Loading

0 comments on commit 154a67b

Please sign in to comment.