diff --git a/beastbot/beastbot.py b/beastbot/beastbot.py index 40eb912..631eb82 100644 --- a/beastbot/beastbot.py +++ b/beastbot/beastbot.py @@ -1,21 +1,16 @@ -import random -import time - -from RLUtilities.Maneuvers import AirDodge from rlbot.agents.base_agent import BaseAgent, SimpleControllerState -from rlbot.utils.game_state_util import CarState, Physics, Vector3, Rotator, GameState from rlbot.utils.structures.game_data_struct import GameTickPacket import moves from behaviour import * from info import EGameInfo from moves import DriveController, AimCone, ShotController -from plans import KickoffPlan, SmallJumpPlan, choose_kickoff_plan +from plans import choose_kickoff_plan from render import FakeRenderer, draw_ball_path from rlmath import * from utsystem import UtilitySystem -RENDER = True +RENDER = False class Beast(BaseAgent): @@ -90,7 +85,7 @@ def get_output(self, packet: GameTickPacket) -> SimpleControllerState: self.info.my_car.last_input.boost = self.controls.boost self.renderer.end_rendering() - return self.controls + return fix_controls(self.controls) def print(self, s): team_name = "[BLUE]" if self.team == 0 else "[ORANGE]" @@ -112,6 +107,20 @@ def random_color(self, anything): return color_functions.get(hash(anything) % 10)() +def fix_controls(controls): + return SimpleControllerState( + steer=controls.steer, + throttle=controls.throttle, + pitch=controls.pitch, + yaw=controls.yaw, + roll=controls.roll, + jump=controls.jump, + boost=controls.boost, + handbrake=controls.handbrake, + use_item=False + ) + + class DefaultBehaviour: def __init__(self): pass diff --git a/beastbot/behaviour.py b/beastbot/behaviour.py index 9dab1a6..85ade57 100644 --- a/beastbot/behaviour.py +++ b/beastbot/behaviour.py @@ -1,5 +1,3 @@ -from RLUtilities.Simulation import Car, Input - import predict import render from moves import AimCone diff --git a/beastbot/info.py b/beastbot/info.py index 9d9751f..0033456 100644 --- a/beastbot/info.py +++ b/beastbot/info.py @@ -1,5 +1,4 @@ from RLUtilities.GameInfo import GameInfo, BoostPad -from RLUtilities.Simulation import Car from rlbot.messages.flat import GameTickPacket, FieldInfo from rlmath import * diff --git a/beastbot/plans.py b/beastbot/plans.py index 81e030b..4ede503 100644 --- a/beastbot/plans.py +++ b/beastbot/plans.py @@ -228,7 +228,6 @@ def choose_kickoff_plan(bot): # Do we have teammates? If no -> always go for kickoff if len(bot.info.teammates) == 0: - bot.print("No team mates, early conclusion") return KickoffPlan() # Kickoff spawn locations (corners may vary from map to map) @@ -246,18 +245,14 @@ def choose_kickoff_plan(bot): if is_my_kickoff_spawn(bot, right_corner_loc): tm_index = index_of_teammate_at_kickoff_spawn(bot, left_corner_loc) if 0 <= tm_index < bot.index: - bot.print("SecondMan right") return SecondManSlowCornerKickoffPlan(bot) else: - bot.print("FirstMan right") return KickoffPlan() if is_my_kickoff_spawn(bot, left_corner_loc): tm_index = index_of_teammate_at_kickoff_spawn(bot, right_corner_loc) if 0 <= tm_index < bot.index: - bot.print("SecondMan left") return SecondManSlowCornerKickoffPlan(bot) else: - bot.print("FirstMan left") return KickoffPlan() # Is a teammate in the corner -> collect boost @@ -265,41 +260,33 @@ def choose_kickoff_plan(bot): or 0 <= index_of_teammate_at_kickoff_spawn(bot, left_corner_loc): if bot.info.my_car.pos[X] > 10: # go for left boost - bot.print("Boost left, because team mate corner") return CollectSpecificBoostPlan(vec3(boost_x, boost_y, 0)) if bot.info.my_car.pos[X] < -10: # go for right boost - bot.print("Boost right, because team mate corner") return CollectSpecificBoostPlan(vec3(-boost_x, boost_y, 0)) if 0 <= index_of_teammate_at_kickoff_spawn(bot, back_right_loc): # go for left boost - bot.print("Boost left, because team mate back right") return CollectSpecificBoostPlan(vec3(boost_x, boost_y, 0)) else: # go for right boost - bot.print("Boost right, because team mate back left") return CollectSpecificBoostPlan(vec3(-boost_x, boost_y, 0)) # No teammate in the corner # Are we back right or left -> go for kickoff if is_my_kickoff_spawn(bot, back_right_loc)\ or is_my_kickoff_spawn(bot, back_left_loc): - bot.print("Kickoff, back side") return KickoffPlan() # No teammate in the corner # Is a teammate back right or left -> collect boost if 0 <= index_of_teammate_at_kickoff_spawn(bot, back_right_loc): # go for left boost - bot.print("Boost left, im back") return CollectSpecificBoostPlan(vec3(boost_x, boost_y, 0)) elif 0 <= index_of_teammate_at_kickoff_spawn(bot, back_left_loc): # go for right boost - bot.print("Boost right, im back") return CollectSpecificBoostPlan(vec3(-boost_x, boost_y, 0)) # We have no teammates - bot.print("No team mates") return KickoffPlan()