rocket_league.obs_builders

Submodules

Classes

DefaultObs

The default observation builder.

Package Contents

class rocket_league.obs_builders.DefaultObs(zero_padding=3, pos_coef=1 / 2300, ang_coef=1 / math.pi, lin_vel_coef=1 / 2300, ang_vel_coef=1 / math.pi, pad_timer_coef=1 / 10, boost_coef=1 / 100)

Bases: rlgym.api.ObsBuilder[rlgym.api.AgentID, numpy.ndarray, rlgym.rocket_league.api.GameState, Tuple[str, int]]

The default observation builder.

POS_COEF = 0.0004347826086956522
ANG_COEF = 0.3183098861837907
LIN_VEL_COEF = 0.0004347826086956522
ANG_VEL_COEF = 0.3183098861837907
PAD_TIMER_COEF = 0.1
BOOST_COEF = 0.01
zero_padding = 3
get_obs_space(agent: rlgym.api.AgentID) Tuple[str, int]

Function that returns the observation space type. It will be called during the initialization of the environment.

Returns:

The type of the observation space

reset(agents: List[rlgym.api.AgentID], initial_state: rlgym.rocket_league.api.GameState, shared_info: Dict[str, Any]) None

Function to be called each time the environment is reset. Note that this does not need to return anything, the environment will call build_obs automatically after reset, so the initial observation for a policy will be constructed in the same way as every other observation.

Parameters:
  • agents – List of AgentIDs for which this ObsBuilder will return an Obs

  • initial_state – The initial game state of the reset environment.

  • shared_info – A dictionary with shared information across all config objects.

build_obs(agents: List[rlgym.api.AgentID], state: rlgym.rocket_league.api.GameState, shared_info: Dict[str, Any]) Dict[rlgym.api.AgentID, numpy.ndarray]

Function to build observations for N agents. This is where observations will be constructed every step and every reset. This function is given the current state, and it is expected that the observations returned by this function will contain information from the perspective of each agent. This function is called only once per step.

Parameters:
  • agents – List of AgentIDs for which this ObsBuilder should return an Obs

  • state – The current state of the game.

  • shared_info – A dictionary with shared information across all config objects.

Returns:

An dictionary of observations, one for each AgentID in agents.

_build_obs(agent: rlgym.api.AgentID, state: rlgym.rocket_league.api.GameState, shared_info: Dict[str, Any]) numpy.ndarray
_generate_car_obs(car: rlgym.rocket_league.api.Car, inverted: bool) numpy.ndarray