class_docstr: Launch a starcraft server, initialize a controller, and later, clean up.
  
  This is best used from run_configs, which decides which version to run, and
  where to find it.
  
  It is important to call `close` or use it as a context manager, otherwise
  you'll likely leak temp files and SC2 processes.
docstr: Launch the SC2 process.
  
  Args:
    run_config: `run_configs.lib.RunConfig` object.
    exec_path: Path to the binary to run.
    version: `run_configs.lib.Version` object.
    full_screen: Whether to launch the game window full_screen on win/mac.
    extra_args: List of additional args for the SC2 process.
    verbose: Whether to have the SC2 process do verbose logging.
    host: IP for the game to listen on for its websocket. This is
        usually "127.0.0.1", or "::1", but could be others as well.
    port: Port SC2 should listen on for the websocket.
    connect: Whether to create a RemoteController to connect.
    timeout_seconds: Timeout for the remote controller.
    window_size: Screen size if not full screen.
    window_loc: Screen location if not full screen.
    **kwargs: Extra arguments for _launch (useful for subclasses).
docstr_tok: ["Launch","the","SC2","process",".","Args",":","run_config",":","`","run_configs.lib.RunConfig","`","object",".","exec_path",":","Path","to","the","binary","to","run",".","version",":","`","run_configs.lib.Version","`","object",".","full_screen",":","Whether","to","launch","the","game","window","full_screen","on","win\/mac",".","extra_args",":","List","of","additional","args","for","the","SC2","process",".","verbose",":","Whether","to","have","the","SC2","process","do","verbose","logging",".","host",":","IP","for","the","game","to","listen","on","for","its","websocket",".","This","is","usually","``","127.0.0.1","''",",","or","``",":",":1","''",",","but","could","be","others","as","well",".","port",":","Port","SC2","should","listen","on","for","the","websocket",".","connect",":","Whether","to","create","a","RemoteController","to","connect",".","timeout_seconds",":","Timeout","for","the","remote","controller",".","window_size",":","Screen","size","if","not","full","screen",".","window_loc",":","Screen","location","if","not","full","screen",".","*","*","kwargs",":","Extra","arguments","for","_launch","(","useful","for","subclasses",")","."]
code: def __init__(
      self,
      run_config,
      exec_path,
      version,
      full_screen=False,
      extra_args=None,
      verbose=False,
      host=None,
      port=None,
      connect=True,
      timeout_seconds=None,
      window_size=(640, 480),
      window_loc=(50, 50),
      **kwargs,
  ):
      """Launch the SC2 process.
  
      Args:
        run_config: `run_configs.lib.RunConfig` object.
        exec_path: Path to the binary to run.
        version: `run_configs.lib.Version` object.
        full_screen: Whether to launch the game window full_screen on win/mac.
        extra_args: List of additional args for the SC2 process.
        verbose: Whether to have the SC2 process do verbose logging.
        host: IP for the game to listen on for its websocket. This is
            usually "127.0.0.1", or "::1", but could be others as well.
        port: Port SC2 should listen on for the websocket.
        connect: Whether to create a RemoteController to connect.
        timeout_seconds: Timeout for the remote controller.
        window_size: Screen size if not full screen.
        window_loc: Screen location if not full screen.
        **kwargs: Extra arguments for _launch (useful for subclasses).
      """
      self._proc = None
      self._controller = None
      self._check_exists(exec_path)
      self._tmp_dir = tempfile.mkdtemp(
          prefix="sc-", dir=run_config.tmp_dir
      )
      self._host = host or "127.0.0.1"
      self._port = (
          FLAGS.sc2_port or port or portpicker.pick_unused_port()
      )
      self._version = version
  
      args = [
          exec_path,
          "-listen",
          self._host,
          "-port",
          str(self._port),
          "-dataDir",
          os.path.join(run_config.data_dir, ""),
          "-tempDir",
          os.path.join(self._tmp_dir, ""),
      ]
      if ":" in self._host:
          args += ["-ipv6"]
      if platform.system() != "Linux":
          if full_screen:
              args += ["-displayMode", "1"]
          else:
              args += [
                  "-displayMode",
                  "0",
                  "-windowwidth",
                  str(window_size[0]),
                  "-windowheight",
                  str(window_size[1]),
                  "-windowx",
                  str(window_loc[0]),
                  "-windowy",
                  str(window_loc[1]),
              ]
  
      if verbose or FLAGS.sc2_verbose:
          args += ["-verbose"]
      if FLAGS.sc2_verbose_mp:
          args += ["-verboseMP"]
      if self._version and self._version.data_version:
          args += ["-dataVersion", self._version.data_version.upper()]
      if extra_args:
          args += extra_args
  
      if FLAGS.sc2_gdb:
          print("Launching: gdb", args[0])
          print("GDB run command:")
          print("  run %s" % " ".join(args[1:]))
          print("\n")
          args = ["gdb", args[0]]
          timeout_seconds = 3600 * 6
      elif FLAGS.sc2_strace:
          strace_out = "/tmp/sc2-strace.txt"
          print(
              "Launching in strace. Redirecting output to", strace_out
          )
          args = ["strace", "-f", "-o", strace_out] + args
      else:
          logging.info("Launching SC2: %s", " ".join(args))
  
      try:
          with sw("startup"):
              if not FLAGS.sc2_port:
                  self._proc = self._launch(run_config, args, **kwargs)
              if connect:
                  self._controller = remote_controller.RemoteController(
                      self._host,
                      self._port,
                      self,
                      timeout_seconds=timeout_seconds,
                  )
      except:
          self.close()
          raise
  
imports: import os
  import platform
  import shutil
  import subprocess
  import tempfile
  import time
  from absl import flags
  from absl import logging
  import portpicker
  from pysc2.lib import remote_controller
  from pysc2.lib import stopwatch
label_desc: Use image node_id 1 to create a new StarcraftProcess object from inherited base classes: object with example: obj = StarcraftProcess(run_config, exec_path, version, full_screen, extra_args, verbose, host, port, connect, timeout_seconds, window_size, window_loc)