How to use the gfootball.env.observation_processor.ObservationProcessor 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 / script_helpers.py View on Github external
def dump_to_video(self, dump_file):
    dump = self.load_dump(dump_file)
    cfg = config.Config(dump[0]['debug']['config'])
    cfg['dump_full_episodes'] = True
    cfg['write_video'] = True
    cfg['display_game_stats'] = True
    processor = observation_processor.ObservationProcessor(cfg)
    processor.write_dump('episode_done')
    for frame in dump:
      processor.update(frame)
github google-research / football / gfootball / env / football_env_core.py View on Github external
def reset(self, inc=1):
    """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)
    trace = observation_processor.ObservationProcessor(self._config)
    self._cumulative_reward = 0
    self._step_count = 0
    self._trace = trace
    self._reset(self._env.game_config.render, inc=inc)
    while not self._retrieve_observation():
      self._env.step()
    return True
github google-research / football / gfootball / env / football_env_core.py View on Github external
def set_state(self, state):
    assert (self._env.state == GameState.game_running or
            self._env.state == GameState.game_done), (
                'reset() must be called before set_state()')
    res = self._env.set_state(state)
    assert self._retrieve_observation()
    from_picle = six.moves.cPickle.loads(res)
    self._state = from_picle['FootballEnvCore']
    if self._trace is None:
      self._trace = observation_processor.ObservationProcessor(self._config)
    return from_picle
github google-research / football / gfootball / env / football_env_wrapper.py View on Github external
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'