-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit b8b016e
Showing
102 changed files
with
5,699 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
.idea/ | ||
venv/ | ||
__pycache__/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
MIT License | ||
|
||
Copyright (c) 2018 | ||
|
||
Permission is hereby granted, free of charge, to any person obtaining a copy | ||
of this software and associated documentation files (the "Software"), to deal | ||
in the Software without restriction, including without limitation the rights | ||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
copies of the Software, and to permit persons to whom the Software is | ||
furnished to do so, subject to the following conditions: | ||
|
||
The above copyright notice and this permission notice shall be included in all | ||
copies or substantial portions of the Software. | ||
|
||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
SOFTWARE. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
# RocketNoodles | ||
RocketNoodles is the rocket league bot designed and built by [Serpentine](serpentinai.nl). | ||
|
||
## Quick Start | ||
The easiest way to start a python bot is demonstrated here! | ||
https://youtu.be/YJ69QZ-EX7k | ||
|
||
It shows you how to: | ||
- Install the RLBot GUI | ||
- Use it to create a new bot | ||
|
||
The original repository can be found at | ||
[the python rlbot repository](https://github.com/RLBot/RLBotPythonExample) on github. | ||
|
||
### Changing the bot | ||
|
||
- Bot behavior is controlled by `src/main.py` | ||
- Bot appearance is controlled by `src/appearance.cfg` | ||
|
||
See https://github.com/RLBot/RLBotPythonExample/wiki for documentation and tutorials. | ||
|
||
## Repository Structure | ||
``` | ||
. | ||
|-- src # Contains main.py to run bot | ||
| |-- gosling # Library for agent behaviour and control | ||
| |-- physics # Models and predictions of ingame physics | ||
| |-- scenario # Ingame test scenarios | ||
| |-- settings # Agent configuration files loaded on bot startup | ||
| |-- strategy # System for agent strategy, coordination and tactics | ||
| |-- world # World model, agent representation of the game | ||
| | ||
|-- logger # Tools and utilities | ||
``` | ||
Some of these directories are explained in more detail below. | ||
|
||
### Gosling | ||
[GoslingUtils](https://github.com/ddthj/GoslingUtils) is a library that executes agent behaviour | ||
and provides basic controllers for doing so. **We rely on Gosling in strategy but are | ||
working to phase out the library in the future.** It will allow us greater flexibility | ||
in the design of our bot and a neater repository. | ||
|
||
### Strategy | ||
Strategic reasoning and coordination is done here. The system consists of three parts: | ||
Coaches, Captains and Players. They do the following: | ||
- _Coaches_: Highest level in strategy. Determine which strategy will be executed by the captain. | ||
Examples could be: Play offensively, defensively, use trick shots or add keeper to offense. | ||
- _Captains_: Coordinate individual agents. The captain assigns a task to each active agent. | ||
- _Players_: Behaviour of an individual agents. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,66 @@ | ||
@echo off | ||
:: This file is taken from chocolatey: | ||
:: https://github.com/chocolatey/choco/blob/master/src/chocolatey.resources/redirects/RefreshEnv.cmd | ||
:: | ||
:: RefreshEnv.cmd | ||
:: | ||
:: Batch file to read environment variables from registry and | ||
:: set session variables to these values. | ||
:: | ||
:: With this batch file, there should be no need to reload command | ||
:: environment every time you want environment changes to propagate | ||
|
||
::echo "RefreshEnv.cmd only works from cmd.exe, please install the Chocolatey Profile to take advantage of refreshenv from PowerShell" | ||
echo | set /p dummy="Refreshing environment variables from registry for cmd.exe. Please wait..." | ||
|
||
goto main | ||
|
||
:: Set one environment variable from registry key | ||
:SetFromReg | ||
"%WinDir%\System32\Reg" QUERY "%~1" /v "%~2" > "%TEMP%\_envset.tmp" 2>NUL | ||
for /f "usebackq skip=2 tokens=2,*" %%A IN ("%TEMP%\_envset.tmp") do ( | ||
echo/set "%~3=%%B" | ||
) | ||
goto :EOF | ||
|
||
:: Get a list of environment variables from registry | ||
:GetRegEnv | ||
"%WinDir%\System32\Reg" QUERY "%~1" > "%TEMP%\_envget.tmp" | ||
for /f "usebackq skip=2" %%A IN ("%TEMP%\_envget.tmp") do ( | ||
if /I not "%%~A"=="Path" ( | ||
call :SetFromReg "%~1" "%%~A" "%%~A" | ||
) | ||
) | ||
goto :EOF | ||
|
||
:main | ||
echo/@echo off >"%TEMP%\_env.cmd" | ||
|
||
:: Slowly generating final file | ||
call :GetRegEnv "HKLM\System\CurrentControlSet\Control\Session Manager\Environment" >> "%TEMP%\_env.cmd" | ||
call :GetRegEnv "HKCU\Environment">>"%TEMP%\_env.cmd" >> "%TEMP%\_env.cmd" | ||
|
||
:: Special handling for PATH - mix both User and System | ||
call :SetFromReg "HKLM\System\CurrentControlSet\Control\Session Manager\Environment" Path Path_HKLM >> "%TEMP%\_env.cmd" | ||
call :SetFromReg "HKCU\Environment" Path Path_HKCU >> "%TEMP%\_env.cmd" | ||
|
||
:: Caution: do not insert space-chars before >> redirection sign | ||
echo/set "Path=%%Path_HKLM%%;%%Path_HKCU%%" >> "%TEMP%\_env.cmd" | ||
|
||
:: Cleanup | ||
del /f /q "%TEMP%\_envset.tmp" 2>nul | ||
del /f /q "%TEMP%\_envget.tmp" 2>nul | ||
|
||
:: capture user / architecture | ||
SET "OriginalUserName=%USERNAME%" | ||
SET "OriginalArchitecture=%PROCESSOR_ARCHITECTURE%" | ||
|
||
:: Set these variables | ||
call "%TEMP%\_env.cmd" | ||
|
||
:: reset user / architecture | ||
SET "USERNAME=%OriginalUserName%" | ||
SET "PROCESSOR_ARCHITECTURE=%OriginalArchitecture%" | ||
|
||
echo | set /p dummy="Finished." | ||
echo . |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
[Bot Loadout] | ||
team_color_id = 27 | ||
custom_color_id = 75 | ||
car_id = 23 | ||
decal_id = 307 | ||
wheels_id = 1656 | ||
boost_id = 0 | ||
antenna_id = 287 | ||
hat_id = 0 | ||
paint_finish_id = 1978 | ||
custom_finish_id = 1978 | ||
engine_audio_id = 0 | ||
trails_id = 0 | ||
goal_explosion_id = 1971 | ||
|
||
[Bot Loadout Orange] | ||
team_color_id = 1 | ||
custom_color_id = 1 | ||
car_id = 23 | ||
decal_id = 0 | ||
wheels_id = 818 | ||
boost_id = 0 | ||
antenna_id = 287 | ||
hat_id = 0 | ||
paint_finish_id = 266 | ||
custom_finish_id = 266 | ||
engine_audio_id = 0 | ||
trails_id = 0 | ||
goal_explosion_id = 1971 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
[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 = ./logger.py | ||
|
||
# Name of the bot in-game | ||
name = logger |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,99 @@ | ||
import math | ||
import json | ||
|
||
from rlbot.agents.base_agent import BaseAgent, SimpleControllerState | ||
from rlbot.utils.structures.game_data_struct import GameTickPacket | ||
|
||
from RLUtilities.Simulation import Input | ||
from RLUtilities.controller_input import controller | ||
|
||
|
||
class PythonExample(BaseAgent): | ||
|
||
def __init__(self, name, team, index): | ||
self.count = 0 | ||
self.recording = False | ||
self.start_time = 0 | ||
self.outfile = None | ||
self.frame_info = [] | ||
|
||
def get_output(self, packet: GameTickPacket) -> SimpleControllerState: | ||
|
||
if controller.L1 == 1: | ||
|
||
if self.recording == False: | ||
self.frame_info = [] | ||
self.recording = True | ||
self.start_time = packet.game_info.seconds_elapsed | ||
|
||
self.frame_info.append({ | ||
"time": packet.game_info.seconds_elapsed - self.start_time, | ||
"ball": { | ||
"location": [ | ||
packet.game_ball.physics.location.x, | ||
packet.game_ball.physics.location.y, | ||
packet.game_ball.physics.location.z | ||
], | ||
"velocity": [ | ||
packet.game_ball.physics.velocity.x, | ||
packet.game_ball.physics.velocity.y, | ||
packet.game_ball.physics.velocity.z | ||
], | ||
"rotator": [ | ||
packet.game_ball.physics.rotation.pitch, | ||
packet.game_ball.physics.rotation.yaw, | ||
packet.game_ball.physics.rotation.roll | ||
], | ||
"angular_velocity": [ | ||
packet.game_ball.physics.angular_velocity.x, | ||
packet.game_ball.physics.angular_velocity.y, | ||
packet.game_ball.physics.angular_velocity.z | ||
] | ||
}, | ||
"car": { | ||
"location": [ | ||
packet.game_cars[0].physics.location.x, | ||
packet.game_cars[0].physics.location.y, | ||
packet.game_cars[0].physics.location.z | ||
], | ||
"velocity": [ | ||
packet.game_cars[0].physics.velocity.x, | ||
packet.game_cars[0].physics.velocity.y, | ||
packet.game_cars[0].physics.velocity.z | ||
], | ||
"rotator": [ | ||
packet.game_cars[0].physics.rotation.pitch, | ||
packet.game_cars[0].physics.rotation.yaw, | ||
packet.game_cars[0].physics.rotation.roll | ||
], | ||
"angular_velocity": [ | ||
packet.game_cars[0].physics.angular_velocity.x, | ||
packet.game_cars[0].physics.angular_velocity.y, | ||
packet.game_cars[0].physics.angular_velocity.z | ||
], | ||
"boost": packet.game_cars[0].boost, | ||
"jumped": packet.game_cars[0].jumped, | ||
"double_jumped": packet.game_cars[0].double_jumped, | ||
"is_supersonic": packet.game_cars[0].is_super_sonic, | ||
"has_wheel_contact": packet.game_cars[0].has_wheel_contact | ||
}, | ||
"input": { | ||
"throttle": controller.throttle, | ||
"steer": controller.steer, | ||
"pitch": controller.pitch, | ||
"yaw": controller.yaw, | ||
"roll": controller.roll, | ||
"jump": controller.jump, | ||
"boost": controller.boost, | ||
"handbrake": controller.handbrake | ||
} | ||
}) | ||
|
||
else: | ||
if self.recording == True: | ||
with open(f"data_{self.count}.json", "w") as outfile: | ||
json.dump(self.frame_info, outfile) | ||
self.recording = False | ||
self.count += 1 | ||
|
||
return controller.get_output() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,73 @@ | ||
[RLBot Configuration] | ||
# Visit https://github.com/RLBot/RLBot/wiki/Config-File-Documentation to see what you can put here. | ||
|
||
[Team Configuration] | ||
# Visit https://github.com/RLBot/RLBot/wiki/Config-File-Documentation to see what you can put here. | ||
|
||
[Match Configuration] | ||
# Number of bots/players which will be spawned. We support up to max 10. | ||
num_participants = 1 | ||
game_mode = Soccer | ||
game_map = Mannfield | ||
|
||
[Mutator Configuration] | ||
# Visit https://github.com/RLBot/RLBot/wiki/Config-File-Documentation to see what you can put here. | ||
|
||
[Participant Configuration] | ||
# Put the name of your bot config file here. Only num_participants config files will be read! | ||
# Everything needs a config, even players and default bots. We still set loadouts and names from config! | ||
participant_config_0 = logger.cfg | ||
participant_config_1 = logger.cfg | ||
participant_config_2 = logger.cfg | ||
participant_config_3 = logger.cfg | ||
participant_config_4 = logger.cfg | ||
participant_config_5 = logger.cfg | ||
participant_config_6 = logger.cfg | ||
participant_config_7 = logger.cfg | ||
participant_config_8 = logger.cfg | ||
participant_config_9 = logger.cfg | ||
|
||
# team 0 shoots on positive goal, team 1 shoots on negative goal | ||
participant_team_0 = 0 | ||
participant_team_1 = 1 | ||
participant_team_2 = 0 | ||
participant_team_3 = 1 | ||
participant_team_4 = 0 | ||
participant_team_5 = 1 | ||
participant_team_6 = 0 | ||
participant_team_7 = 1 | ||
participant_team_8 = 0 | ||
participant_team_9 = 1 | ||
|
||
# Accepted values are "human", "rlbot", "psyonix", and "party_member_bot" | ||
# You can have up to 4 local players and they must be activated in game or it will crash. | ||
# If no player is specified you will be spawned in as spectator! | ||
# human - not controlled by the framework | ||
# rlbot - controlled by the framework | ||
# psyonix - default bots (skill level can be changed with participant_bot_skill | ||
# party_member_bot - controlled by the framework but the game detects it as a human | ||
participant_type_0 = party_member_bot | ||
participant_type_1 = rlbot | ||
participant_type_2 = rlbot | ||
participant_type_3 = rlbot | ||
participant_type_4 = rlbot | ||
participant_type_5 = rlbot | ||
participant_type_6 = rlbot | ||
participant_type_7 = rlbot | ||
participant_type_8 = rlbot | ||
participant_type_9 = rlbot | ||
|
||
|
||
# If participant is a bot and not RLBot controlled, this value will be used to set bot skill. | ||
# 0.0 is Rookie, 0.5 is pro, 1.0 is all-star. You can set values in-between as well. | ||
# Please leave a value here even if it isn't used :) | ||
participant_bot_skill_0 = 1.0 | ||
participant_bot_skill_1 = 1.0 | ||
participant_bot_skill_2 = 1.0 | ||
participant_bot_skill_3 = 1.0 | ||
participant_bot_skill_4 = 1.0 | ||
participant_bot_skill_5 = 1.0 | ||
participant_bot_skill_6 = 1.0 | ||
participant_bot_skill_7 = 1.0 | ||
participant_bot_skill_8 = 1.0 | ||
participant_bot_skill_9 = 1.0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
@echo off | ||
|
||
@rem Change the working directory to the location of this file so that relative paths will work | ||
cd /D "%~dp0" | ||
|
||
@rem Make sure the environment variables are up-to-date. This is useful if the user installed python a moment ago. | ||
call ./RefreshEnv.cmd | ||
|
||
python run.py |
Oops, something went wrong.