Skip to content

Manipulating Game State

Tyler edited this page Sep 2, 2018 · 10 revisions

Feature is not released yet, this document is a preview!

Overview

For a general description of the feature and its possibilities, please see https://github.com/RLBot/RLBot/wiki/Manipulating-Game-State

Usage

The basic call takes this form:

from rlbot.utils.game_state_util import GameState

game_state = GameState()
self.set_game_state(game_state)

You can do that from anywhere in your bot code. That example doesn't do anything because nothing was specified on the GameState object. You can specify parts of your desired game state like this:

from rlbot.utils.game_state_util import GameState, BallState, CarState, Physics, Vector3, Rotator

car_state = CarState(jumped=False, double_jumped=False, boost_amount=87, 
                     physics=Physics(velocity=Vector3(z=500), rotation=Rotator(math.pi / 2, 0, 0), angular_velocity=Vector3(0, 0, 0)))

ball_state = BallState(Physics(location=Vector3(0, 0, None)))

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

self.set_game_state(game_state)

With the above code, the bot will fling itself upward with its front pointed to the ceiling, and warp the ball to the middle of the field but without altering its z position.

Clone this wiki locally