rocket_league.reward_functions.combined_reward

Classes

CombinedReward

A RewardFunction that does a weighted sum of multiple reward functions.

Module Contents

class rocket_league.reward_functions.combined_reward.CombinedReward(*rewards_and_weights: rlgym.api.RewardFunction | Tuple[rlgym.api.RewardFunction, float])

Bases: rlgym.api.RewardFunction[rlgym.api.AgentID, rlgym.rocket_league.api.GameState, float]

A RewardFunction that does a weighted sum of multiple reward functions.

reward_fns = ()
weights = ()
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. This is meant to enable users to design stateful reward functions that maintain information about the game throughout an episode to determine a reward.

Parameters:
  • agents – List of AgentIDs for which this RewardFunc will return a Reward

  • initial_state – The initial state of the reset environment.

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

get_rewards(agents: List[rlgym.api.AgentID], state: rlgym.rocket_league.api.GameState, is_terminated: Dict[rlgym.api.AgentID, bool], is_truncated: Dict[rlgym.api.AgentID, bool], shared_info: Dict[str, Any]) Dict[rlgym.api.AgentID, float]

Function to compute the reward for a player. This function is given a player argument, and it is expected that the reward returned by this function will be for that player.

Parameters:
  • agents – List of AgentIDs for which this RewardFunc should return a Reward

  • state – The current state of the game.

  • is_terminated – TODO.

  • is_truncated – TODO.

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

Returns:

A dict of rewards, one for each AgentID in agents.