How to use the rlbot.utils.game_state_util.BallState function in rlbot

To help you get started, we’ve selected a few rlbot examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github SaltieRL / Saltie / agents / self_evolving_car / train.py View on Github external
def reset(self):
        """Resets game data after each genome"""
        ball_state = BallState(Physics(velocity=Vector3(0, 0, 0), location=Vector3(self.pos, 5000, 3000),
                                       angular_velocity=Vector3(0, 0, 0)))
        car_state = CarState(jumped=False, double_jumped=False, boost_amount=33,
                             physics=Physics(velocity=Vector3(0, 0, 0), rotation=Rotator(45, 90, 0),
                                             location=Vector3(0.0, -4608, 500), angular_velocity=Vector3(0, 0, 0)))
        game_info_state = GameInfoState(game_speed=1)
        game_state = GameState(ball=ball_state, cars={self.index: car_state}, game_info=game_info_state)
        self.set_game_state(game_state)
github SaltieRL / Saltie / agents / self_evolving_car / self_evolving_car_agent.py View on Github external
def reset(self):
        # RESET TRAINING ATTRIBUTES AFTER EACH GENOME
        ball_state = BallState(Physics(velocity=Vector3(0, 0, 0), location=Vector3(self.pos, 5000, 3000),
                                       angular_velocity=Vector3(0, 0, 0)))
        car_state = CarState(jumped=False, double_jumped=False, boost_amount=33,
                             physics=Physics(velocity=Vector3(0, 0, 0), rotation=Rotator(45, 90, 0),
                                             location=Vector3(0.0, -4608, 500), angular_velocity=Vector3(0, 0, 0)))
        game_info_state = GameInfoState(game_speed=1)
        game_state = GameState(ball=ball_state, cars={self.index: car_state}, game_info=game_info_state)
        self.set_game_state(game_state)
github Darxeal / BotimusPrime / tools / state_setting.py View on Github external
def begin(self):
        self.car = CarState(Physics(Vector3(), Rotator(), Vector3(), Vector3()))
        self.opponent = CarState(Physics(Vector3(), Rotator(), Vector3(), Vector3()))
        self.ball = BallState(Physics(Vector3()))
        self.gameinfo = GameInfoState()
        self._changed = False
github Darxeal / BotimusPrime / training / hello_world_training.py View on Github external
def make_game_state(self, rng: SeededRandomNumberGenerator) -> GameState:
        return GameState(
            ball=BallState(physics=Physics(
                location=Vector3(rng.uniform(-840, 840), -1500, 700),
                velocity=Vector3(0, -2000, 500),
            )),
            cars={
                0: CarState(
                    physics=Physics(
                        location=Vector3(0, -5300, 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=100)
            }
github samuelpmish / ExampleBots / 4_Aerial / agent.py View on Github external
velocity=Vector3(0, 1000, 0),
                rotation=Rotator(0, 1.5 * self.csign, 0),
                angular_velocity=Vector3(0, 0, 0)
            ))

            self.bsign = random.choice([-1, 1])

            b_position = Vector3(random.uniform(-3500, -3000) * self.bsign,
                                 random.uniform(-1500,  1500),
                                 random.uniform(  150,   500))

            b_velocity = Vector3(random.uniform( 1000, 1500) * self.bsign,
                                 random.uniform(- 500,  500),
                                 random.uniform( 1000, 1500))

            ball_state = BallState(physics=Physics(
                location=b_position,
                velocity=b_velocity,
                rotation=Rotator(0, 0, 0),
                angular_velocity=Vector3(0, 0, 0)
            ))

            self.set_game_state(GameState(
                ball=ball_state,
                cars={self.index: car_state})
            )

            self.increment_timer = True

        if self.timer < 0.3:
            self.controls.throttle = 1 * self.csign
        else:
github RLBot / RLBotPythonExample / training / hello_world_training.py View on Github external
def make_game_state(self, rng: SeededRandomNumberGenerator) -> GameState:
        return GameState(
            ball=BallState(physics=Physics(
                location=Vector3(0, 4400, 1000),
                velocity=Vector3(0, 0, 200),
                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)},
        )
github Darxeal / BotimusPrime / training / botimus_training.py View on Github external
def make_game_state(self, rng: SeededRandomNumberGenerator):
        self.rng = rng
        ball = Ball()
        car = Car()
        self.set_car_ball_state(car, ball)
        return GameState(
            ball=BallState(
                physics=Physics(
                    location=vec3_to_Vector3(ball.position),
                    velocity=vec3_to_Vector3(ball.velocity),
                    angular_velocity=vec3_to_Vector3(ball.angular_velocity)
                )
            ),
            cars={
                0: CarState(
                    physics=Physics(
                        location=vec3_to_Vector3(car.position),
                        velocity=vec3_to_Vector3(car.velocity),
                        angular_velocity=vec3_to_Vector3(car.angular_velocity),
                        rotation=mat3_to_Rotator(car.orientation)
                    ),
                    boost_amount=car.boost
                )