├── .gitignore
├── CSharpBot
├── Bot.sln
└── Bot
│ ├── App.config
│ ├── Bot.cs
│ ├── Bot.csproj
│ ├── Program.cs
│ ├── Properties
│ └── AssemblyInfo.cs
│ ├── Utilities
│ ├── DataConversion.cs
│ └── Processed
│ │ ├── BallPrediction
│ │ ├── BallPrediction.cs
│ │ └── PredictionSlice.cs
│ │ ├── FieldInfo
│ │ ├── BoostPad.cs
│ │ ├── FieldInfo.cs
│ │ └── GoalInfo.cs
│ │ └── Packet
│ │ ├── Ball.cs
│ │ ├── BoostPadState.cs
│ │ ├── GameInfo.cs
│ │ ├── Orientation.cs
│ │ ├── Packet.cs
│ │ ├── Physics.cs
│ │ ├── Player.cs
│ │ └── TeamInfo.cs
│ └── packages.config
├── LICENSE
├── PythonAgent
├── PythonAgent.cfg
├── PythonAgent.py
└── appearance.cfg
├── README.md
├── RefreshEnv.cmd
├── requirements.txt
├── rlbot.cfg
├── run.bat
└── run.py
/.gitignore:
--------------------------------------------------------------------------------
1 | # Byte-compiled / optimized / DLL files
2 | __pycache__/
3 | *.py[cod]
4 | *$py.class
5 |
6 | # C extensions
7 | *.so
8 |
9 | # Distribution / packaging
10 | .Python
11 | env/
12 | build/
13 | develop-eggs/
14 | dist/
15 | downloads/
16 | eggs/
17 | .eggs/
18 | lib/
19 | lib64/
20 | parts/
21 | sdist/
22 | var/
23 | wheels/
24 | *.egg-info/
25 | .installed.cfg
26 | *.egg
27 |
28 | # PyInstaller
29 | # Usually these files are written by a python script from a template
30 | # before PyInstaller builds the exe, so as to inject date/other infos into it.
31 | *.manifest
32 | *.spec
33 |
34 | # Installer logs
35 | pip-log.txt
36 | pip-delete-this-directory.txt
37 |
38 | # Unit test / coverage reports
39 | htmlcov/
40 | .tox/
41 | .coverage
42 | .coverage.*
43 | .cache
44 | nosetests.xml
45 | coverage.xml
46 | *.cover
47 | .hypothesis/
48 |
49 | # Translations
50 | *.mo
51 | *.pot
52 |
53 | # Django stuff:
54 | *.log
55 | local_settings.py
56 |
57 | # Flask stuff:
58 | instance/
59 | .webassets-cache
60 |
61 | # Scrapy stuff:
62 | .scrapy
63 |
64 | # Sphinx documentation
65 | docs/_build/
66 |
67 | # PyBuilder
68 | target/
69 |
70 | # Jupyter Notebook
71 | .ipynb_checkpoints
72 |
73 | # pyenv
74 | .python-version
75 |
76 | # celery beat schedule file
77 | celerybeat-schedule
78 |
79 | # SageMath parsed files
80 | *.sage.py
81 |
82 | # dotenv
83 | .env
84 |
85 | # virtualenv
86 | .venv
87 | venv/
88 | ENV/
89 |
90 | # Spyder project settings
91 | .spyderproject
92 | .spyproject
93 |
94 | # Rope project settings
95 | .ropeproject
96 |
97 | # mkdocs documentation
98 | /site
99 |
100 | # mypy
101 | .mypy_cache/
102 |
103 | # Intellij
104 | *.iml
105 | /.idea
106 |
107 | # Build output
108 | /build
109 |
110 | # Gradle files
111 | /.gradle
112 |
113 |
114 | ## Ignore Visual Studio temporary files, build results, and
115 | ## files generated by popular Visual Studio add-ons.
116 |
117 | # User-specific files
118 | *.suo
119 | *.user
120 | *.userosscache
121 | *.sln.docstates
122 |
123 | # User-specific files (MonoDevelop/Xamarin Studio)
124 | *.userprefs
125 |
126 | # Build results
127 | [Dd]ebug/
128 | [Dd]ebugPublic/
129 | [Rr]elease/
130 | [Rr]eleases/
131 | x64/
132 | x86/
133 | bld/
134 | [Bb]in/
135 | [Oo]bj/
136 | [Ll]og/
137 |
138 | # Visual Studio 2015 cache/options directory
139 | .vs/
140 | # Uncomment if you have tasks that create the project's static files in wwwroot
141 | #wwwroot/
142 |
143 | # MSTest test Results
144 | [Tt]est[Rr]esult*/
145 | [Bb]uild[Ll]og.*
146 |
147 | # NUNIT
148 | *.VisualState.xml
149 | TestResult.xml
150 |
151 | # Build Results of an ATL Project
152 | [Dd]ebugPS/
153 | [Rr]eleasePS/
154 | dlldata.c
155 |
156 | # DNX
157 | project.lock.json
158 | project.fragment.lock.json
159 | artifacts/
160 |
161 | *_i.c
162 | *_p.c
163 | *_i.h
164 | *.ilk
165 | *.meta
166 | *.obj
167 | *.pch
168 | *.pdb
169 | *.pgc
170 | *.pgd
171 | *.rsp
172 | *.sbr
173 | *.tlb
174 | *.tli
175 | *.tlh
176 | *.tmp
177 | *.tmp_proj
178 | *.log
179 | *.vspscc
180 | *.vssscc
181 | .builds
182 | *.pidb
183 | *.svclog
184 | *.scc
185 |
186 | # Chutzpah Test files
187 | _Chutzpah*
188 |
189 | # Visual C++ cache files
190 | ipch/
191 | *.aps
192 | *.ncb
193 | *.opendb
194 | *.opensdf
195 | *.sdf
196 | *.cachefile
197 | *.VC.db
198 | *.VC.VC.opendb
199 |
200 | # Visual Studio profiler
201 | *.psess
202 | *.vsp
203 | *.vspx
204 | *.sap
205 |
206 | # TFS 2012 Local Workspace
207 | $tf/
208 |
209 | # Guidance Automation Toolkit
210 | *.gpState
211 |
212 | # ReSharper is a .NET coding add-in
213 | _ReSharper*/
214 | *.[Rr]e[Ss]harper
215 | *.DotSettings.user
216 |
217 | # JustCode is a .NET coding add-in
218 | .JustCode
219 |
220 | # TeamCity is a build add-in
221 | _TeamCity*
222 |
223 | # DotCover is a Code Coverage Tool
224 | *.dotCover
225 |
226 | # NCrunch
227 | _NCrunch_*
228 | .*crunch*.local.xml
229 | nCrunchTemp_*
230 |
231 | # MightyMoose
232 | *.mm.*
233 | AutoTest.Net/
234 |
235 | # Web workbench (sass)
236 | .sass-cache/
237 |
238 | # Installshield output folder
239 | [Ee]xpress/
240 |
241 | # DocProject is a documentation generator add-in
242 | DocProject/buildhelp/
243 | DocProject/Help/*.HxT
244 | DocProject/Help/*.HxC
245 | DocProject/Help/*.hhc
246 | DocProject/Help/*.hhk
247 | DocProject/Help/*.hhp
248 | DocProject/Help/Html2
249 | DocProject/Help/html
250 |
251 | # Click-Once directory
252 | publish/
253 |
254 | # Publish Web Output
255 | *.[Pp]ublish.xml
256 | *.azurePubxml
257 | # TODO: Comment the next line if you want to checkin your web deploy settings
258 | # but database connection strings (with potential passwords) will be unencrypted
259 | #*.pubxml
260 | *.publishproj
261 |
262 | # Microsoft Azure Web App publish settings. Comment the next line if you want to
263 | # checkin your Azure Web App publish settings, but sensitive information contained
264 | # in these scripts will be unencrypted
265 | PublishScripts/
266 |
267 | # NuGet Packages
268 | *.nupkg
269 | # The packages folder can be ignored because of Package Restore
270 | **/packages/*
271 | # except build/, which is used as an MSBuild target.
272 | !**/packages/build/
273 | # Uncomment if necessary however generally it will be regenerated when needed
274 | #!**/packages/repositories.config
275 | # NuGet v3's project.json files produces more ignoreable files
276 | *.nuget.props
277 | *.nuget.targets
278 |
279 | # Microsoft Azure Build Output
280 | csx/
281 | *.build.csdef
282 |
283 | # Microsoft Azure Emulator
284 | ecf/
285 | rcf/
286 |
287 | # Windows Store app package directories and files
288 | AppPackages/
289 | BundleArtifacts/
290 | Package.StoreAssociation.xml
291 | _pkginfo.txt
292 |
293 | # Visual Studio cache files
294 | # files ending in .cache can be ignored
295 | *.[Cc]ache
296 | # but keep track of directories ending in .cache
297 | !*.[Cc]ache/
298 |
299 | # Others
300 | ClientBin/
301 | ~$*
302 | *~
303 | *.dbmdl
304 | *.dbproj.schemaview
305 | *.jfm
306 | *.pfx
307 | *.publishsettings
308 | node_modules/
309 | orleans.codegen.cs
310 |
311 | # Since there are multiple workflows, uncomment next line to ignore bower_components
312 | # (https://github.com/github/gitignore/pull/1529#issuecomment-104372622)
313 | #bower_components/
314 |
315 | # RIA/Silverlight projects
316 | Generated_Code/
317 |
318 | # Backup & report files from converting an old project file
319 | # to a newer Visual Studio version. Backup files are not needed,
320 | # because we have git ;-)
321 | _UpgradeReport_Files/
322 | Backup*/
323 | UpgradeLog*.XML
324 | UpgradeLog*.htm
325 |
326 | # SQL Server files
327 | *.mdf
328 | *.ldf
329 |
330 | # Business Intelligence projects
331 | *.rdl.data
332 | *.bim.layout
333 | *.bim_*.settings
334 |
335 | # Microsoft Fakes
336 | FakesAssemblies/
337 |
338 | # GhostDoc plugin setting file
339 | *.GhostDoc.xml
340 |
341 | # Node.js Tools for Visual Studio
342 | .ntvs_analysis.dat
343 |
344 | # Visual Studio 6 build log
345 | *.plg
346 |
347 | # Visual Studio 6 workspace options file
348 | *.opt
349 |
350 | # Visual Studio LightSwitch build output
351 | **/*.HTMLClient/GeneratedArtifacts
352 | **/*.DesktopClient/GeneratedArtifacts
353 | **/*.DesktopClient/ModelManifest.xml
354 | **/*.Server/GeneratedArtifacts
355 | **/*.Server/ModelManifest.xml
356 | _Pvt_Extensions
357 |
358 | # Paket dependency manager
359 | .paket/paket.exe
360 | paket-files/
361 |
362 | # FAKE - F# Make
363 | .fake/
364 |
365 | # JetBrains Rider
366 | .idea/
367 | *.sln.iml
368 |
369 | # CodeRush
370 | .cr/
371 |
372 | # Python Tools for Visual Studio (PTVS)
373 | __pycache__/
374 | *.pyc
--------------------------------------------------------------------------------
/CSharpBot/Bot.sln:
--------------------------------------------------------------------------------
1 |
2 | Microsoft Visual Studio Solution File, Format Version 12.00
3 | # Visual Studio 14
4 | VisualStudioVersion = 14.0.25420.1
5 | MinimumVisualStudioVersion = 10.0.40219.1
6 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Bot", "Bot\Bot.csproj", "{FFF07A01-2977-4C85-9224-BDB18E72C962}"
7 | EndProject
8 | Global
9 | GlobalSection(SolutionConfigurationPlatforms) = preSolution
10 | Debug|Any CPU = Debug|Any CPU
11 | Release|Any CPU = Release|Any CPU
12 | EndGlobalSection
13 | GlobalSection(ProjectConfigurationPlatforms) = postSolution
14 | {FFF07A01-2977-4C85-9224-BDB18E72C962}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
15 | {FFF07A01-2977-4C85-9224-BDB18E72C962}.Debug|Any CPU.Build.0 = Debug|Any CPU
16 | {FFF07A01-2977-4C85-9224-BDB18E72C962}.Release|Any CPU.ActiveCfg = Release|Any CPU
17 | {FFF07A01-2977-4C85-9224-BDB18E72C962}.Release|Any CPU.Build.0 = Release|Any CPU
18 | EndGlobalSection
19 | GlobalSection(SolutionProperties) = preSolution
20 | HideSolutionNode = FALSE
21 | EndGlobalSection
22 | GlobalSection(ExtensibilityGlobals) = postSolution
23 | SolutionGuid = {ED79FB0E-89E5-45C5-95E2-7085964183A9}
24 | EndGlobalSection
25 | EndGlobal
26 |
--------------------------------------------------------------------------------
/CSharpBot/Bot/App.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
--------------------------------------------------------------------------------
/CSharpBot/Bot/Bot.cs:
--------------------------------------------------------------------------------
1 | using System.Drawing;
2 | using System.Numerics;
3 | using Bot.Utilities.Processed.BallPrediction;
4 | using Bot.Utilities.Processed.FieldInfo;
5 | using Bot.Utilities.Processed.Packet;
6 | using RLBotDotNet;
7 |
8 | namespace Bot
9 | {
10 | // We want to our bot to derive from Bot, and then implement its abstract methods.
11 | class Bot : RLBotDotNet.Bot
12 | {
13 | // We want the constructor for our Bot to extend from RLBotDotNet.Bot, but we don't want to add anything to it.
14 | // You might want to add logging initialisation or other types of setup up here before the bot starts.
15 | public Bot(string botName, int botTeam, int botIndex) : base(botName, botTeam, botIndex) { }
16 |
17 | public override Controller GetOutput(rlbot.flat.GameTickPacket gameTickPacket)
18 | {
19 | // We process the gameTickPacket and convert it to our own internal data structure.
20 | Packet packet = new Packet(gameTickPacket);
21 |
22 | // Get the data required to drive to the ball.
23 | Vector3 ballLocation = packet.Ball.Physics.Location;
24 | Vector3 carLocation = packet.Players[Index].Physics.Location;
25 | Orientation carRotation = packet.Players[Index].Physics.Rotation;
26 |
27 | // Find where the ball is relative to us.
28 | Vector3 ballRelativeLocation = Orientation.RelativeLocation(carLocation, ballLocation, carRotation);
29 |
30 | // Decide which way to steer in order to get to the ball.
31 | // If the ball is to our left, we steer left. Otherwise we steer right.
32 | float steer;
33 | if (ballRelativeLocation.Y > 0)
34 | steer = 1;
35 | else
36 | steer = -1;
37 |
38 | // Examples of rendering in the game
39 | Renderer.DrawString3D("Ball", Color.Black, ballLocation, 3, 3);
40 | Renderer.DrawString3D(steer > 0 ? "Right" : "Left", Color.Aqua, carLocation, 3, 3);
41 | Renderer.DrawLine3D(Color.Red, carLocation, ballLocation);
42 |
43 | // This controller will contain all the inputs that we want the bot to perform.
44 | return new Controller
45 | {
46 | // Set the throttle to 1 so the bot can move.
47 | Throttle = 1,
48 | Steer = steer
49 | };
50 | }
51 |
52 | // Hide the old methods that return Flatbuffers objects and use our own methods that
53 | // use processed versions of those objects instead.
54 | internal new FieldInfo GetFieldInfo() => new FieldInfo(base.GetFieldInfo());
55 | internal new BallPrediction GetBallPrediction() => new BallPrediction(base.GetBallPrediction());
56 | }
57 | }
--------------------------------------------------------------------------------
/CSharpBot/Bot/Bot.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | Debug
6 | AnyCPU
7 | {FFF07A01-2977-4C85-9224-BDB18E72C962}
8 | Exe
9 | Bot
10 | Bot
11 | v4.6.1
12 | 512
13 | true
14 |
15 |
16 |
17 | AnyCPU
18 | true
19 | full
20 | false
21 | bin\Debug\
22 | DEBUG;TRACE
23 | prompt
24 | 4
25 |
26 |
27 | AnyCPU
28 | pdbonly
29 | true
30 | bin\Release\
31 | TRACE
32 | prompt
33 | 4
34 |
35 |
36 | true
37 | bin\x64\Debug\
38 | DEBUG;TRACE
39 | full
40 | x64
41 | prompt
42 | MinimumRecommendedRules.ruleset
43 | true
44 |
45 |
46 | bin\x64\Release\
47 | TRACE
48 | true
49 | pdbonly
50 | x64
51 | prompt
52 | MinimumRecommendedRules.ruleset
53 | true
54 |
55 |
56 |
57 | ..\packages\RLBot.Framework.2.0.0\lib\netstandard2.0\FlatBuffers.dll
58 |
59 |
60 |
61 | ..\packages\RLBot.Framework.2.0.0\lib\netstandard2.0\RLBotDotNet.dll
62 |
63 |
64 |
65 |
66 |
67 |
68 | ..\packages\System.Numerics.Vectors.4.5.0\lib\net46\System.Numerics.Vectors.dll
69 |
70 |
71 |
72 |
73 |
74 |
75 |
76 |
77 |
78 |
79 |
80 |
81 |
82 |
83 |
84 |
85 |
86 |
87 |
88 |
89 |
90 |
91 |
92 |
93 |
94 |
95 |
96 |
--------------------------------------------------------------------------------
/CSharpBot/Bot/Program.cs:
--------------------------------------------------------------------------------
1 | using System;
2 |
3 | namespace Bot
4 | {
5 | class Program
6 | {
7 | static void Main(string[] args)
8 | {
9 | int port;
10 | try
11 | {
12 | // Read the port from the first argument
13 | port = int.Parse(args[0]);
14 | }
15 | catch (Exception e)
16 | {
17 | // IDE instructions to add the port argument:
18 | // If you're trying to run in an IDE and have auto-run disabled (e.g. to use the debugger), look up the port
19 | // number used in PythonAgent.py in get_port()
20 |
21 | // If you're using Visual Studio:
22 | // Right-click the project, choose Properties, go to the Debug section -- there is a box for
23 | // "Command line arguments", enter the port there.
24 |
25 | // If you're using Rider:
26 | // Click the configuration dropdown to the left of the Run and Debug buttons (top right of the window),
27 | // choose Edit Configurations -- there is a box for "Program arguments", enter the port there.
28 |
29 | // Example of a port: 45031
30 |
31 |
32 | var currentColor = Console.ForegroundColor;
33 | Console.ForegroundColor = ConsoleColor.Red;
34 | Console.WriteLine(
35 | "Could not get port from arguments to C# bot!\n" +
36 | "If you're reading this message, it means that the C# bot did not receive a valid port in the command line " +
37 | "arguments.\n" +
38 | "If you have configured auto-run, the port should be given to the bot automatically. Otherwise, you'll " +
39 | "need to run the bot with the port every time (e.g. Bot.exe 45031). Note that this port should match the " +
40 | "one in PythonAgent/PythonAgent.py.\n" +
41 | "If you're trying to run the bot without auto-run in an IDE, see this source file " +
42 | "(CSharpBot/Bot/Program.cs) for IDE instructions."
43 | );
44 | Console.ForegroundColor = currentColor;
45 | throw;
46 | }
47 |
48 | RLBotDotNet.BotManager botManager = new RLBotDotNet.BotManager(0);
49 | // Start the server on the port given in the first argument
50 | botManager.Start(port);
51 | }
52 | }
53 | }
--------------------------------------------------------------------------------
/CSharpBot/Bot/Properties/AssemblyInfo.cs:
--------------------------------------------------------------------------------
1 | using System.Reflection;
2 | using System.Runtime.InteropServices;
3 |
4 | // General Information about an assembly is controlled through the following
5 | // set of attributes. Change these attribute values to modify the information
6 | // associated with an assembly.
7 | [assembly: AssemblyTitle("Bot")]
8 | [assembly: AssemblyDescription("")]
9 | [assembly: AssemblyConfiguration("")]
10 | [assembly: AssemblyCompany("")]
11 | [assembly: AssemblyProduct("Bot")]
12 | [assembly: AssemblyCopyright("Copyright © 2020")]
13 | [assembly: AssemblyTrademark("")]
14 | [assembly: AssemblyCulture("")]
15 |
16 | // Setting ComVisible to false makes the types in this assembly not visible
17 | // to COM components. If you need to access a type in this assembly from
18 | // COM, set the ComVisible attribute to true on that type.
19 | [assembly: ComVisible(false)]
20 |
21 | // The following GUID is for the ID of the typelib if this project is exposed to COM
22 | [assembly: Guid("fff07a01-2977-4c85-9224-bdb18e72c962")]
23 |
24 | // Version information for an assembly consists of the following four values:
25 | //
26 | // Major Version
27 | // Minor Version
28 | // Build Number
29 | // Revision
30 | //
31 | // You can specify all the values or you can default the Build and Revision Numbers
32 | // by using the '*' as shown below:
33 | // [assembly: AssemblyVersion("1.0.*")]
34 | [assembly: AssemblyVersion("1.0.0.0")]
35 | [assembly: AssemblyFileVersion("1.0.0.0")]
36 |
--------------------------------------------------------------------------------
/CSharpBot/Bot/Utilities/DataConversion.cs:
--------------------------------------------------------------------------------
1 | namespace Bot.Utilities
2 | {
3 | public static class DataConversion
4 | {
5 | public static System.Numerics.Vector3 ToVector3(this rlbot.flat.Vector3 vector)
6 | {
7 | return new System.Numerics.Vector3(vector.X, vector.Y, vector.Z);
8 | }
9 |
10 | public static System.Numerics.Vector2 ToVector2(this rlbot.flat.Vector3 vector)
11 | {
12 | return new System.Numerics.Vector2(vector.X, vector.Y);
13 | }
14 | }
15 | }
--------------------------------------------------------------------------------
/CSharpBot/Bot/Utilities/Processed/BallPrediction/BallPrediction.cs:
--------------------------------------------------------------------------------
1 | namespace Bot.Utilities.Processed.BallPrediction
2 | {
3 | ///
4 | /// Processed version of the that uses sane data structures.
5 | ///
6 | // Just like the Packet class, this class is here for your convenience.
7 | // It is NOT part of the framework and you can change it as much as you want, or delete it entirely.
8 | public struct BallPrediction
9 | {
10 | public PredictionSlice[] Slices;
11 | public int Length => Slices.Length;
12 |
13 | public BallPrediction(rlbot.flat.BallPrediction ballPrediction)
14 | {
15 | Slices = new PredictionSlice[ballPrediction.SlicesLength];
16 | for (int i = 0; i < ballPrediction.SlicesLength; i++)
17 | Slices[i] = new PredictionSlice(ballPrediction.Slices(i).Value);
18 | }
19 | }
20 | }
--------------------------------------------------------------------------------
/CSharpBot/Bot/Utilities/Processed/BallPrediction/PredictionSlice.cs:
--------------------------------------------------------------------------------
1 | using Bot.Utilities.Processed.Packet;
2 |
3 | namespace Bot.Utilities.Processed.BallPrediction
4 | {
5 | public struct PredictionSlice
6 | {
7 | public Physics Physics;
8 | public float GameSeconds;
9 |
10 | public PredictionSlice(rlbot.flat.PredictionSlice predictionSlice)
11 | {
12 | Physics = new Physics(physics: predictionSlice.Physics.Value);
13 | GameSeconds = predictionSlice.GameSeconds;
14 | }
15 | }
16 | }
--------------------------------------------------------------------------------
/CSharpBot/Bot/Utilities/Processed/FieldInfo/BoostPad.cs:
--------------------------------------------------------------------------------
1 | using System.Numerics;
2 |
3 | namespace Bot.Utilities.Processed.FieldInfo
4 | {
5 | public struct BoostPad
6 | {
7 | public Vector3 Location;
8 | public bool IsFullBoost;
9 |
10 | public BoostPad(rlbot.flat.BoostPad boostPad)
11 | {
12 | Location = boostPad.Location.Value.ToVector3();
13 | IsFullBoost = boostPad.IsFullBoost;
14 | }
15 | }
16 | }
--------------------------------------------------------------------------------
/CSharpBot/Bot/Utilities/Processed/FieldInfo/FieldInfo.cs:
--------------------------------------------------------------------------------
1 | namespace Bot.Utilities.Processed.FieldInfo
2 | {
3 | ///
4 | /// Processed version of the that uses sane data structures.
5 | ///
6 | // Just like the Packet class, this class is here for your convenience.
7 | // It is NOT part of the framework and you can change it as much as you want, or delete it entirely.
8 | public struct FieldInfo
9 | {
10 | public GoalInfo[] Goals;
11 | public BoostPad[] BoostPads;
12 |
13 | public FieldInfo(rlbot.flat.FieldInfo fieldInfo)
14 | {
15 | Goals = new GoalInfo[fieldInfo.GoalsLength];
16 | BoostPads = new BoostPad[fieldInfo.BoostPadsLength];
17 |
18 | for (int i = 0; i < fieldInfo.GoalsLength; i++)
19 | Goals[i] = new GoalInfo(fieldInfo.Goals(i).Value);
20 |
21 | for (int i = 0; i < fieldInfo.BoostPadsLength; i++)
22 | BoostPads[i] = new BoostPad(fieldInfo.BoostPads(i).Value);
23 | }
24 | }
25 | }
--------------------------------------------------------------------------------
/CSharpBot/Bot/Utilities/Processed/FieldInfo/GoalInfo.cs:
--------------------------------------------------------------------------------
1 | using System.Numerics;
2 |
3 | namespace Bot.Utilities.Processed.FieldInfo
4 | {
5 | public struct GoalInfo
6 | {
7 | public Vector3 Direction;
8 | public Vector3 Location;
9 | public int TeamNum;
10 |
11 | public GoalInfo(rlbot.flat.GoalInfo goalInfo)
12 | {
13 | Direction = goalInfo.Direction.Value.ToVector3();
14 | Location = goalInfo.Location.Value.ToVector3();
15 | TeamNum = goalInfo.TeamNum;
16 | }
17 | }
18 | }
--------------------------------------------------------------------------------
/CSharpBot/Bot/Utilities/Processed/Packet/Ball.cs:
--------------------------------------------------------------------------------
1 | namespace Bot.Utilities.Processed.Packet
2 | {
3 | public class Ball
4 | {
5 | public Physics Physics;
6 |
7 | public Ball(rlbot.flat.BallInfo ballInfo)
8 | {
9 | Physics = new Physics(ballInfo.Physics.Value);
10 | }
11 | }
12 | }
--------------------------------------------------------------------------------
/CSharpBot/Bot/Utilities/Processed/Packet/BoostPadState.cs:
--------------------------------------------------------------------------------
1 | namespace Bot.Utilities.Processed.Packet
2 | {
3 | public class BoostPadState
4 | {
5 | public float Timer;
6 | public bool IsActive;
7 |
8 | public BoostPadState(rlbot.flat.BoostPadState boostPadState)
9 | {
10 | Timer = boostPadState.Timer;
11 | IsActive = boostPadState.IsActive;
12 | }
13 | }
14 | }
--------------------------------------------------------------------------------
/CSharpBot/Bot/Utilities/Processed/Packet/GameInfo.cs:
--------------------------------------------------------------------------------
1 | namespace Bot.Utilities.Processed.Packet
2 | {
3 | public class GameInfo
4 | {
5 | public float SecondsElapsed;
6 | public float GameTimeRemaining;
7 | public bool IsKickoffPause;
8 |
9 | public GameInfo(rlbot.flat.GameInfo gameInfo)
10 | {
11 | SecondsElapsed = gameInfo.SecondsElapsed;
12 | GameTimeRemaining = gameInfo.GameTimeRemaining;
13 | IsKickoffPause = gameInfo.IsKickoffPause;
14 | }
15 | }
16 | }
--------------------------------------------------------------------------------
/CSharpBot/Bot/Utilities/Processed/Packet/Orientation.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Numerics;
3 |
4 | namespace Bot.Utilities.Processed.Packet
5 | {
6 | public class Orientation
7 | {
8 | public float Pitch;
9 | public float Roll;
10 | public float Yaw;
11 |
12 | public Vector3 Forward;
13 | public Vector3 Right;
14 | public Vector3 Up;
15 |
16 | public Orientation(rlbot.flat.Rotator? rotator)
17 | {
18 | // The Rotator from the ball prediction is always null.
19 | // This ends up breaking this class unless we account for it.
20 | if (rotator.HasValue)
21 | {
22 | Pitch = rotator.Value.Pitch;
23 | Roll = rotator.Value.Roll;
24 | Yaw = rotator.Value.Yaw;
25 | }
26 | else
27 | {
28 | Pitch = 0;
29 | Roll = 0;
30 | Yaw = 0;
31 | }
32 |
33 | float cp = (float) Math.Cos(Pitch);
34 | float cy = (float) Math.Cos(Yaw);
35 | float cr = (float) Math.Cos(Roll);
36 | float sp = (float) Math.Sin(Pitch);
37 | float sy = (float) Math.Sin(Yaw);
38 | float sr = (float) Math.Sin(Roll);
39 |
40 | Forward = new Vector3(cp * cy, cp * sy, sp);
41 | Right = new Vector3(cy * sp * sr - cr * sy, sy * sp * sr + cr * cy, -cp * sr);
42 | Up = new Vector3(-cr * cy * sp - sr * sy, -cr * sy * sp + sr * cy, cp * cr);
43 | }
44 |
45 | ///
46 | /// Gets the relative to an object at the given
47 | /// location with the given .
48 | /// For example, you can use this method to get the start of the ball relative to your car.
49 | ///
50 | ///
51 | /// The global location of the object you want to base the new target off of.
52 | /// This location will be the center of the world.
53 | ///
54 | ///
55 | /// The global location of the target you want to get the relative location of.
56 | ///
57 | /// The orientation of the current object.
58 | ///
59 | /// Returns as a relative location from point of
60 | /// view using the given .
61 | /// Rocket League's coordinate system might be different to what you're used to.
62 | /// The returned vector's components describe the following (relative to the start location
63 | /// and orientation):
64 | ///
65 | /// - X: How far in front the target is
66 | /// - Y: How far right the target is
67 | /// - Z: How far above the target is
68 | ///
69 | ///
70 | public static Vector3 RelativeLocation(Vector3 start, Vector3 target, Orientation orientation)
71 | {
72 | Vector3 startToTarget = target - start;
73 | float x = Vector3.Dot(startToTarget, orientation.Forward);
74 | float y = Vector3.Dot(startToTarget, orientation.Right);
75 | float z = Vector3.Dot(startToTarget, orientation.Up);
76 |
77 | return new Vector3(x, y, z);
78 | }
79 | }
80 | }
--------------------------------------------------------------------------------
/CSharpBot/Bot/Utilities/Processed/Packet/Packet.cs:
--------------------------------------------------------------------------------
1 | namespace Bot.Utilities.Processed.Packet
2 | {
3 | ///
4 | /// Processed version of the that uses sane data structures.
5 | ///
6 | // This class is here for your convenience. It is NOT part of the framework and you can change it
7 | // as much as you want, or delete it entirely.
8 | // The benefits of using this instead of rlbot.flat.GameTickPacket are:
9 | // - You avoid the displeasing .Value syntax of nullables due to Flatbuffers.
10 | // - You end up with nice System.Numeric.Vector3 objects that you can call methods on.
11 | // - If the framework changes its data format, you can just update the code here and leave your
12 | // bot logic alone.
13 | // Note that this class and the classes inside are NOT complete. For example, Dropshot data has NOT
14 | // been added.
15 | // If you require any data from rlbot.flat.GameTickPacket that is missing in any of these classes,
16 | // you can add them yourself. You can always use Intellisense on rlbot.flat.GameTickPacket to see
17 | // what data is supported by RLBot and add them to these classes.
18 | public class Packet
19 | {
20 | public Player[] Players;
21 | public BoostPadState[] BoostPadStates;
22 | public Ball Ball;
23 | public GameInfo GameInfo;
24 | public TeamInfo[] Teams;
25 |
26 | public Packet(rlbot.flat.GameTickPacket packet)
27 | {
28 | Players = new Player[packet.PlayersLength];
29 | for (int i = 0; i < packet.PlayersLength; i++)
30 | Players[i] = new Player(packet.Players(i).Value);
31 |
32 | BoostPadStates = new BoostPadState[packet.BoostPadStatesLength];
33 | for (int i = 0; i < packet.BoostPadStatesLength; i++)
34 | BoostPadStates[i] = new BoostPadState(packet.BoostPadStates(i).Value);
35 |
36 | Ball = new Ball(packet.Ball.Value);
37 | GameInfo = new GameInfo(packet.GameInfo.Value);
38 |
39 | Teams = new TeamInfo[packet.TeamsLength];
40 | for (int i = 0; i < packet.TeamsLength; i++)
41 | Teams[i] = new TeamInfo(packet.Teams(i).Value);
42 | }
43 | }
44 | }
--------------------------------------------------------------------------------
/CSharpBot/Bot/Utilities/Processed/Packet/Physics.cs:
--------------------------------------------------------------------------------
1 | using System.Numerics;
2 |
3 | namespace Bot.Utilities.Processed.Packet
4 | {
5 | public class Physics
6 | {
7 | public Vector3 AngularVelocity;
8 | public Vector3 Location;
9 | public Orientation Rotation;
10 | public Vector3 Velocity;
11 |
12 | public Physics(rlbot.flat.Physics physics)
13 | {
14 | Location = physics.Location.Value.ToVector3();
15 | Velocity = physics.Velocity.Value.ToVector3();
16 | AngularVelocity = physics.AngularVelocity.Value.ToVector3();
17 | Rotation = new Orientation(physics.Rotation);
18 | }
19 | }
20 | }
--------------------------------------------------------------------------------
/CSharpBot/Bot/Utilities/Processed/Packet/Player.cs:
--------------------------------------------------------------------------------
1 | namespace Bot.Utilities.Processed.Packet
2 | {
3 | public class Player
4 | {
5 | public int Boost;
6 | public bool DoubleJumped;
7 | public bool HasWheelContact;
8 | public bool IsSupersonic;
9 | public bool Jumped;
10 | public string Name;
11 | public Physics Physics;
12 | public int Team;
13 |
14 | public Player(rlbot.flat.PlayerInfo playerInfo)
15 | {
16 | Physics = new Physics(playerInfo.Physics.Value);
17 | IsSupersonic = playerInfo.IsSupersonic;
18 | HasWheelContact = playerInfo.HasWheelContact;
19 | Jumped = playerInfo.Jumped;
20 | DoubleJumped = playerInfo.DoubleJumped;
21 | Name = playerInfo.Name;
22 | Team = playerInfo.Team;
23 | Boost = playerInfo.Boost;
24 | }
25 | }
26 | }
--------------------------------------------------------------------------------
/CSharpBot/Bot/Utilities/Processed/Packet/TeamInfo.cs:
--------------------------------------------------------------------------------
1 | namespace Bot.Utilities.Processed.Packet
2 | {
3 | public class TeamInfo
4 | {
5 | public int TeamIndex;
6 | public int Score;
7 |
8 | public TeamInfo(rlbot.flat.TeamInfo teamInfo)
9 | {
10 | TeamIndex = teamInfo.TeamIndex;
11 | Score = teamInfo.Score;
12 | }
13 | }
14 | }
--------------------------------------------------------------------------------
/CSharpBot/Bot/packages.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
--------------------------------------------------------------------------------
/LICENSE:
--------------------------------------------------------------------------------
1 | MIT License
2 |
3 | Copyright (c) 2018
4 |
5 | Permission is hereby granted, free of charge, to any person obtaining a copy
6 | of this software and associated documentation files (the "Software"), to deal
7 | in the Software without restriction, including without limitation the rights
8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 | copies of the Software, and to permit persons to whom the Software is
10 | furnished to do so, subject to the following conditions:
11 |
12 | The above copyright notice and this permission notice shall be included in all
13 | copies or substantial portions of the Software.
14 |
15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21 | SOFTWARE.
22 |
--------------------------------------------------------------------------------
/PythonAgent/PythonAgent.cfg:
--------------------------------------------------------------------------------
1 | [Locations]
2 | # Path to loadout config. Can use relative path from here.
3 | looks_config = ./appearance.cfg
4 |
5 | # Path to python file. Can use relative path from here.
6 | python_file = ./PythonAgent.py
7 |
8 | # Name of the bot in-game
9 | name = CSharpBot
10 |
11 | [Bot Parameters]
12 | # Change to point to your executable location, if necessary.
13 | # This file should appear if you compile in release mode via Visual Studio.
14 | executable_path = ../CSharpBot/Bot/bin/Release/Bot.exe
15 |
16 | [Details]
17 | # These values are optional but useful metadata for helper programs
18 | # Name of the bot's creator/developer
19 | developer = The RLBot community
20 |
21 | # Short description of the bot
22 | description = This is a multi-line description
23 | of the official C# example bot
24 |
25 | # Fun fact about the bot
26 | fun_fact =
27 |
28 | # Link to GitHub repository
29 | github = https://github.com/RLBot/RLBotCSharpExample
30 |
31 | # Programming language
32 | language = C#
33 |
--------------------------------------------------------------------------------
/PythonAgent/PythonAgent.py:
--------------------------------------------------------------------------------
1 | from rlbot.agents.base_agent import BOT_CONFIG_AGENT_HEADER
2 | from rlbot.agents.executable_with_socket_agent import ExecutableWithSocketAgent
3 | from rlbot.parsing.custom_config import ConfigHeader, ConfigObject
4 |
5 |
6 | class DotNetBot(ExecutableWithSocketAgent):
7 | def get_port(self) -> int:
8 | return 45031 # The port given to the executable in the program arguments
9 |
10 | def load_config(self, config_header: ConfigHeader):
11 | self.executable_path = config_header.getpath('executable_path')
12 | self.logger.info("Executable is configured as {}".format(self.executable_path))
13 |
14 | @staticmethod
15 | def create_agent_configurations(config: ConfigObject):
16 | params = config.get_header(BOT_CONFIG_AGENT_HEADER)
17 | params.add_value('executable_path', str, default=None,
18 | description='Relative path to the bot executable.')
19 |
--------------------------------------------------------------------------------
/PythonAgent/appearance.cfg:
--------------------------------------------------------------------------------
1 | [Bot Loadout]
2 | team_color_id = 60
3 | custom_color_id = 0
4 | car_id = 23
5 | decal_id = 0
6 | wheels_id = 1565
7 | boost_id = 35
8 | antenna_id = 0
9 | hat_id = 0
10 | paint_finish_id = 1681
11 | custom_finish_id = 1681
12 | engine_audio_id = 0
13 | trails_id = 3220
14 | goal_explosion_id = 3018
15 |
16 | [Bot Loadout Orange]
17 | team_color_id = 3
18 | custom_color_id = 0
19 | car_id = 23
20 | decal_id = 0
21 | wheels_id = 1565
22 | boost_id = 35
23 | antenna_id = 0
24 | hat_id = 0
25 | paint_finish_id = 1681
26 | custom_finish_id = 1681
27 | engine_audio_id = 0
28 | trails_id = 3220
29 | goal_explosion_id = 3018
30 |
31 | [Bot Paint Blue]
32 | car_paint_id = 12
33 | decal_paint_id = 0
34 | wheels_paint_id = 7
35 | boost_paint_id = 7
36 | antenna_paint_id = 0
37 | hat_paint_id = 0
38 | trails_paint_id = 2
39 | goal_explosion_paint_id = 0
40 |
41 | [Bot Paint Orange]
42 | car_paint_id = 12
43 | decal_paint_id = 0
44 | wheels_paint_id = 14
45 | boost_paint_id = 14
46 | antenna_paint_id = 0
47 | hat_paint_id = 0
48 | trails_paint_id = 14
49 | goal_explosion_paint_id = 0
50 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # RLBotCSharpExample
2 |
3 | Example/template of a Rocket League bot implemented in C#
4 |
5 | ## Usage Instructions
6 |
7 | ### Prerequisites
8 | Make sure you've installed [Python 3.7 64 bit](https://www.python.org/ftp/python/3.7.3/python-3.7.3-amd64.exe) or newer. During installation:
9 | - Select "Add Python to PATH"
10 | - Make sure pip is included in the installation
11 |
12 | Set up RLBotGUI
13 | 1. Follow instructions at https://youtu.be/oXkbizklI2U for instructions.
14 | 1. Use Add -> Load folder in RLBotGUI on the current directory. This bot should appear in the list.
15 |
16 |
17 | ### Using Visual Studio
18 | 1. Install Visual Studio 2015 or newer. It should come with .NET Framework 4.6.1 or newer.
19 | 1. Open CSharpBot\Bot.sln in Visual Studio.
20 | 1. In Visual Studio, click the "Start" button,
21 | 1. In RLBotGUI, put the bot on a team and start the match.
22 |
23 | ### Using Rider
24 | 1. Install Rider. If you do not have Visual Studio installed alongside Rider, follow [this article](https://rider-support.jetbrains.com/hc/en-us/articles/207288089-Using-Rider-under-Windows-without-Visual-Studio-prerequisites) to set up Rider.
25 | 1. Open CSharpBot\Bot.sln in Rider.
26 | 1. In Rider, click the "Run Default" button, which should compile and run the bot. Leave it running.
27 | - The first time you click it, you may be given a dialog to set up the configuration. Click the "Run" button in the dialog to continue.
28 | 1. In RLBotGUI, put the bot on a team and start the match.
29 |
30 | ## Upgrades
31 |
32 | This project uses a package manager called NuGet to keep track of the RLBot framework.
33 | The framework will get updates periodically, and you'll probably want them, especially if you want to make sure
34 | your bot will work right in the next tournament!
35 |
36 | ### Upgrading in Visual Studio
37 | 1. In Visual Studio, right click on the Bot C# project and choose "Manage NuGet Packages..."
38 | 1. Click on the "Installed" tab. You should see a package called "RLBot.Framework".
39 | 1. If an upgrade is available, it should say so and give you the option to upgrade.
40 |
41 | ### Upgrading in Rider
42 | 1. In Rider, right click on the Bot C# project and choose "Manage NuGet Packages".
43 | 1. In the "Installed Packages" section, click on the package called "RLBot.Framework".
44 | 1. If the "Version" dropdown contains a higher version than what your project currently has, you can select that version and click the Upgrade button next to the dropdown to upgrade.
45 |
46 | ## Notes
47 |
48 | - Bot behavior is controlled by `CSharpBot/Bot/Bot.cs`
49 | - Bot appearance is controlled by `PythonAgent/appearance.cfg`
50 | - See the [wiki](https://github.com/RLBot/RLBotCSharpExample/wiki) for tips to improve your programming experience.
51 | - If you'd like to keep up with bot strategies and bot tournaments, join our [Discord server](https://discord.gg/q9pbsWz). It's the heart of the RLBot community!
52 |
53 |
54 | ## Overview of how the C# bot interacts with Python
55 |
56 | The C# bot executable is a server that listens for Python clients.
57 | When `PythonAgent/PythonAgent.py` is started by the RLBot framework, it connects to the C# bot server and tells it its info.
58 | Then, the C# bot server controls the bot through the `RLBot_Core_Interface` DLL.
59 |
--------------------------------------------------------------------------------
/RefreshEnv.cmd:
--------------------------------------------------------------------------------
1 | @echo off
2 | :: This file is taken from chocolatey:
3 | :: https://github.com/chocolatey/choco/blob/master/src/chocolatey.resources/redirects/RefreshEnv.cmd
4 | ::
5 | :: RefreshEnv.cmd
6 | ::
7 | :: Batch file to read environment variables from registry and
8 | :: set session variables to these values.
9 | ::
10 | :: With this batch file, there should be no need to reload command
11 | :: environment every time you want environment changes to propagate
12 |
13 | ::echo "RefreshEnv.cmd only works from cmd.exe, please install the Chocolatey Profile to take advantage of refreshenv from PowerShell"
14 | echo | set /p dummy="Refreshing environment variables from registry for cmd.exe. Please wait..."
15 |
16 | goto main
17 |
18 | :: Set one environment variable from registry key
19 | :SetFromReg
20 | "%WinDir%\System32\Reg" QUERY "%~1" /v "%~2" > "%TEMP%\_envset.tmp" 2>NUL
21 | for /f "usebackq skip=2 tokens=2,*" %%A IN ("%TEMP%\_envset.tmp") do (
22 | echo/set "%~3=%%B"
23 | )
24 | goto :EOF
25 |
26 | :: Get a list of environment variables from registry
27 | :GetRegEnv
28 | "%WinDir%\System32\Reg" QUERY "%~1" > "%TEMP%\_envget.tmp"
29 | for /f "usebackq skip=2" %%A IN ("%TEMP%\_envget.tmp") do (
30 | if /I not "%%~A"=="Path" (
31 | call :SetFromReg "%~1" "%%~A" "%%~A"
32 | )
33 | )
34 | goto :EOF
35 |
36 | :main
37 | echo/@echo off >"%TEMP%\_env.cmd"
38 |
39 | :: Slowly generating final file
40 | call :GetRegEnv "HKLM\System\CurrentControlSet\Control\Session Manager\Environment" >> "%TEMP%\_env.cmd"
41 | call :GetRegEnv "HKCU\Environment">>"%TEMP%\_env.cmd" >> "%TEMP%\_env.cmd"
42 |
43 | :: Special handling for PATH - mix both User and System
44 | call :SetFromReg "HKLM\System\CurrentControlSet\Control\Session Manager\Environment" Path Path_HKLM >> "%TEMP%\_env.cmd"
45 | call :SetFromReg "HKCU\Environment" Path Path_HKCU >> "%TEMP%\_env.cmd"
46 |
47 | :: Caution: do not insert space-chars before >> redirection sign
48 | echo/set "Path=%%Path_HKLM%%;%%Path_HKCU%%" >> "%TEMP%\_env.cmd"
49 |
50 | :: Cleanup
51 | del /f /q "%TEMP%\_envset.tmp" 2>nul
52 | del /f /q "%TEMP%\_envget.tmp" 2>nul
53 |
54 | :: capture user / architecture
55 | SET "OriginalUserName=%USERNAME%"
56 | SET "OriginalArchitecture=%PROCESSOR_ARCHITECTURE%"
57 |
58 | :: Set these variables
59 | call "%TEMP%\_env.cmd"
60 |
61 | :: reset user / architecture
62 | SET "USERNAME=%OriginalUserName%"
63 | SET "PROCESSOR_ARCHITECTURE=%OriginalArchitecture%"
64 |
65 | echo | set /p dummy="Finished."
66 | echo .
--------------------------------------------------------------------------------
/requirements.txt:
--------------------------------------------------------------------------------
1 | # Include everything the framework requires
2 | # You will automatically get updates for all versions starting with "1.".
3 | rlbot==1.*
4 |
--------------------------------------------------------------------------------
/rlbot.cfg:
--------------------------------------------------------------------------------
1 | [RLBot Configuration]
2 | # Visit https://github.com/RLBot/RLBot/wiki/Config-File-Documentation to see what you can put here.
3 |
4 | [Team Configuration]
5 | # Visit https://github.com/RLBot/RLBot/wiki/Config-File-Documentation to see what you can put here.
6 |
7 | [Match Configuration]
8 | # Visit https://github.com/RLBot/RLBot/wiki/Config-File-Documentation to see what you can put here.
9 | # Number of bots/players which will be spawned. We support up to max 64.
10 | num_participants = 2
11 | game_mode = Soccer
12 | game_map = Mannfield
13 | enable_rendering = True
14 | enable_state_setting = True
15 |
16 | [Mutator Configuration]
17 | # Visit https://github.com/RLBot/RLBot/wiki/Config-File-Documentation to see what you can put here.
18 |
19 | [Participant Configuration]
20 | # Put the name of your bot config file here. Only num_participants config files will be read!
21 | # Everything needs a config, even players and default bots. We still set loadouts and names from config!
22 | participant_config_0 = PythonAgent/PythonAgent.cfg
23 | participant_config_1 = PythonAgent/PythonAgent.cfg
24 | participant_config_2 = PythonAgent/PythonAgent.cfg
25 | participant_config_3 = PythonAgent/PythonAgent.cfg
26 | participant_config_4 = PythonAgent/PythonAgent.cfg
27 | participant_config_5 = PythonAgent/PythonAgent.cfg
28 | participant_config_6 = PythonAgent/PythonAgent.cfg
29 | participant_config_7 = PythonAgent/PythonAgent.cfg
30 | participant_config_8 = PythonAgent/PythonAgent.cfg
31 | participant_config_9 = PythonAgent/PythonAgent.cfg
32 |
33 | # team 0 shoots on positive goal, team 1 shoots on negative goal
34 | participant_team_0 = 0
35 | participant_team_1 = 1
36 | participant_team_2 = 0
37 | participant_team_3 = 1
38 | participant_team_4 = 0
39 | participant_team_5 = 1
40 | participant_team_6 = 0
41 | participant_team_7 = 1
42 | participant_team_8 = 0
43 | participant_team_9 = 1
44 |
45 | # Accepted values are "human", "rlbot", "psyonix", and "party_member_bot"
46 | # You can have up to 4 local players and they must be activated in game or it will crash.
47 | # If no player is specified you will be spawned in as spectator!
48 | # human - not controlled by the framework
49 | # rlbot - controlled by the framework
50 | # psyonix - default bots (skill level can be changed with participant_bot_skill
51 | # party_member_bot - controlled by the framework but the game detects it as a human
52 | participant_type_0 = rlbot
53 | participant_type_1 = rlbot
54 | participant_type_2 = rlbot
55 | participant_type_3 = rlbot
56 | participant_type_4 = rlbot
57 | participant_type_5 = rlbot
58 | participant_type_6 = rlbot
59 | participant_type_7 = rlbot
60 | participant_type_8 = rlbot
61 | participant_type_9 = rlbot
62 |
63 |
64 | # If participant is a bot and not RLBot controlled, this value will be used to set bot skill.
65 | # 0.0 is Rookie, 0.5 is pro, 1.0 is all-star. You can set values in-between as well.
66 | # Please leave a value here even if it isn't used :)
67 | participant_bot_skill_0 = 1.0
68 | participant_bot_skill_1 = 1.0
69 | participant_bot_skill_2 = 1.0
70 | participant_bot_skill_3 = 1.0
71 | participant_bot_skill_4 = 1.0
72 | participant_bot_skill_5 = 1.0
73 | participant_bot_skill_6 = 1.0
74 | participant_bot_skill_7 = 1.0
75 | participant_bot_skill_8 = 1.0
76 | participant_bot_skill_9 = 1.0
77 |
--------------------------------------------------------------------------------
/run.bat:
--------------------------------------------------------------------------------
1 | @echo off
2 |
3 | @rem Change the working directory to the location of this file so that relative paths will work
4 | cd /D "%~dp0"
5 |
6 | @rem Make sure the environment variables are up-to-date. This is useful if the user installed python a moment ago.
7 | call ./RefreshEnv.cmd
8 |
9 | python run.py
10 |
11 | pause
12 |
--------------------------------------------------------------------------------
/run.py:
--------------------------------------------------------------------------------
1 | import subprocess
2 | import sys
3 |
4 | DEFAULT_LOGGER = 'rlbot'
5 |
6 | if __name__ == '__main__':
7 |
8 | try:
9 | from rlbot.utils import public_utils, logging_utils
10 |
11 | logger = logging_utils.get_logger(DEFAULT_LOGGER)
12 | if not public_utils.have_internet():
13 | logger.log(logging_utils.logging_level,
14 | 'Skipping upgrade check for now since it looks like you have no internet')
15 | elif public_utils.is_safe_to_upgrade():
16 | subprocess.call([sys.executable, "-m", "pip", "install", '-r', 'requirements.txt'])
17 | subprocess.call([sys.executable, "-m", "pip", "install", 'rlbot', '--upgrade'])
18 |
19 | # https://stackoverflow.com/a/44401013
20 | rlbots = [module for module in sys.modules if module.startswith('rlbot')]
21 | for rlbot_module in rlbots:
22 | sys.modules.pop(rlbot_module)
23 |
24 | except ImportError:
25 | subprocess.call([sys.executable, "-m", "pip", "install", '-r', 'requirements.txt', '--upgrade', '--upgrade-strategy=eager'])
26 |
27 | try:
28 | from rlbot import runner
29 | runner.main()
30 | except Exception as e:
31 | print("Encountered exception: ", e)
32 | print("Press enter to close.")
33 | input()
34 |
--------------------------------------------------------------------------------