示例#1
0
    def __init__(self, **kwargs):
        super().__init__(**kwargs)
        self.config = config.get(f"{self.__class__.__name__}Plugin")

        self.platform = kwargs.get("platform")

        self.window_id = None
        self.window_name = kwargs.get("window_name")
        self.window_geometry = None

        self.window_controller = WindowController()

        self.is_launched = False

        self.frame_grabber_process = None
        self.game_frame_limiter = GameFrameLimiter(
            fps=self.config.get("fps", 4))

        self.api_class = None
        self.api_instance = None

        self.sprites = self._discover_sprites()

        self.redis_client = StrictRedis(**config["redis"])

        self.kwargs = kwargs
示例#2
0
    def __init__(self, **kwargs):
        super().__init__(**kwargs)

        self.game = kwargs["game"]
        self.game.api

        self.config = config.get(f"{self.__class__.__name__}Plugin") or dict()

        self.redis_client = StrictRedis(**config["redis"])

        self.input_controller = kwargs["input_controller"]
        self.machine_learning_models = dict()

        self.frame_handlers = dict(
            NOOP=self.handle_noop,
            COLLECT_FRAMES=self.handle_collect_frames,
            COLLECT_FRAME_REGIONS=self.handle_collect_frame_regions,
            COLLECT_FRAMES_FOR_CONTEXT=self.handle_collect_frames_for_context,
            RECORD=self.handle_record)

        self.frame_handler_setups = dict(
            COLLECT_FRAMES=self.setup_collect_frames,
            COLLECT_FRAME_REGIONS=self.setup_collect_frame_regions,
            COLLECT_FRAMES_FOR_CONTEXT=self.setup_collect_frames_for_context,
            RECORD=self.setup_handle_record)

        self.frame_handler_pause_callbacks = dict(
            COLLECT_FRAMES=self.on_collect_frames_pause,
            COLLECT_FRAME_REGIONS=self.on_collect_frame_regions_pause,
            COLLECT_FRAMES_FOR_CONTEXT=self.
            on_collect_frames_for_context_pause,
            RECORD=self.on_record_pause)

        self.reward_functions = dict(TEST=self.reward_test)

        self.frame_handler_setup_performed = False

        #self.visual_debugger = VisualDebugger()

        self.game_frame_buffer = GameFrameBuffer(
            size=self.config.get("game_frame_buffer_size", 5))
        self.game_context = None

        self.sprite_identifier = SpriteIdentifier()
        self._register_sprites()

        self.analytics_client = AnalyticsClient(
            project_key=config["analytics"]["topic"])

        if config["analytics"]["broadcast"]:
            self.analytics_client.track(event_key="RESET_DASHBOARD", data={})

        self.flag = None

        self.uuid = str(uuid.uuid4())
        self.started_at = datetime.now()

        self.kwargs = kwargs
示例#3
0
    def __init__(self, **kwargs):
        super().__init__(**kwargs)
        self.config = config.get(f"{self.__class__.__name__}Plugin", dict())

        self.platform = kwargs.get("platform")

        default_input_controller_backend = InputControllers.CLIENT
        self.input_controller = kwargs.get(
            "input_controller") or default_input_controller_backend

        self.window_id = None
        self.window_name = kwargs.get("window_name")
        self.window_geometry = None

        self.dashboard_window_id = None

        self.window_controller = WindowController()

        self.is_launched = False

        self.frame_grabber_process = None
        self.frame_transformation_pipeline_string = None

        self.crossbar_process = None
        self.input_controller_process = None

        self.game_frame_limiter = GameFrameLimiter(
            fps=self.config.get("fps", 30))

        self.api_class = None
        self.api_instance = None

        self.environments = dict()
        self.environment_data = dict()

        self.sprites = self._discover_sprites()

        self.redis_client = StrictRedis(**config["redis"])

        self.pause_callback_fired = False

        self.kwargs = kwargs