コード例 #1
0
 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)},
     )
コード例 #2
0
 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.
     )
コード例 #3
0
    def make_game_state(self, rng: SeededRandomNumberGenerator) -> GameState:
        random_position = Vector3(rng.uniform(-3000, 3000),
                                  rng.uniform(-4000, 4000), 18)
        random_velocity = Vector3(rng.uniform(-1000, 1000),
                                  rng.uniform(-1000, 1000), 0)
        random_rotation = Rotator(0, rng.uniform(-math.pi, math.pi), 0)

        car_physics = Physics(location=random_position,
                              velocity=random_velocity,
                              rotation=random_rotation,
                              angular_velocity=Vector3(0, 0, 0))

        boost = rng.uniform(0, 50)

        car_state = CarState(boost_amount=boost, physics=car_physics)

        return GameState(cars={0: car_state})
コード例 #4
0
 def make_game_state(self, rng: SeededRandomNumberGenerator) -> GameState:
     return GameState(ball=BallState(
         Physics(location=Vector3(rng.uniform(900, 1300),
                                  rng.uniform(0, 1500), 100),
                 velocity=Vector3(0, 550, 0))),
                      cars={
                          0:
                          CarState(boost_amount=87,
                                   jumped=True,
                                   double_jumped=True,
                                   physics=Physics(
                                       location=Vector3(2000, -2500, 25),
                                       rotation=Rotator(0, pi / 2, 0),
                                       velocity=Vector3(0, 0, 0),
                                       angular_velocity=Vector3(0, 0, 0),
                                   ))
                      })
コード例 #5
0
 def make_game_state(self, rng: SeededRandomNumberGenerator) -> GameState:
     return GameState(
         ball=BallState(physics=Physics(
             # location=Vector3(1000 * rng.n11(), rng.uniform(0, 1500), 100),
             location=Vector3(rng.uniform(-1000, 1000),
                              rng.uniform(-1000, 1000), 100),
             velocity=Vector3(rng.uniform(-1000, 1000),
                              rng.uniform(-1000, 1000), 1000),
             angular_velocity=Vector3(0, 0, 0))),
         cars={
             0:
             CarState(physics=Physics(location=Vector3(0, -2500, 18),
                                      rotation=Rotator(0, pi / 2, 0),
                                      velocity=Vector3(0, 0, 0),
                                      angular_velocity=Vector3(0, 0, 0)),
                      boost_amount=87),
         },
     )
コード例 #6
0
 def make_game_state(self, rng: SeededRandomNumberGenerator) -> GameState:
     self.grader.graders[1].max_duration_seconds = 2
     return GameState(
         game_info=GameInfoState(game_speed=1),
         ball=BallState(physics=Physics(
             location=Vector3(rng.uniform(-100, 100), -500, 800),
             velocity=Vector3(rng.uniform(-100, 100), -1500, 900),  # 
             angular_velocity=Vector3(0, 0, 0))),
         cars={
             0:
             CarState(physics=Physics(location=Vector3(
                 rng.uniform(-300, 300), -3000, 17),
                                      rotation=Rotator(0, pi * -0.5, 0),
                                      velocity=Vector3(0, -1500, 0),
                                      angular_velocity=Vector3(0, 0, 0)),
                      boost_amount=60)
         },
     )
コード例 #7
0
ファイル: test.py プロジェクト: L0laapk3/RLBot-ReorientML
    def make_game_state(self, rng: SeededRandomNumberGenerator) -> GameState:
        rng = random
        car_physics = Physics()
        car_physics.rotation = Rotator(math.sinh(rng.uniform(-1, 1)),
                                       rng.uniform(-math.pi, math.pi),
                                       rng.uniform(-math.pi, math.pi))
        car_physics.location = Vector3(0, 0, 800)

        velocity = (rng.normalvariate(0, 1) for _ in range(3))
        norm = sum(x**2 for x in velocity)**0.5
        car_physics.angular_velocity = Vector3(*(x / norm * 5.5
                                                 for x in velocity))

        ball_state = BallState(physics=Physics(velocity=Vector3(0, 0, 20),
                                               location=Vector3(500, 0, 800)))

        return GameState(cars={0: CarState(physics=car_physics)},
                         ball=ball_state)
