Skip to content

Commit

Permalink
Add Raisin Bran (#326)
Browse files Browse the repository at this point in the history
* Create chese

* Add files via upload

* Create eh

* Add files via upload

* Add files via upload

* Delete RLBotPack/RaisinBran/chese

* Delete RLBotPack/RaisinBran/Loadouts/__pycache__/eh

* Create ham

* Add files via upload

* Delete RLBotPack/RaisinBran/dll/ham

* Create ham

* Delete RLBotPack/RaisinBran/__pycache__/ham

* Create s

* Add files via upload

* Added Raisin Bran

* Delete RLBotPack/RaisinBran/.gitattributes

* Delete RLBotPack/RaisinBran/Bot.pdb

* Delete RLBotPack/RaisinBran/RedUtils.pdb

* Delete RLBotPack/RaisinBran/__pycache__ directory

* Removed Junk Files
  • Loading branch information
CrabbyCrab101 authored Jun 2, 2024
1 parent 84b1301 commit 148b947
Show file tree
Hide file tree
Showing 14 changed files with 337 additions and 0 deletions.
48 changes: 48 additions & 0 deletions RLBotPack/RaisinBran/Bot.cfg
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
#--- This file contains a ton of useful info on your bot, and should be edited! ---


[Locations]

# Name of the bot in-game
name = Raisin Bran

# Path to python file
# !!! Make sure to change this if you change the name of this file !!!
python_file = ./python_run_file.py

# Path to the logo file
logo_file = logo.png

# Path to loadout generator
loadout_generator = ./Loadouts/loadout_generator.py

# Path to default loadout config
looks_config = ./Loadouts/default_appearance.cfg


[Bot Parameters]

# Path to your bot's executable. Notes: You WILL have to change this path
# if you rename your solution, or the folder containing the solution.
# Also, if you notice your bot is running slowly, try changing this path
# to point to the release folder, and build your bot as a release version.
# Your bot should run significantly faster this way.
executable_path = ./Bot.exe


[Details]

# These values are optional but useful metadata for helper programs
# Name of the bot's creator/developer
developer = CrabbyCrab101

# Short description of the bot
description = Powered by a box of cereal and RedUtils. Will not go for aerials. I mean think about it, have you seen a box of cereal fly on its own?

# Fun fact about the bot
fun_fact = Somehow won a Twitch Chat Interaction Tournament

# Link to GitHub repository
github =
# Programming language
language = C#
70 changes: 70 additions & 0 deletions RLBotPack/RaisinBran/Bot.deps.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
{
"runtimeTarget": {
"name": ".NETCoreApp,Version=v6.0",
"signature": ""
},
"compilationOptions": {},
"targets": {
".NETCoreApp,Version=v6.0": {
"Bot/1.0.0": {
"dependencies": {
"RLBot.Framework": "2.0.0",
"RedUtils": "1.0.0"
},
"runtime": {
"Bot.dll": {}
}
},
"RLBot.Framework/2.0.0": {
"dependencies": {
"System.Numerics.Vectors": "4.5.0"
},
"runtime": {
"lib/netstandard2.0/FlatBuffers.dll": {
"assemblyVersion": "1.0.0.0",
"fileVersion": "1.0.0.0"
},
"lib/netstandard2.0/RLBotDotNet.dll": {
"assemblyVersion": "2.0.0.0",
"fileVersion": "2.0.0.0"
}
}
},
"System.Numerics.Vectors/4.5.0": {},
"RedUtils/1.0.0": {
"dependencies": {
"RLBot.Framework": "2.0.0"
},
"runtime": {
"RedUtils.dll": {}
}
}
}
},
"libraries": {
"Bot/1.0.0": {
"type": "project",
"serviceable": false,
"sha512": ""
},
"RLBot.Framework/2.0.0": {
"type": "package",
"serviceable": true,
"sha512": "sha512-vBmYAVoHbaW62dBbpM90vAfaQNi956cpKee5hUm8mA/V/KYZl+41Q/e9FhwVilgbR8xcnh+OJlboMJ4qeb21HQ==",
"path": "rlbot.framework/2.0.0",
"hashPath": "rlbot.framework.2.0.0.nupkg.sha512"
},
"System.Numerics.Vectors/4.5.0": {
"type": "package",
"serviceable": true,
"sha512": "sha512-QQTlPTl06J/iiDbJCiepZ4H//BVraReU4O4EoRw1U02H5TLUIT7xn3GnDp9AXPSlJUDyFs4uWjWafNX6WrAojQ==",
"path": "system.numerics.vectors/4.5.0",
"hashPath": "system.numerics.vectors.4.5.0.nupkg.sha512"
},
"RedUtils/1.0.0": {
"type": "project",
"serviceable": false,
"sha512": ""
}
}
}
Binary file added RLBotPack/RaisinBran/Bot.dll
Binary file not shown.
Binary file added RLBotPack/RaisinBran/Bot.exe
Binary file not shown.
12 changes: 12 additions & 0 deletions RLBotPack/RaisinBran/Bot.runtimeconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{
"runtimeOptions": {
"tfm": "net6.0",
"framework": {
"name": "Microsoft.NETCore.App",
"version": "6.0.0"
},
"configProperties": {
"System.Reflection.Metadata.MetadataUpdater.IsSupported": false
}
}
}
Binary file added RLBotPack/RaisinBran/FlatBuffers.dll
Binary file not shown.
100 changes: 100 additions & 0 deletions RLBotPack/RaisinBran/Loadouts/default_appearance.cfg
Original file line number Diff line number Diff line change
@@ -0,0 +1,100 @@
[Bot Loadout]
# Primary Color selection
team_color_id = 29
# Secondary Color selection
custom_color_id = 48
# Car type (Octane, Merc, etc)
car_id = 3031
# Type of decal
decal_id = 0
# Wheel selection
wheels_id = 386
# Boost selection
boost_id = 652
# Antenna Selection
antenna_id = 0
# Hat Selection
hat_id = 0
# Paint Type (for first color)
paint_finish_id = 4737
# Paint Type (for secondary color)
custom_finish_id = 4737
# Engine Audio Selection
engine_audio_id = 0
# Car trail Selection
trails_id = 1948
# Goal Explosion Selection
goal_explosion_id = 3974
# Finds the closest primary color swatch based on the provided RGB value like [34, 255, 60]
primary_color_lookup = None
# Finds the closest secondary color swatch based on the provided RGB value like [34, 255, 60]
secondary_color_lookup = None

[Bot Loadout Orange]
# Primary Color selection
team_color_id = 33
# Secondary Color selection
custom_color_id = 42
# Car type (Octane, Merc, etc)
car_id = 3031
# Type of decal
decal_id = 0
# Wheel selection
wheels_id = 386
# Boost selection
boost_id = 652
# Antenna Selection
antenna_id = 0
# Hat Selection
hat_id = 0
# Paint Type (for first color)
paint_finish_id = 4737
# Paint Type (for secondary color)
custom_finish_id = 4737
# Engine Audio Selection
engine_audio_id = 0
# Car trail Selection
trails_id = 1948
# Goal Explosion Selection
goal_explosion_id = 3974
# Finds the closest primary color swatch based on the provided RGB value like [34, 255, 60]
primary_color_lookup = None
# Finds the closest secondary color swatch based on the provided RGB value like [34, 255, 60]
secondary_color_lookup = None

[Bot Paint Blue]
# car_paint_id
car_paint_id = 12
# decal_paint_id
decal_paint_id = 0
# wheels_paint_id
wheels_paint_id = 3
# boost_paint_id
boost_paint_id = 0
# antenna_paint_id
antenna_paint_id = 0
# hat_paint_id
hat_paint_id = 0
# trails_paint_id
trails_paint_id = 4
# goal_explosion_paint_id
goal_explosion_paint_id = 1

[Bot Paint Orange]
# car_paint_id
car_paint_id = 12
# decal_paint_id
decal_paint_id = 0
# wheels_paint_id
wheels_paint_id = 14
# boost_paint_id
boost_paint_id = 14
# antenna_paint_id
antenna_paint_id = 0
# hat_paint_id
hat_paint_id = 0
# trails_paint_id
trails_paint_id = 1
# goal_explosion_paint_id
goal_explosion_paint_id = 1

20 changes: 20 additions & 0 deletions RLBotPack/RaisinBran/Loadouts/loadout_generator.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
import random
from pathlib import Path

from rlbot.agents.base_loadout_generator import BaseLoadoutGenerator
from rlbot.matchconfig.loadout_config import LoadoutConfig

# Randomly chooses a loadout config file from the loadouts folder!

class RandomLoadoutGenerator(BaseLoadoutGenerator):
def generate_loadout(self, player_index: int, team: int) -> LoadoutConfig:

# Creates a list of all the loadout files in the loadouts folder
loadouts_folder = self.base_directory / 'loadouts'
loadout_list = [f for f in loadouts_folder.glob("*.cfg") if f.is_file()]

# Chooses a random loadout file from the list, and applies it to our bot! :D
choice = random.randrange(0, len(loadout_list))
loadout = self.load_cfg_file(loadout_list[choice], team)

return loadout
66 changes: 66 additions & 0 deletions RLBotPack/RaisinBran/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
# RedUtilities

A set of utitilies for making rocket league bots in C#

## Usage Instructions

### Prerequisites
Make sure you've installed [.NET SDK 6.0 x64](https://dotnet.microsoft.com/download),
AND 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:
- Select "Add Python to PATH"
- Make sure pip is included in the installation

Set up RLBotGUI
1. Set up and install the RLBotGUI, by following this along with this [video](https://www.youtube.com/watch?v=oXkbizklI2U&t=0s).
1. Use Add -> Load folder in RLBotGUI on the current directory. This bot should appear in the list.


### Using Visual Studio
1. Install Visual Studio 2019 16.8 or newer.
1. Open Bot.sln in Visual Studio.
1. Edit the code as you see fit, and then compile
1. In RLBotGUI, put the bot on a team and start the match.

### Using Rider
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.
1. Open Bot.sln in Rider.
1. Edit the code as you see fit, and then compile
1. In RLBotGUI, put the bot on a team and start the match.

## Upgrades

This project uses a package manager called NuGet to keep track of the RLBot framework.
The framework will get updates periodically, and you'll probably want them, especially if you want to make sure
your bot will work right in the next tournament!

### Upgrading in Visual Studio
1. In Visual Studio, right click on the Bot C# project and choose "Manage NuGet Packages..."
1. Click on the "Installed" tab. You should see a package called "RLBot.Framework".
1. If an upgrade is available, it should say so and give you the option to upgrade.

### Upgrading in Rider
1. In Rider, right click on the Bot C# project and choose "Manage NuGet Packages".
1. In the "Installed Packages" section, click on the package called "RLBot.Framework".
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.

## Notes

- Bot name, description, etc, is configured by `Bot.cfg`
- Bot strategy is controlled by `Bot/Bot.cs`
- Bot appearance is controlled by `Loadouts/loadout_generator.py`
- To make your bot run as fast as possible, build it in release mode, and then change the "executable_path" in `Bot.cfg` to `./Bot/bin/Release/net6.0/Bot.exe`
- See the [wiki](https://github.com/RLBot/RLBotCSharpExample/wiki) for tips to improve your programming experience.
- 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!


## Overview of how the C# bot interacts with Python

The C# bot executable is a server that listens for Python clients.
When `python_run_file.py` is started by the RLBot framework, it connects to the C# bot server and tells it its info.
Then, the C# bot server controls the bot through the `RLBot_Core_Interface` DLL.

## Credit

- [ddthj/GoslingUtils](https://github.com/ddthj/GoslingUtils) for inspiration on some of the structure and code (which I ported to c#)
- [VirxEC/VirxERLU](https://github.com/VirxEC/VirxERLU) for the basis of my aerial code (which I ported to c#)
- [Darxeal/BotimusPrime](https://github.com/Darxeal/BotimusPrime) for inspiration on some of the structure and driving code (which I ported to c#)
Binary file added RLBotPack/RaisinBran/RLBotDotNet.dll
Binary file not shown.
Binary file added RLBotPack/RaisinBran/RedUtils.dll
Binary file not shown.
Binary file not shown.
Binary file added RLBotPack/RaisinBran/logo.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
21 changes: 21 additions & 0 deletions RLBotPack/RaisinBran/python_run_file.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
from rlbot.agents.base_agent import BOT_CONFIG_AGENT_HEADER
from rlbot.agents.executable_with_socket_agent import ExecutableWithSocketAgent
from rlbot.parsing.custom_config import ConfigHeader, ConfigObject

# This file is kinda like the middle-man between your bot and RLBot
# It provides the port to RLBot on which your bot is connected,
# and loads the executable linked in the config to RLBot!

class DotNetBot(ExecutableWithSocketAgent):
def get_port(self) -> int:
return 36988 # The port given to the executable in the program arguments

def load_config(self, config_header: ConfigHeader):
# Grabs the executable in the config
self.executable_path = config_header.getpath('executable_path')
self.logger.info("Executable is configured as {}".format(self.executable_path))

@staticmethod
def create_agent_configurations(config: ConfigObject):
params = config.get_header(BOT_CONFIG_AGENT_HEADER)
params.add_value('executable_path', str, default=None, description='Relative path to the bot executable.')

0 comments on commit 148b947

Please sign in to comment.