api.config.action_parser

Classes

ActionParser

The action parser. This class is responsible for receiving actions from the agents and parsing them into a format

Module Contents

class api.config.action_parser.ActionParser

Bases: Generic[api.typing.AgentID, api.typing.ActionType, api.typing.EngineActionType, api.typing.StateType, api.typing.ActionSpaceType]

The action parser. This class is responsible for receiving actions from the agents and parsing them into a format supported by the TransitionEngine.

abstract get_action_space(agent: api.typing.AgentID) api.typing.ActionSpaceType

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

Returns:

The type of the action space

abstract reset(agents: List[api.typing.AgentID], initial_state: api.typing.StateType, shared_info: Dict[str, Any]) None

Function to be called each time the environment is reset.

Parameters:
  • agents – List of AgentIDs for which this ActionParser will receive actions

  • initial_state – The initial state of the reset environment.

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

abstract parse_actions(actions: Dict[api.typing.AgentID, api.typing.ActionType], state: api.typing.StateType, shared_info: Dict[str, Any]) Dict[api.typing.AgentID, api.typing.EngineActionType]

Function that parses actions from the action space into a format that rlgym understands. The expected return value is a numpy float array of size (n, 8) where n is the number of agents. The second dimension is indexed as follows: throttle, steer, yaw, pitch, roll, jump, boost, handbrake. The first five values are expected to be in the range [-1, 1], while the last three values should be either 0 or 1.

Parameters:
  • actions – An dict of actions, as passed to the env.step function.

  • state – The GameState object of the current state that were used to generate the actions.

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

Returns:

the parsed actions in the rlgym format.