コード例 #8
0
 def make_game_state(self, rng: SeededRandomNumberGenerator) -> GameState:
     return GameState(
         ball=BallState(physics=Physics(
             location=Vector3(0, 2500, 100),
             velocity=Vector3(0, 0, rng.uniform(0, 1500)),
             angular_velocity=Vector3(0, 0, 0))),
         cars={
             0: CarState(
                 physics=Physics(
                     location=Vector3(rng.uniform(3000, 4000), rng.uniform(2000, 3000), 100),
                     rotation=Rotator(0, rng.uniform(0, pi), 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)},
     )
コード例 #9
0
 def make_game_state(self, rng: SeededRandomNumberGenerator) -> GameState:
     car_pos = Vector3(0, 2500, 25)
     ball_pos = Vector3(rng.uniform(-200, 200), rng.uniform(0, -1500), 100)
     ball_state = BallState(
         Physics(location=ball_pos,
                 velocity=Vector3(0, -1250, 0),
                 angular_velocity=Vector3(0, 0, 0)))
     car_state = CarState(boost_amount=87,
                          jumped=True,
                          double_jumped=True,
                          physics=Physics(location=car_pos,
                                          rotation=Rotator(0, -pi / 2, 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
コード例 #10
0
ファイル: custom_shot.py プロジェクト: GodGamer029/YangBot
 def make_game_state(self, rng: SeededRandomNumberGenerator) -> GameState:
     self.grader.graders[1].max_duration_seconds = 5
     return GameState(
         game_info=GameInfoState(game_speed=1),
         ball=BallState(
             physics=Physics(location=Vector3(rng.uniform(-500, 500),
                                              rng.uniform(-500, 500), 94),
                             velocity=Vector3(0, rng.uniform(-300, 500),
                                              rng.uniform(0, 600)),
                             angular_velocity=Vector3(0, 0, 0))),
         cars={
             0:
             CarState(physics=Physics(location=Vector3(
                 rng.uniform(-100, -90), -2200, 25),
                                      rotation=Rotator(0, pi / 2, 0),
                                      velocity=Vector3(0, 1000, 0),
                                      angular_velocity=Vector3(0, 0, 0)),
                      boost_amount=80),
             1:
             CarState(physics=Physics(
                 location=Vector3(10000, 10000, 10000)))
         },
     )
コード例 #11
0
 def make_game_state(self, rng: SeededRandomNumberGenerator) -> GameState:
     car_pos = Vector3(3500 * rng.n11(), rng.uniform(0, -4000), 25)
     ball_pos = Vector3(car_pos.x, car_pos.y + 500, 500)
     return GameState(
         ball=BallState(physics=Physics(location=ball_pos,
                                        velocity=Vector3(0, 0, 500),
                                        angular_velocity=Vector3(0, 0, 0))),
         cars={
             0:
             CarState(physics=Physics(location=car_pos,
                                      rotation=Rotator(0, pi / 2, 0),
                                      velocity=Vector3(0, 0, 0),
                                      angular_velocity=Vector3(0, 0, 0)),
                      boost_amount=87),
             1:
             CarState(physics=Physics(
                 location=Vector3(10000, 10000, 10000)))
         },
     )
コード例 #12
0
ファイル: carry_training.py プロジェクト: NoMoor/AGC
 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)},
     )
コード例 #13
0
ファイル: stone_kickoff.py プロジェクト: NoMoor/AGC
 def make_game_state(self, rng: SeededRandomNumberGenerator) -> GameState:
     return GameState(
         ball=BallState(physics=Physics(
             location=Vector3(rng.uniform(-800, 800), 0, 0),
             velocity=Vector3(0, 0, 0),
             angular_velocity=Vector3(0, 0, 0))),
         cars={
             0: CarState(
                 physics=Physics(
                     # location=Vector3(rng.uniform(-800, 800), -5800, 0),
                     location=Vector3(0, -5800, 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)}, # Is this needed.
     )
コード例 #14
0
    def make_game_state(self, rng: SeededRandomNumberGenerator) -> GameState:
        car_physics = Physics()
        car_physics.rotation = Rotator(rng.uniform(-math.pi / 2, math.pi / 2),
                                       rng.uniform(-math.pi, math.pi),
                                       rng.uniform(-math.pi, math.pi))
        car_physics.location = Vector3(rng.uniform(-1000, 1000),
                                       rng.uniform(-1000, 1000),
                                       rng.uniform(50, 1400))
        car_physics.angular_velocity = Vector3(rng.uniform(-5, 5),
                                               rng.uniform(-5, 5),
                                               rng.uniform(-5, 5))

        ball_state = BallState(physics=Physics(velocity=Vector3(0, 0, 20),
                                               location=Vector3(0, 0, 800)))

        return GameState(cars={0: CarState(physics=car_physics)},
                         ball=ball_state)
コード例 #15
0
    def make_game_state(self, rng: SeededRandomNumberGenerator) -> GameState:
        minboost = self.boost if self.minboost is None else self.minboost
        maxboost = self.boost if self.maxboost is None else self.maxboost

        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=rng.uniform(minboost, maxboost))
            },
            boosts={i: BoostState(0)
                    for i in range(34)},  # Is this needed.
        )
コード例 #16
0
def get_car_start_near_goal(rng: SeededRandomNumberGenerator) -> Vector3:
    return Vector3(rng.uniform(1000, 2000), 3000, 0)