def start(self): while True: time.sleep(0.5) # Update packet packet: GameTickPacket = self.get_game_tick_packet() if not packet.game_info.is_round_active: continue self.set_game_state( GameState(game_info=GameInfoState( world_gravity_z=WORLD_GRAVITY))) # Renders ball prediction. ball_prediction: BallPrediction = self.get_ball_prediction_struct() self.renderer.begin_rendering() sparse_slices = [ step.physics.location for step in ball_prediction.slices[::10] ] self.renderer.draw_polyline_3d(sparse_slices, self.renderer.cyan()) self.renderer.end_rendering() # Places the ball in the air on kickoff. if packet.game_info.is_kickoff_pause and round( packet.game_ball.physics.location.z ) != KICKOFF_BALL_HEIGHT: ball_state = BallState( Physics(location=Vector3(z=KICKOFF_BALL_HEIGHT), velocity=Vector3(0, 0, 0))) self.set_game_state(GameState(ball=ball_state))
def process_choice(self, choice: BotAction): player_index = self.get_player_index_by_name(choice.data[PLAYER_NAME]) if player_index is not None: car = self.game_tick_packet.game_cars[player_index] if choice.action_type == FLIP_CAR: flipped = get_flipped_orientation(car.physics.rotation) self.set_game_state( GameState( cars={ player_index: CarState(physics=Physics( rotation=flipped.to_rotator())) })) if choice.action_type == NUDGE_CAR: car_vel = Vec3(car.physics.velocity) rand_vec = Vec3(random() - .5, random() - .5, 0).normalized() nudge_vel = Vector3(car_vel.x + rand_vec.x * 700, car_vel.y + rand_vec.y * 700, car_vel.z + 500) self.set_game_state( GameState( cars={ player_index: CarState(physics=Physics(velocity=nudge_vel)) }))
def reset(self): game_state = GameState() self.set_game_state(game_state) car_state = CarState( physics(location=Vector3(x=-1000, y=0, z=250), velocity=Vector3(x=0, y=0, z=0), rotation=Rotator(0, 0, 0), angular_velocity=Vector3(0, 0, 0))) ball_state = BallState(Physics(location=Vector3(500, 0, None))) game_state = GameState(ball=ball_state, cars={self.index: car_state}) self.set_game_state(game_state)
def process_choice(self, choice: BotAction): if choice.action_type == FREEZE: for i in range(5): self.set_game_state( GameState(ball=BallState(physics=Physics(velocity=Vector3(0, 0, 0))))) sleep(.1) return if choice.action_type == NUDGE: ball_vel = self.game_tick_packet.game_ball.physics.velocity rand_vec = Vec3(random() - .5, random() - .5, random() - .5).rescale(1000) self.set_game_state( GameState(ball=BallState(physics=Physics(velocity=Vector3(rand_vec.x + ball_vel.x, rand_vec.y + ball_vel.y, rand_vec.z + ball_vel.z))))) return
def reset(self): game_state = GameState() self.set_game_state(game_state) car_state = CarState(jumped=False, double_jumped=False, boost_amount=0, physics=Physics(velocity=Vector3(z=0), rotation=Rotator( math.pi / 2, 0, 0), angular_velocity=Vector3(0, 0, 0))) ball_state = BallState(Physics(location=Vector3(1000, 0, None))) game_state = GameState(ball=ball_state, cars={self.index: car_state}) self.set_game_state(game_state)
def make_squares(self, packet, drones, start_time) -> StepResult: """ Separates all the bots into two squares, facing each other. """ self.squareA = drones[:32] self.squareB = drones[32:] spacing = 250 y_offset = 3500 x_offset = 7 * spacing / 2 car_states = {} for i, drone in enumerate(self.squareA): car_states[drone.index] = CarState( Physics(location=Vector3(x_offset - spacing * (i % 8), -y_offset - spacing * (i // 8), 20), velocity=Vector3(0, 0, 0), rotation=Rotator(0, np.pi / 2, 0))) for i, drone in enumerate(self.squareB): car_states[drone.index] = CarState( Physics(location=Vector3(-x_offset + spacing * (i % 8), y_offset + spacing * (i // 8), 20), velocity=Vector3(0, 0, 0), rotation=Rotator(0, -np.pi / 2, 0))) self.game_interface.set_game_state(GameState(cars=car_states)) return StepResult(finished=True)
def setup_newround(self, packet): car_states = {} yaw, yaw_mir = self.yaw_randomizor() for p in range(packet.num_cars): car = packet.game_cars[p] if car.team == 0: car_state = CarState(boost_amount=100, physics=Physics( location=Vector3(0, -1000, 17), rotation=Rotator(yaw=yaw, pitch=0, roll=0), velocity=Vector3(0, 0, 0), angular_velocity=Vector3(0, 0, 0))) car_states[p] = car_state elif car.team == 1: car_state = CarState(boost_amount=100, physics=Physics( location=Vector3(0, 1000, 17), rotation=Rotator(yaw=-yaw_mir, pitch=0, roll=0), velocity=Vector3(0, 0, 0), angular_velocity=Vector3(0, 0, 0))) car_states[p] = car_state ball_state = BallState(Physics(location=Vector3(0, 0, 93))) self.game_state = GameState(ball=ball_state, cars=car_states) self.set_game_state(self.game_state) self.prev_time = self.cur_time self.game_phase = -1
def boost_and_turn_test(agent): agent.state = boost_and_turn() test_time = time.time() - agent.test_start if(test_time > 6): car_state = CarState( jumped=False, double_jumped=False, boost_amount=87, physics=Physics(location=Vector3(x=-1000,y=2000,z=0), velocity=Vector3(x=0, y=0, z=0), rotation=Rotator(np.pi, np.pi / 2, np.pi), angular_velocity=Vector3(x=0, y=0, z=0))) ball_state = BallState( physics=Physics(location=Vector3(x=0,y=4000,z=0), velocity=Vector3(x=0, y=0, z=0), rotation=Rotator(np.pi / 2, 0, 0), angular_velocity=Vector3(x=0, y=0, z=0))) game_state = GameState(ball=ball_state, cars={agent.index: car_state}) agent.set_game_state(game_state) agent.test_start = time.time() else: return
def game_state_reset(self): crot = Rotator(random.uniform(-np.pi, np.pi), random.uniform(-np.pi, np.pi), random.uniform(-np.pi, np.pi)) car_state = CarState(physics=Physics(location=Vector3(0, 0, 1000), velocity=Vector3(0, 0, 0), rotation=None, angular_velocity=Vector3(0, 0, 0)), boost_amount=100) vel = random.choice([(-1, 0), (1, 0), (0, -1), (0, 1)]) bloc = Vector3(1000 * vel[0] + 200 * vel[1], 1000 * vel[1] + 200 * vel[0], random.choice([500, 1300])) bvel = Vector3(-12 * vel[0] + 3 * vel[1], -12 * vel[1] + 3 * vel[0], 0) ball_state = BallState( physics=Physics(location=bloc, velocity=bvel, rotation=Rotator(0, 0, 0), angular_velocity=Vector3(0, 0, 0))) self.state = GameState(ball=ball_state, cars={self.index: car_state}) return self.state
def execute(self): car_state = CarState(jumped=False, double_jumped=False, boost_amount=87, physics=Physics(location=rlv3(-1000, -2000, 20), velocity=rlv3(0, 0, 0), rotation=rlv3(0, -1, 0), angular_velocity=rlv3(0, 0, 0))) ball_state = BallState( Physics(location=rlv3(1000, 1100, 100), velocity=rlv3(0, 0, 0), rotation=rlv3(0, 0, 0), angular_velocity=rlv3(0, 0, 0))) game_state = GameState(ball=ball_state, cars={self.agent.index: car_state}) self.agent.set_game_state(game_state) self.expired = True r = 1000 x = [r / 2, -r, -r, r, r, -r / 2] y = [-r / 2, -r, r, r, -r, -r / 2] nodes = np.asfortranarray([x, y]) curve = structs.test(nodes, bezier.Curve.from_nodes(nodes)) self.agent.renderer.draw_polyline_3d(curve.get_path_points(), self.agent.renderer.blue()) self.substate = substates.pick_state( self, self.agent, self.car, self.ball.location, 2300, self.hierarchy) # Drive(self.car, target, 2000) return self.substate.step(1.0 / 60.0)
def set_state_test(self, game_tick_packet: GameTickPacket): my_car = game_tick_packet.game_cars[self.index] car_location = my_car.physics.location car_state = CarState() if math.fabs(car_location.x) > 2000 and car_location.z < 100: car_state = CarState(Physics(velocity=Vector3(z=500, x=-car_location.x * .5), rotation=Rotator(math.pi / 2, 0, 0), angular_velocity=Vector3(0, 0, 0)), jumped=False, double_jumped=False, boost_amount=87) ball_phys = game_tick_packet.game_ball.physics ball_state = BallState() if ball_phys.location.z > 500: ball_state = BallState(Physics(velocity=Vector3(z=-2000))) if math.fabs(car_location.x) > 1000: boost_states = {i: BoostState(1.0) for i in range(34)} else: boost_states = {i: BoostState(0.0) for i in range(34)} game_state = GameState(ball=ball_state, cars={self.index: car_state}, boosts=boost_states) self.set_game_state(game_state)
def make_game_state(self, rng: SeededRandomNumberGenerator) -> GameState: return GameState( ball=BallState(physics=Physics( location=Vector3(3989.49, 2429.52, 192.53), velocity=Vector3(-27.470999, -517.66095, -79.101), angular_velocity=Vector3(4.67741, 1.07971, 3.5994098), rotation=Rotator(0.8031348, -2.7694106, 0.77092123))), cars={ 0: CarState(physics=Physics( location=Vector3(3347.52, 1390.15, 17.05), velocity=Vector3(-549.081, -1298.891, 0.26099998), angular_velocity=Vector3(0.0, -4.0999998E-4, -1.0999999E-4), rotation=Rotator(-0.016682042, -1.9707818, 0.0)), jumped=False, double_jumped=False, boost_amount=46.0), 1: CarState(physics=Physics( location=Vector3(3170.66, 3257.52, 17.01), velocity=Vector3(1075.281, -1061.281, 0.191), angular_velocity=Vector3(-4.0999998E-4, 1.0999999E-4, -0.33201), rotation=Rotator(-0.00958738, -0.787028, 0.0)), jumped=False, double_jumped=False, boost_amount=0.0) }, boosts={i: BoostState(0) for i in range(34)}, )
def make_game_state(self, rng: SeededRandomNumberGenerator) -> GameState: enemy_goal_center: Vector3 = Vector3(0, 5120 * self.team, 93) car_spawn_block: utils.Area = utils.RectPrism(Vector3(0, 0, 17), 8000, 8000, 0) car_loc: Vector3 = car_spawn_block.random_point_inside(rng) car_facing: Rotator = utils.rotator_from_dir( sub(enemy_goal_center, car_loc)) relative: Vector3 = sub(enemy_goal_center, car_loc) #Spawn the ball halfway between us and the enemy goal ball_loc: Vector3 = add( car_loc, Vector3(relative.x / 2, relative.y / 2, relative.z / 2)) ball_loc.z = 93 return GameState( ball=BallState(physics=Physics(location=ball_loc, velocity=Vector3(0, 0, 0), angular_velocity=Vector3(0, 0, 0))), cars={ 0: CarState(physics=Physics(location=car_loc, rotation=car_facing, velocity=Vector3(0, 0, 0), angular_velocity=Vector3(0, 0, 0)), boost_amount=33), }, boosts={i: BoostState(0) for i in range(34)}, )
def interweave(self, packet, drones, start_time) -> StepResult: """ Make bots jump alternating such that they jump over each other. """ elapsed = packet.game_info.seconds_elapsed - start_time start = 0 hold = 0.135 buffer = 0.53 car_states = {} for drone in drones: # Speed controller vel = np.linalg.norm(drone.vel * np.array([1, 1, 0])) drone.ctrl.throttle = 0 if vel > 850 else 1 # jump controller if (drone.index % 2 == 0): if start < elapsed < start + hold: drone.ctrl.jump = True elif start + 2 * buffer < elapsed < start + 2 * buffer + hold: drone.ctrl.jump = True elif start + 4 * buffer < elapsed < start + 4 * buffer + hold: drone.ctrl.jump = True elif start + 6 * buffer < elapsed < start + 6 * buffer + hold: drone.ctrl.jump = True else: if start + buffer < elapsed < start + buffer + hold: drone.ctrl.jump = True elif start + 3 * buffer < elapsed < start + 3 * buffer + hold: drone.ctrl.jump = True elif start + 5 * buffer < elapsed < start + 5 * buffer + hold: drone.ctrl.jump = True self.game_interface.set_game_state(GameState(cars=car_states)) return StepResult(finished=elapsed > start + 8 * buffer)
def make_game_state(self, rng: SeededRandomNumberGenerator) -> GameState: return GameState( ball=BallState(physics=Physics( location=Vector3(self.ball_x, self.ball_y, self.ball_z), velocity=Vector3(self.ball_vx, self.ball_vy, self.ball_vz), angular_velocity=Vector3(self.ball_sx, self.ball_sy, self.ball_sz))), cars={ 0: CarState(physics=Physics(location=Vector3( self.car_x, self.car_y, self.car_z), rotation=Rotator(0, self.car_spin, 0), velocity=Vector3(0, 0, 0), angular_velocity=Vector3(0, 0, 0)), jumped=False, double_jumped=False, boost_amount=100), 1: CarState(physics=Physics( location=Vector3(self.car_x, -self.car_y, self.car_z), rotation=Rotator(0, -self.car_spin, 0), velocity=Vector3(0, 0, 0), angular_velocity=Vector3(0, 0, 0)), jumped=False, double_jumped=False, boost_amount=100) }, boosts={i: BoostState(0) for i in range(34)}, # Is this needed. )
def reset_state(self, keep_speed=False): # We may want to keep the speed if we run out of field if keep_speed: car_state = CarState( boost_amount=0, physics=Physics( location=Vector3(x=0, y=0), rotation=Rotator(0, math.pi / 2, 0), angular_velocity=Vector3(0, 0, 0), ), ) else: car_state = CarState( boost_amount=0, physics=Physics( velocity=Vector3(0, 0, 0), location=Vector3(x=0, y=0), rotation=Rotator(0, math.pi / 2, 0), angular_velocity=Vector3(0, 0, 0), ), ) # Setting the run start time self.reset_time = self.packet.game_info.seconds_elapsed ball_state = BallState(Physics(location=Vector3(z=3000))) game_state = GameState(ball=ball_state, cars={self.index: car_state}) self.set_game_state(game_state)
def make_game_state(self, rng: SeededRandomNumberGenerator) -> GameState: num_players = self.match_config.num_players assert num_players == len( self.spawns ), 'Number of players does not match the number of spawns.' car_states = {} for index in range(num_players): car_states[index] = CarState( boost_amount=33, physics=Physics(location=self.spawns[index].pos, velocity=Vector3(0, 0, 0), rotation=self.spawns[index].rot, angular_velocity=Vector3(0, 0, 0))) ball_state = BallState( Physics(location=Vector3(0, 0, 93), velocity=Vector3(0, 0, 0), rotation=Rotator(0, 0, 0), angular_velocity=Vector3(0, 0, 0))) # game_state = GameState(ball=ball_state, cars=car_states, console_commands=['Set WorldInfo TimeDilation 0.5']) game_state = GameState( ball=ball_state, cars=car_states, console_commands=['Set WorldInfo TimeDilation 1'], boosts={i: BoostState(0) for i in range(34)}) return game_state
def new_play(self, packet): # Check for the round being active - otherwise we might start a play during the goal reset time if packet.game_info.is_round_active: # Announce to the world what we're doing self.status = "New Play!" print("New Play!") # Increment player rotation to keep things mixed up self.player_rotation += 1 # Reset the boosts so that they're not collected for boost in self.boosts: boost.reset() self.play_state = 0 self.state_timer = self.time countdown_cars = {} # Determine the spawn locations to be used attackers = attacker_spawns(self.half) defenders = defender_spawns(not self.half) # Assign the players to spawn locations for player in self.players: if player.team == self.half: countdown_cars[player.index] = attackers.pop(self.player_rotation % len(attackers)) else: countdown_cars[player.index] = defenders.pop(self.player_rotation % len(defenders)) # This will be used to hold the cars in place during countdown self.countdown_state = GameState(ball=ball_spawn(self.half), cars=countdown_cars) self.set_game_state(self.countdown_state) else: # If the round isn't active, we set this flag and keep trying to make a new play until we can self.need_new_play = True
def execute(self): if self._changed: self.agent.set_game_state( GameState(ball=self.ball, cars={self.agent.index: self.car}, game_info=self.gameinfo)) self.begin()
def make_game_state(self, rng: SeededRandomNumberGenerator) -> GameState: car_pos = Vector3(5000, 0, 0) ball_pos = Vector3(0, 0, 1900) ball_vel = Vector3(0, 0, 0) ball_ang_vel = Vector3(0, 0, 0) ball_state = BallState( Physics(location=ball_pos, velocity=ball_vel, angular_velocity=ball_ang_vel)) car_state = CarState(boost_amount=100, jumped=False, double_jumped=False, physics=Physics(location=car_pos, rotation=Rotator(0, 0, 0), velocity=Vector3(0, 0, 0), angular_velocity=Vector3(0, 0, 0))) enemy_car = CarState(physics=Physics( location=Vector3(10000, 10000, 10000))) game_state = GameState(ball=ball_state, cars={ 0: car_state, 1: enemy_car }) return game_state
def make_game_state(self, rng: SeededRandomNumberGenerator) -> GameState: return GameState( ball=BallState(physics=Physics( location=Vector3(-2104.1099,5025.9497,164.47), velocity=Vector3(299.101,-154.431,253.47101), angular_velocity=Vector3(-2.68911,3.7743099,3.09181), rotation=Rotator(0.34274882,0.6972901,-0.25080585))), cars={ 0: CarState( physics=Physics( location=Vector3(-2593.05,4884.88,16.69), velocity=Vector3(422.621,48.641,6.8209996), angular_velocity=Vector3(0.015109999,-0.03071,0.79331), rotation=Rotator(-0.01840777,0.086669914,0.0010546118)), jumped=False, double_jumped=False, boost_amount=96.0), 1: CarState( physics=Physics( location=Vector3(-2882.72,4746.54,469.69998), velocity=Vector3(1246.9609,294.511,-619.78094), angular_velocity=Vector3(-4.97911,-2.27091,0.54881), rotation=Rotator(-0.5048714,0.48617604,-0.14611167)), jumped=True, double_jumped=True, boost_amount=0.0) }, boosts={i: BoostState(0) for i in range(34)}, )
def make_game_state(self, rng: SeededRandomNumberGenerator) -> GameState: num_players = self.match_config.num_players assert num_players == len( self.spawns ), 'Number of players does not match the number of spawns.' car_states = {} for index, player in enumerate(self.match_config.player_configs): assert (player.team == 0) == (index < len(self.blue_spawns)), \ f"Blue/Orange players in match_config don't match the Blue/Orange spawns: Expected {len(self.blue_spawns)} blue player_configs, followed by {len(self.orange_spawns)} orange ones." car_states[index] = CarState( boost_amount=33, physics=Physics(location=self.spawns[index].pos, velocity=Vector3(0, 0, 0), rotation=self.spawns[index].rot, angular_velocity=Vector3(0, 0, 0))) ball_state = BallState( Physics(location=Vector3(0, 0, 93), velocity=Vector3(0, 0, 0), rotation=Rotator(0, 0, 0), angular_velocity=Vector3(0, 0, 0))) game_state = GameState(ball=ball_state, cars=car_states) return game_state
def make_game_state(self, rng: SeededRandomNumberGenerator) -> GameState: return GameState( ball=BallState(physics=Physics( location=Vector3(2490.8398, -3985.97, 276.15), velocity=Vector3(-609.27094, 1042.121, -371.301), angular_velocity=Vector3(-1.61381, 5.77801, -0.10161), rotation=Rotator(-0.38013962, 1.32488, 0.3973969))), cars={ 0: CarState(physics=Physics( location=Vector3(2425.29, -4639.4097, 199.39), velocity=Vector3(-797.49097, -249.651, -15.901), angular_velocity=Vector3(-3.03761, -4.13571, 1.9794099), rotation=Rotator(-0.199801, -1.6142272, -2.3683705)), jumped=True, double_jumped=True, boost_amount=100.0), 1: CarState(physics=Physics( location=Vector3(2463.5999, -1264.83, 17.01), velocity=Vector3(-597.831, -1213.0409, 0.23099999), angular_velocity=Vector3(1.0999999E-4, 1.0999999E-4, 2.23661), rotation=Rotator(-0.00958738, -1.9631119, 0.0)), jumped=False, double_jumped=False, boost_amount=100.0) }, boosts={i: BoostState(0) for i in range(34)}, )
def shoot_ball(self): ball_state = BallState( Physics(location=Vector3(2500, -4500, 100), velocity=Vector3(0, 1000, 1500), angular_velocity=Vector3(0, -10, 0))) game_state = GameState(ball=ball_state) self.set_game_state(game_state)
def make_game_state(self, rng: SeededRandomNumberGenerator) -> GameState: return GameState( ball=BallState( Physics(location=Vector3(0, 5000, 100), velocity=Vector3(0, 2000, 500))), cars={ 0: CarState(boost_amount=95, jumped=True, double_jumped=True, physics=Physics( location=Vector3(200, -5400, 100), rotation=Rotator(0, 3, 0), velocity=Vector3(0, 0, 0), angular_velocity=Vector3(0, 0, 0), )), 1: CarState(boost_amount=95, jumped=True, double_jumped=True, physics=Physics( location=Vector3(-200, -5400, 100), rotation=Rotator(0, 3, 0), velocity=Vector3(0, 0, 0), angular_velocity=Vector3(0, 0, 0), )), }, # game_info=GameInfoState(game_speed=0.1), )
def initialize_agent(self): m = -1 if self.team else 1 f = -1 if self.flip else 1 if self.diagonal: car_physics = Physics( velocity=Vector3(0, 0, 0), rotation=Rotator(0, (45 + m * 90) / 180 * math.pi, 0), angular_velocity=Vector3(0, 0, 0), location=Vector3(f * m * 2048, m * -2560, 17.148628)) ball_physics = Physics(location=Vector3(0, 0, 92.739998), velocity=Vector3(0, 0, 0), angular_velocity=Vector3(0, 0, 0)) car_state = CarState(jumped=False, double_jumped=False, boost_amount=34, physics=car_physics) ball_state = BallState(physics=ball_physics) game_state = GameState(ball=ball_state, cars={self.index: car_state}) self.set_game_state(game_state) self.initialization_time = self.info.time self.action.reset_status()
def make_game_state(self, rng: SeededRandomNumberGenerator) -> GameState: return GameState( ball=BallState(physics=Physics( # location=Vector3(self.ball_x + rng.uniform(-10, 10), self.ball_y + rng.uniform(-10, 10), self.ball_z), location=Vector3(self.ball_x + rng.uniform(-500, 500), self.ball_y + rng.uniform(-500, 500), self.ball_z), velocity=Vector3(self.ball_vx + rng.uniform(-500, 500), self.ball_vy + rng.uniform(-500, 500), self.ball_vz), angular_velocity=Vector3(0, 0, 0))), cars={ 0: CarState( physics=Physics( # location=Vector3(self.car_start_x + rng.uniform(-1500, 1500), self.car_start_y, 0), location=Vector3(self.car_x, self.car_y, 17), rotation=Rotator(0, self.car_spin, 0), velocity=Vector3(0, 0, 0), angular_velocity=Vector3(0, 0, 0)), jumped=False, double_jumped=False, boost_amount=100) }, boosts={i: BoostState(0) for i in range(34)}, # Is this needed. )
def make_game_state(self, rng: SeededRandomNumberGenerator) -> GameState: vel_mul = rng.uniform(1.5, 2.0) return GameState( ball=BallState(physics=Physics( location=Vector3(0, -1500, 100), velocity=Vector3(vel_mul * 350 * rng.uniform(-1, 1), vel_mul * -2000, 0), angular_velocity=Vector3(0, 0, 0))), cars={ # Striker 0: CarState( physics=Physics( location=Vector3(0, 0, 15), rotation=Rotator(0, -pi / 2, 0), velocity=Vector3(0, 0, 0), angular_velocity=Vector3(0, 0, 0)), jumped=False, double_jumped=False, boost_amount=100), # Goalie 1: CarState( physics=Physics( location=Vector3(0, -5000, 15), rotation=Rotator(0, rng.uniform(-.1, .1), 0), velocity=Vector3(0, 0, 0), angular_velocity=Vector3(0, 0, 0)), jumped=True, double_jumped=True, boost_amount=100), }, boosts={i: BoostState(0) for i in range(34)}, )
def make_game_state(self, rng: SeededRandomNumberGenerator) -> GameState: return GameState( ball=BallState(physics=Physics( location=Vector3(1437.9,4074.5999,290.43), velocity=Vector3(481.481,1407.231,-1633.341), angular_velocity=Vector3(5.54691,-1.9003099,-1.27281), rotation=Rotator(0.04343083,-0.69824886,-2.1147842))), cars={ 0: CarState( physics=Physics( location=Vector3(947.70996,810.54,17.05), velocity=Vector3(620.66095,959.18097,0.27099997), angular_velocity=Vector3(-4.0999998E-4,0.0,0.0), rotation=Rotator(-0.016682042,0.9965123,0.0)), jumped=False, double_jumped=False, boost_amount=0.0), 1: CarState( physics=Physics( location=Vector3(-373.35,949.32996,43.309998), velocity=Vector3(115.690994,1242.251,340.411), angular_velocity=Vector3(-0.30971,0.02471,0.08900999), rotation=Rotator(-0.014668691,1.4870985,9.58738E-5)), jumped=True, double_jumped=False, boost_amount=0.0) }, boosts={i: BoostState(0) for i in range(34)}, )
def aerialATBA_test(agent): agent.state = aerialATBA() test_time = time.time() - agent.test_start if(test_time > 20): car_state = CarState( jumped=False, double_jumped=False, boost_amount=87, physics=Physics(location=Vector3(x=0,y=3000,z=0), velocity=Vector3(x=0, y=0, z=0), rotation=Rotator(np.pi, np.pi / 2, np.pi), angular_velocity=Vector3(x=0, y=0, z=0))) ball_state = BallState( physics=Physics(location=Vector3(x=0,y=0,z=500), velocity=Vector3(x=0, y=0, z=0), rotation=Rotator(np.pi / 2, 0, 0), angular_velocity=Vector3(x=0, y=0, z=0))) game_state = GameState(ball=ball_state, cars={agent.index: car_state}) agent.set_game_state(game_state) agent.test_start = time.time() # else: # ball_state = BallState( # physics=Physics(location=Vector3(x=0,y=0,z=500), # velocity=Vector3(x=0, y=0, z=0), # rotation=Rotator(np.pi / 2, 0, 0), # angular_velocity=Vector3(x=0, y=0, z=0))) # game_state = GameState(ball=ball_state) # agent.set_game_state(game_state) return