How to use the gfootball.env.config function in gfootball

To help you get started, we’ve selected a few gfootball 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 google-research / football / gfootball / env / football_env.py View on Github external
def _construct_players(self, definitions, config):
    result = []
    left_position = 0
    right_position = 0
    for definition in definitions:
      (name, d) = cfg.parse_player_definition(definition)
      config_name = 'player_{}'.format(name)
      if config_name in config:
        config[config_name] += 1
      else:
        config[config_name] = 0
      try:
        player_factory = importlib.import_module(
            'gfootball.env.players.{}'.format(name))
      except ImportError as e:
        logging.error('Failed loading player "%s"', name)
        logging.error(e)
        exit(1)
      player_config = copy.deepcopy(config)
      player_config.update(d)
      player = player_factory.Player(player_config, self._config)
      if name == 'agent':
github google-research / football / gfootball / env / script_helpers.py View on Github external
def __build_players(self, dump_file, spec):
    players = []
    for player in spec:
      players.extend(['replay:path={},left_players=1'.format(
          dump_file)] * config.count_left_players(player))
      players.extend(['replay:path={},right_players=1'.format(
          dump_file)] * config.count_right_players(player))
    return players
github google-research / football / gfootball / env / football_env_wrapper.py View on Github external
  @cfg.log
  def write_dump(self, name):
    return self._trace.write_dump(name)
github google-research / football / gfootball / env / football_env_wrapper.py View on Github external
  @cfg.log
  def reset(self):
    """Reset environment for a new episode using a given config."""
    self._episode_start = timeit.default_timer()
    self._action_set = football_action_set.get_action_set(self._config)
    self._trace = observation_processor.ObservationProcessor(self._config)
    self._cumulative_reward = 0
    self._step_count = 0
    self._env.reset(self._trace)
    self._env_state = 'game_started'
github google-research / football / gfootball / env / script_helpers.py View on Github external
def __build_players(self, dump_file, spec):
    players = []
    for player in spec:
      players.extend(['replay:path={},left_players=1'.format(
          dump_file)] * config.count_left_players(player))
      players.extend(['replay:path={},right_players=1'.format(
          dump_file)] * config.count_right_players(player))
    return players