def __init__(self, fps=22.4, step_mul=1, render_sync=False,
               render_feature_grid=True, video=None):
    """Create a renderer for use by humans.

    Make sure to call `init` with the game info, or just use `run`.

    Args:
      fps: How fast should the game be run.
      step_mul: How many game steps to take per observation.
      render_sync: Whether to wait for the obs to render before continuing.
      render_feature_grid: When RGB and feature layers are available, whether
          to render the grid of feature layers.
      video: A filename to write the video to. Implicitly enables render_sync.
    """
    self._fps = fps
    self._step_mul = step_mul
    self._render_sync = render_sync or bool(video)
    self._raw_actions = False
    self._render_player_relative = False
    self._render_rgb = None
    self._render_feature_grid = render_feature_grid
    self._window = None
    self._window_scale = 0.75
    self._obs_queue = queue.Queue()
    self._render_thread = threading.Thread(target=self.render_thread,
                                           name="Renderer")
    self._render_thread.start()
    self._game_times = collections.deque(maxlen=100)  # Avg FPS over 100 frames.  # pytype: disable=wrong-keyword-args
    self._render_times = collections.deque(maxlen=100)  # pytype: disable=wrong-keyword-args
    self._last_time = time.time()
    self._last_game_loop = 0
    self._name_lengths = {}
    self._video_writer = video_writer.VideoWriter(video, fps) if video else None