From 65bfbb2d2951d98e18ba3ee73332d5a66d7fbc6e Mon Sep 17 00:00:00 2001 From: Tyler Arehart Date: Thu, 21 Nov 2019 18:44:39 -0800 Subject: [PATCH 1/9] Settings for testing remote rlbot. --- rlbot.cfg | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/rlbot.cfg b/rlbot.cfg index b8553d8..00d275b 100644 --- a/rlbot.cfg +++ b/rlbot.cfg @@ -1,14 +1,17 @@ [RLBot Configuration] # Visit https://github.com/RLBot/RLBot/wiki/Config-File-Documentation to see what you can put here. +networking_role = remote_rlbot_client +network_address = 192.168.56.1 [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 = 2 +num_participants = 1 game_mode = Soccer game_map = Mannfield +existing_match_behavior = Continue And Spawn [Mutator Configuration] # Visit https://github.com/RLBot/RLBot/wiki/Config-File-Documentation to see what you can put here. From ba46996cb95fb2b87caa4cfe156c92397b5ce509 Mon Sep 17 00:00:00 2001 From: Tyler Arehart Date: Thu, 21 Nov 2019 19:40:18 -0800 Subject: [PATCH 2/9] New IP address. --- rlbot.cfg | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/rlbot.cfg b/rlbot.cfg index 00d275b..06f5872 100644 --- a/rlbot.cfg +++ b/rlbot.cfg @@ -1,7 +1,7 @@ [RLBot Configuration] # Visit https://github.com/RLBot/RLBot/wiki/Config-File-Documentation to see what you can put here. networking_role = remote_rlbot_client -network_address = 192.168.56.1 +network_address = 10.186.111.200 [Team Configuration] # Visit https://github.com/RLBot/RLBot/wiki/Config-File-Documentation to see what you can put here. From dd5277ca77b97c19b0c4f2077b06e104620985ef Mon Sep 17 00:00:00 2001 From: Tyler Arehart Date: Thu, 21 Nov 2019 19:49:01 -0800 Subject: [PATCH 3/9] Newer ip address. --- rlbot.cfg | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/rlbot.cfg b/rlbot.cfg index 06f5872..02b5cf3 100644 --- a/rlbot.cfg +++ b/rlbot.cfg @@ -1,7 +1,7 @@ [RLBot Configuration] # Visit https://github.com/RLBot/RLBot/wiki/Config-File-Documentation to see what you can put here. networking_role = remote_rlbot_client -network_address = 10.186.111.200 +network_address = 192.168.43.45 [Team Configuration] # Visit https://github.com/RLBot/RLBot/wiki/Config-File-Documentation to see what you can put here. From f72b490584a8c64d430777fb5038f470db59fb08 Mon Sep 17 00:00:00 2001 From: Tyler Arehart Date: Tue, 3 Dec 2019 00:37:15 -0800 Subject: [PATCH 4/9] Simplifying the example bot for remote-rlbot purposes. --- README.md | 55 +++++++++++++++++------------------ requirements.txt | 5 +--- rlbot.cfg | 2 +- src/bot.cfg | 2 +- src/bot.py | 74 ++++++++++++++++++++++++++++-------------------- 5 files changed, 72 insertions(+), 66 deletions(-) diff --git a/README.md b/README.md index 3771948..9d4bed4 100644 --- a/README.md +++ b/README.md @@ -1,30 +1,27 @@ # RLBotPythonExample -Example of a python bot using the RLBot framework - -## 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 - -## Changing the bot - -- Bot behavior is controlled by `src/bot.py` -- Bot appearance is controlled by `src/appearance.cfg` - -See https://github.com/RLBot/RLBotPythonExample/wiki for documentation and tutorials. - -### Older Setup Technique - -**Please don't do this unless you've followed the quick start video and it doesn't work!** - -https://www.youtube.com/watch?v=UjsQFNN0nSA - -1. Make sure you've installed [Python 3.7 64 bit](https://www.python.org/ftp/python/3.7.4/python-3.7.4-amd64.exe). During installation: - - Select "Add Python to PATH" - - Make sure pip is included in the installation -1. Download or clone this repository -1. In the files from the previous step, find and double click on run-gui.bat -1. Click the 'Run' button +Example of a python bot using the RLBot framework, and customized for use +in a classroom setting. + +## Getting Started + +These instructions assume that you're attending some kind of session where +somebody is explaining RLBot and hosting the game on one main computer. + +1. Make sure you have python 3.6 or higher installed. +1. Download this repository. +1. Look in the rlbot.cfg file and make sure the `network_address` +matches what the person hosting has provided. +1. Look in the src/bot.cfg file and change the name "AnonymousBot" to something +you can recognize, so you'll know which car on the screen is yours. +1. Connect to the wireless network called RLBot. The person hosting can tell you the password. +1. Run the program. This should cause a car to appear in the game on the host computer! + - Windows: Double click on run.bat + - Mac / Linux: Open a terminal at this folder location and run `python3 run.py` +1. Open the src/bot.py file in your favorite code editor and start tinkering. +The behavior of the car should change immediately every time you save. + +## Advanced + +- Read about the data available at https://github.com/RLBot/RLBotPythonExample/wiki/Input-and-Output-Data +- Find useful constants at https://github.com/RLBot/RLBot/wiki/Useful-Game-Values +- Make your car beautiful with `src/appearance.cfg` and https://github.com/RLBot/RLBot/wiki/Bot-Customization diff --git a/requirements.txt b/requirements.txt index 25c0c97..c6028b2 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,7 +1,4 @@ # Include everything the framework requires # You will automatically get updates for all versions starting with "1.". rlbot==1.* -rlbottraining - -# This will cause pip to auto-upgrade and stop scaring people with warning messages -pip +quicktracer diff --git a/rlbot.cfg b/rlbot.cfg index 02b5cf3..d2f1393 100644 --- a/rlbot.cfg +++ b/rlbot.cfg @@ -1,7 +1,7 @@ [RLBot Configuration] # Visit https://github.com/RLBot/RLBot/wiki/Config-File-Documentation to see what you can put here. networking_role = remote_rlbot_client -network_address = 192.168.43.45 +network_address = 192.168.1.100 [Team Configuration] # Visit https://github.com/RLBot/RLBot/wiki/Config-File-Documentation to see what you can put here. diff --git a/src/bot.cfg b/src/bot.cfg index c27f0fb..fef9d88 100644 --- a/src/bot.cfg +++ b/src/bot.cfg @@ -6,7 +6,7 @@ looks_config = ./appearance.cfg python_file = ./bot.py # Name of the bot in-game -name = PythonExampleBot +name = AnonymousBot [Details] # These values are optional but useful metadata for helper programs diff --git a/src/bot.py b/src/bot.py index 58511a2..98aa525 100644 --- a/src/bot.py +++ b/src/bot.py @@ -1,5 +1,6 @@ import math +from quicktracer import trace from rlbot.agents.base_agent import BaseAgent, SimpleControllerState from rlbot.utils.structures.game_data_struct import GameTickPacket @@ -9,38 +10,58 @@ class MyBot(BaseAgent): - def initialize_agent(self): - # This runs once before the bot starts up - self.controller_state = SimpleControllerState() - def get_output(self, packet: GameTickPacket) -> SimpleControllerState: - ball_location = Vec3(packet.game_ball.physics.location) - my_car = packet.game_cars[self.index] car_location = Vec3(my_car.physics.location) + ball_location = Vec3(packet.game_ball.physics.location) - car_to_ball = ball_location - car_location + # trace makes a pretty graph of whatever numeric variable you pass + trace(car_location.dist(ball_location)) - # Find the direction of our car using the Orientation class - car_orientation = Orientation(my_car.physics.rotation) - car_direction = car_orientation.forward + # Numbers taken from https://github.com/RLBot/RLBot/wiki/Useful-Game-Values + enemy_goal_y_value = 5200 if my_car.team == 0 else -5200 + enemy_goal_location = Vec3(0, enemy_goal_y_value, 0) - steer_correction_radians = find_correction(car_direction, car_to_ball) + target = ball_location - if steer_correction_radians > 0: - # Positive radians in the unit circle is a turn to the left. - turn = -1.0 # Negative value for a turn to the left. - action_display = "turn left" - else: - turn = 1.0 - action_display = "turn right" + controller_state = SimpleControllerState() + controller_state.throttle = 1.0 # Positive throttle drives forward, negative drives backward + controller_state.steer = steer_toward_target(my_car, target) + + # controller_state.boost = True # Use boost to go fast or fly + # controller_state.use_item = True # Use item to retract your spikes and release the ball + # controller_state.handbrake = True # Use the handbrake to slide and turn sharply + # controller_state.jump = True # The car will jump when this *transitions* from False to True - self.controller_state.throttle = 1.0 - self.controller_state.steer = turn + # These tilt the car when it's in mid-air + # controller_state.pitch = 0.0 + # controller_state.yaw = 0.0 + # controller_state.roll = 0.0 - draw_debug(self.renderer, my_car, packet.game_ball, action_display) + return controller_state - return self.controller_state + def initialize_agent(self): + # This runs once before the bot starts up + pass + + +def steer_toward_target(my_car, target): + car_location = Vec3(my_car.physics.location) + car_to_target = target - car_location + car_orientation = Orientation(my_car.physics.rotation) + car_direction = car_orientation.forward + steer_correction_radians = find_correction(car_direction, car_to_target) + # A negative steer value turns the car left, which happens to be positive radians, so we invert + # the value here. Also multiplying by a constant to steer more sharply. Max range for steering is -1 to 1. + return clamp(-4 * steer_correction_radians, -1.0, 1.0) + + +def clamp(value, minimum, maximum): + if value > maximum: + return maximum + if value < minimum: + return minimum + return value def find_correction(current: Vec3, ideal: Vec3) -> float: @@ -60,12 +81,3 @@ def find_correction(current: Vec3, ideal: Vec3) -> float: diff -= 2 * math.pi return diff - - -def draw_debug(renderer, car, ball, action_display): - renderer.begin_rendering() - # draw a line from the car to the ball - renderer.draw_line_3d(car.physics.location, ball.physics.location, renderer.white()) - # print the action that the bot is taking - renderer.draw_string_3d(car.physics.location, 2, 2, action_display, renderer.white()) - renderer.end_rendering() From 7b02fb4dd7039b52d1bb87fb76210de769295378 Mon Sep 17 00:00:00 2001 From: Tyler Date: Tue, 3 Dec 2019 23:42:49 -0800 Subject: [PATCH 5/9] Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 9d4bed4..76c2cd5 100644 --- a/README.md +++ b/README.md @@ -8,7 +8,7 @@ These instructions assume that you're attending some kind of session where somebody is explaining RLBot and hosting the game on one main computer. 1. Make sure you have python 3.6 or higher installed. -1. Download this repository. +1. Download this specific branch of the repository: https://github.com/RLBot/RLBotPythonExample/zipball/puppy. Make sure you unzip if necessary. 1. Look in the rlbot.cfg file and make sure the `network_address` matches what the person hosting has provided. 1. Look in the src/bot.cfg file and change the name "AnonymousBot" to something From 6c16dce97cd80804682b2c60dddc292cd568e96e Mon Sep 17 00:00:00 2001 From: Tyler Arehart Date: Wed, 4 Dec 2019 00:36:54 -0800 Subject: [PATCH 6/9] Getting rid of quicktracer because it causes issues with hot reload. --- .gitignore | 4 +++- requirements.txt | 1 - src/bot.py | 4 ---- 3 files changed, 3 insertions(+), 6 deletions(-) diff --git a/.gitignore b/.gitignore index 51410e9..1c8a3d6 100644 --- a/.gitignore +++ b/.gitignore @@ -108,4 +108,6 @@ ENV/ /build # Gradle files -/.gradle \ No newline at end of file +/.gradle + +.vscode diff --git a/requirements.txt b/requirements.txt index c6028b2..eb66004 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,4 +1,3 @@ # Include everything the framework requires # You will automatically get updates for all versions starting with "1.". rlbot==1.* -quicktracer diff --git a/src/bot.py b/src/bot.py index 98aa525..915de8d 100644 --- a/src/bot.py +++ b/src/bot.py @@ -1,6 +1,5 @@ import math -from quicktracer import trace from rlbot.agents.base_agent import BaseAgent, SimpleControllerState from rlbot.utils.structures.game_data_struct import GameTickPacket @@ -15,9 +14,6 @@ def get_output(self, packet: GameTickPacket) -> SimpleControllerState: car_location = Vec3(my_car.physics.location) ball_location = Vec3(packet.game_ball.physics.location) - # trace makes a pretty graph of whatever numeric variable you pass - trace(car_location.dist(ball_location)) - # Numbers taken from https://github.com/RLBot/RLBot/wiki/Useful-Game-Values enemy_goal_y_value = 5200 if my_car.team == 0 else -5200 enemy_goal_location = Vec3(0, enemy_goal_y_value, 0) From cea77085c461d63f1173210394378ac7ca068e20 Mon Sep 17 00:00:00 2001 From: Tyler Date: Wed, 4 Dec 2019 18:19:51 -0800 Subject: [PATCH 7/9] Update README.md --- README.md | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 76c2cd5..ba9e80f 100644 --- a/README.md +++ b/README.md @@ -13,10 +13,12 @@ somebody is explaining RLBot and hosting the game on one main computer. matches what the person hosting has provided. 1. Look in the src/bot.cfg file and change the name "AnonymousBot" to something you can recognize, so you'll know which car on the screen is yours. -1. Connect to the wireless network called RLBot. The person hosting can tell you the password. + 1. Run the program. This should cause a car to appear in the game on the host computer! - Windows: Double click on run.bat - Mac / Linux: Open a terminal at this folder location and run `python3 run.py` +1. It didn't work yet, but now you've got all the stuff downloaded via the fast wifi connection. Now kill the script and switch to the slower connection: +1. Connect to the wireless network called RLBot. The person hosting can tell you the password. 1. Open the src/bot.py file in your favorite code editor and start tinkering. The behavior of the car should change immediately every time you save. From d634143a5dd4cd541e682738a58ab077aeead461 Mon Sep 17 00:00:00 2001 From: Tyler Arehart Date: Thu, 12 Dec 2019 18:50:35 -0800 Subject: [PATCH 8/9] Updating with west coast EC2 elastic ip. --- README.md | 1 - rlbot.cfg | 2 +- 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/README.md b/README.md index ba9e80f..3ab8c7b 100644 --- a/README.md +++ b/README.md @@ -13,7 +13,6 @@ somebody is explaining RLBot and hosting the game on one main computer. matches what the person hosting has provided. 1. Look in the src/bot.cfg file and change the name "AnonymousBot" to something you can recognize, so you'll know which car on the screen is yours. - 1. Run the program. This should cause a car to appear in the game on the host computer! - Windows: Double click on run.bat - Mac / Linux: Open a terminal at this folder location and run `python3 run.py` diff --git a/rlbot.cfg b/rlbot.cfg index d2f1393..810f6fd 100644 --- a/rlbot.cfg +++ b/rlbot.cfg @@ -1,7 +1,7 @@ [RLBot Configuration] # Visit https://github.com/RLBot/RLBot/wiki/Config-File-Documentation to see what you can put here. networking_role = remote_rlbot_client -network_address = 192.168.1.100 +network_address = 44.229.123.164 [Team Configuration] # Visit https://github.com/RLBot/RLBot/wiki/Config-File-Documentation to see what you can put here. From d551b9958bdfcdbd66d6eb137d2e9eb17b284f22 Mon Sep 17 00:00:00 2001 From: Tyler Date: Thu, 12 Mar 2020 19:59:52 -0700 Subject: [PATCH 9/9] Removing references to wifi networks and ips --- README.md | 4 ---- 1 file changed, 4 deletions(-) diff --git a/README.md b/README.md index 3ab8c7b..ec3a751 100644 --- a/README.md +++ b/README.md @@ -9,15 +9,11 @@ somebody is explaining RLBot and hosting the game on one main computer. 1. Make sure you have python 3.6 or higher installed. 1. Download this specific branch of the repository: https://github.com/RLBot/RLBotPythonExample/zipball/puppy. Make sure you unzip if necessary. -1. Look in the rlbot.cfg file and make sure the `network_address` -matches what the person hosting has provided. 1. Look in the src/bot.cfg file and change the name "AnonymousBot" to something you can recognize, so you'll know which car on the screen is yours. 1. Run the program. This should cause a car to appear in the game on the host computer! - Windows: Double click on run.bat - Mac / Linux: Open a terminal at this folder location and run `python3 run.py` -1. It didn't work yet, but now you've got all the stuff downloaded via the fast wifi connection. Now kill the script and switch to the slower connection: -1. Connect to the wireless network called RLBot. The person hosting can tell you the password. 1. Open the src/bot.py file in your favorite code editor and start tinkering. The behavior of the car should change immediately every time you save. pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy