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(-1611.2999, 3176.77, 1294.03), velocity=Vector3(-271.841, 482.451, -253.021), angular_velocity=Vector3(-5.21131, -2.9428098, 0.42601), rotation=Rotator(0.96103895, 0.5027622, -1.1579638))), cars={ 0: CarState(physics=Physics( location=Vector3(-4056.2898, 703.43, 160.06), velocity=Vector3(-51.251, 1661.851, 150.251), angular_velocity=Vector3(-1.5182099, 0.44171, -0.53651), rotation=Rotator(0.05119661, 1.6048316, -1.1736871)), jumped=False, double_jumped=False, boost_amount=100.0), 1: CarState(physics=Physics( location=Vector3(-875.76996, 2313.48, 16.279999), velocity=Vector3(529.34094, 1679.131, 12.241), angular_velocity=Vector3(0.02711, -4.0999998E-4, 0.45961002), rotation=Rotator(-0.011217235, 1.2832708, 4.79369E-4)), jumped=False, double_jumped=False, boost_amount=0.0) }, boosts={i: BoostState(0) for i in range(34)}, )
def setup(self, rng: random.Random) -> GameState: self._reset_state() return GameState( ball=BallState(physics=Physics( location=self.ball_location, velocity=Vector3(0, 0, 0), angular_velocity=Vector3(0, 0, 0))), cars={ 0: CarState( physics=Physics( location=self.car_location, rotation=Vector3( 0, math.atan2( # face the ball self.ball_location.y - self.car_location.y, self.ball_location.x - self.car_location.x, ), 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)}, )
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 make_game_state(self, rng: SeededRandomNumberGenerator) -> GameState: return GameState( ball=BallState(physics=Physics( location=Vector3(-3458.19, 4312.86, 348.0), velocity=Vector3(-757.72095, -1243.141, 286.491), angular_velocity=Vector3(1.76491, 1.18171, 1.30081), rotation=Rotator(-0.024160197, 1.8751956, -0.6473399))), cars={ 0: CarState(physics=Physics( location=Vector3(-2956.47, 4516.11, 17.06), velocity=Vector3(-516.761, -294.841, 0.211), angular_velocity=Vector3(-3.0999997E-4, 0.0014099999, 2.08301), rotation=Rotator(-0.016873788, -2.6419942, -9.58738E-5)), jumped=False, double_jumped=False, boost_amount=22.0), 1: CarState(physics=Physics( location=Vector3(-3426.95, 4613.71, 292.21), velocity=Vector3(-748.751, -741.631, 491.07098), angular_velocity=Vector3(1.55901, -0.69091, -0.00731), rotation=Rotator(0.47524643, -2.3685622, 1.5644686)), 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: 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: 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(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 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 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 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: 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 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) -> GameState: player_json = self.shot_json['start']['player'] ball_json = self.shot_json['start']['ball'] return GameState( ball=BallState(physics=self._parse_physics(rng, ball_json)), cars={ 0: CarState( physics=self._parse_physics(rng, player_json), jumped=False, double_jumped=False, 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(0, 0, 400), velocity=Vector3(0, 0, 0), angular_velocity=Vector3(0, 0, 0))), cars={ 0: CarState(physics=Physics(location=Vector3(0, 0, 20), rotation=Rotator(0, 0, 0), velocity=Vector3(0, 0, 0), angular_velocity=Vector3(0, 0, 0)), boost_amount=33), }, boosts={i: BoostState(0) for i in range(34)}, )
def make_game_state(self, rng: SeededRandomNumberGenerator) -> GameState: return GameState( ball=BallState(physics=Physics( location=self.ballPos, velocity=self.ballVel, angular_velocity=Vector3(0, 0, 0))), cars={ 0: CarState( physics=Physics( location=self.carPos, rotation=Rotator(0, -3.1416 / 2, 0), velocity=Vector3(0, -self.carSpeed, 0), angular_velocity=Vector3(0, 0, 0)), 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(0, 0, 100), velocity=Vector3(0, 0, 0), angular_velocity=Vector3(0, 0, 0))), cars={ 0: CarState(physics=Physics(location=Vector3(0, -3000, 0), rotation=Rotator(0, pi / 2, 0), velocity=Vector3(0, 0, 0), angular_velocity=Vector3(0, 0, 0)), jumped=False, double_jumped=False, boost_amount=0) }, 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(self.ball_start_x + rng.uniform(-30, 30), self.ball_start_y, self.ball_start_z), velocity=Vector3(0, 0, 0), angular_velocity=Vector3(0, 0, 0))), cars={ 0: CarState( physics=Physics( location=Vector3(self.car_start_x, self.car_start_y, 0), rotation=Rotator(0, self.car_angle, 0), velocity=Vector3(0, 0, 0), angular_velocity=Vector3(0, 0, 0)), jumped=False, double_jumped=False, boost_amount=100) }, boosts={1: BoostState(100)}, )
def make_game_state(self, rng: SeededRandomNumberGenerator) -> GameState: return GameState( ball=BallState(physics=Physics( location=Vector3(0, 4500, 100), velocity=Vector3(0, 0, 0), angular_velocity=Vector3(0, 0, 0))), 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(self.car_vx, self.car_vy, 0), angular_velocity=Vector3(0, 0, 0)), jumped=False, double_jumped=False, boost_amount=self.boost) }, boosts={1: BoostState(100)}, )
def make_game_state(self, rng: SeededRandomNumberGenerator) -> GameState: return GameState(ball=BallState(physics=Physics( location=as_cls(Vector3, parse_item(rng, self.ball.get("location", V0))), velocity=as_cls(Vector3, parse_item(rng, self.ball.get("velocity", V0))), angular_velocity=as_cls( Vector3, parse_item(rng, self.ball.get("angular_velocity", V0))), rotation=as_cls(Rotator, parse_item(rng, self.ball.get("rotation", R0))), )), cars={ i: CarState(physics=Physics( location=as_cls( Vector3, parse_item(rng, car.get("location", V0))), velocity=as_cls( Vector3, parse_item(rng, car.get("velocity", V0))), angular_velocity=as_cls( Vector3, parse_item( rng, car.get("angular_velocity", V0))), rotation=as_cls( Rotator, parse_item(rng, car.get("rotation", R0))), ), jumped=parse_item( rng, car.get("jumped", False)), double_jumped=parse_item( rng, car.get("double_jumped", False)), boost_amount=parse_item( rng, car.get("boost_amount", 0))) for i, car in enumerate(self.cars) }, boosts={ i: BoostState(parse_item(rng, v)) for i, v in enumerate(self.boosts) })
def make_game_state(self, rng: SeededRandomNumberGenerator) -> GameState: comms = self.get_matchcomms() self.grader.set_match_comms(comms) return GameState( ball=BallState(physics=Physics(location=Vector3(0, 0, 92.75), velocity=Vector3(0, 0, 0), angular_velocity=Vector3(0, 0, 0))), cars={ 0: CarState(physics=Physics(location=Vector3( self.car_start_x, 3000, 0), rotation=Rotator(0, -pi / 2, 0), velocity=Vector3(0, 0, 0), angular_velocity=Vector3(0, 0, 0)), jumped=False, double_jumped=False, boost_amount=0) }, boosts={i: BoostState(0) for i in range(34)}, )
def make_game_state(self, rng: SeededRandomNumberGenerator) -> GameState: car_spawn_area: utils.Area = utils.RectPrism(Vector3(0, 0, 17), 8000, 8000, 0) ball_spawn_area: utils.Area = utils.RectPrism(Vector3(0, 0, 1000), 8000, 8000, 400) ball_velocity_area: utils.Area = utils.Sphere(Vector3(0, 0, 0), 600) ball_loc: Vector3 = ball_spawn_area.random_point_inside(rng) car_loc: Vector3 = car_spawn_area.random_point_inside(rng) return GameState( ball=BallState(physics=Physics( location=ball_loc, velocity=ball_velocity_area.random_point_inside(rng), angular_velocity=Vector3(0, 0, 0))), cars={ 0: CarState( physics=Physics( location=car_loc, rotation=utils.rotator_from_dir(sub(ball_loc, car_loc)), velocity=Vector3(0, 0, 0), angular_velocity=Vector3(0, 0, 0)), boost_amount=100), }, boosts={i: BoostState(0) for i in range(34)}, )