This is a simple example of a RLBot bot written in C#. It is designed to be easy to understand and modify, making it a great starting point for anyone looking to create their own RLBot bot in C#.
To get started, you will need to have the following software installed on your computer:
- Visual Studio (or any C# IDE of your choice)
- .NET 10 SDK
- RLBot v5
Source code for this example can be found in the Bot directory.
To run the bot, follow these steps:
- In RLBot's GUI, click "Add" in the top right.
- Click "Add Folder" in the menu that pops up and select this folder.
- You can also click "Add File" and select "example.bot.toml" but if you rename the file then you will have to re-add your bot.
- See the RLBot wiki for more information on
bot.tomlfiles.
- Your bot should now appear in the GUI; drag it onto either the blue or orange team.
- Click "Start Match" to start a match with your bot.
- If you click "Extra" in the bottom left and select "Continue and Spawn" for "Existing match behaviour" then you can reload your bot without restarting the match.
The bob.toml file is a required config file for submitting bots to the botpack and tournaments.
It tells our automated build system how to build your bot from its source code.
[[config]]
project_name = "CSharpExample"
bot_configs = ["example.bot.toml"]
[config.builder_config]
builder_type = "csharp"
# Optional, use if there are multiple sub-projects that can be built
# base_dir = "ExampleBot"project_nameis the name of your bot project. It can be anything you like, but try to make it unique.bot_configsis a list of all thebot.tomlfiles that are associated with this project. In this example, we only have one bot, so we only have onebot.tomlfile.builder_typeis the type of builder to use for this project. In this case, we are using thecsharpbuilder, which is designed for C# projects. This builder will look for a.csprojfile in the same directory as thebob.tomlfile and use it to build the bot.base_diris an optional field that can be used if there are multiple sub-projects that can be built. If you have multiple sub-projects, you can specify the correct base directory for the project using this field. We only have one folder,Bot/, so we don't need to use this field.