class_docstr: Wrapper class for iterating over replay observation data.
  
  Yields the observations for a replay from player_id's perspective. The class
  can throw connection errors from the controller. These should be caught
  at the top level, since they are unrecoverable (the controller is unusable).
  
  Determines the replay version from the protocol information in the replay
  file. Uses a cache of processes, one for each binary version required
  to process corresponding replays.
  
  How to use the class:
  
  with ReplayObservationStream() as replay_stream:
    replay_stream.start_replay(replay_data, player_id)
  
    # Get game data if needed.
    info = replay_stream.game_info()
  
    for observation in replay_stream.observations():
      # Do something with each observation.
docstr: Constructs the replay stream object.
  
  Args:
    interface_options: Interface format to use.
    step_mul: Number of skipped observations in between environment steps.
    disable_fog: Bool, True to disable fog of war.
    game_steps_per_episode: Int, truncate after this many steps (0 for inf.).
    add_opponent_observations: Bool, True to return the opponent's
        observations in addition to the observing player. Note that this will
        start two SC2 processes simultaneously if set to True. By default is
        False and returns observations from one player's perspective.
docstr_tok: ["Constructs","the","replay","stream","object",".","Args",":","interface_options",":","Interface","format","to","use",".","step_mul",":","Number","of","skipped","observations","in","between","environment","steps",".","disable_fog",":","Bool",",","True","to","disable","fog","of","war",".","game_steps_per_episode",":","Int",",","truncate","after","this","many","steps","(","0","for","inf.",")",".","add_opponent_observations",":","Bool",",","True","to","return","the","opponent's","observations","in","addition","to","the","observing","player",".","Note","that","this","will","start","two","SC2","processes","simultaneously","if","set","to","True",".","By","default","is","False","and","returns","observations","from","one","player","'s","perspective","."]
code: def __init__(
      self,
      interface_options: sc_pb.InterfaceOptions,
      step_mul: int = 1,
      disable_fog: bool = False,
      game_steps_per_episode: int = 0,
      add_opponent_observations: bool = False,
  ):
      """Constructs the replay stream object.
  
      Args:
        interface_options: Interface format to use.
        step_mul: Number of skipped observations in between environment steps.
        disable_fog: Bool, True to disable fog of war.
        game_steps_per_episode: Int, truncate after this many steps (0 for inf.).
        add_opponent_observations: Bool, True to return the opponent's
            observations in addition to the observing player. Note that this will
            start two SC2 processes simultaneously if set to True. By default is
            False and returns observations from one player's perspective.
      """
      self._step_mul = step_mul
      self._disable_fog = disable_fog
      self._game_steps_per_episode = game_steps_per_episode
      self._add_opponent_observations = add_opponent_observations
  
      self._packet_count = 0
      self._info = None
      self._player_id = None
  
      if not interface_options:
          raise ValueError("Please specify interface_options")
  
      self._interface = interface_options
      self._want_rgb = self._interface.HasField("render")
  
      self._run_config = None
      self._sc2_procs = []
      self._controllers = []
  
imports: import io
  import json
  import time
  from absl import logging
  import mpyq
  from pysc2 import run_configs
  from s2clientprotocol import sc2api_pb2
label_desc: Use image node_id 1 to create a new ReplayObservationStream object from inherited base classes: object with example: obj = ReplayObservationStream(interface_options, step_mul, disable_fog, game_steps_per_episode, add_opponent_observations)