예제 #1
0
    def setup_play_ddqn(self):

        self._reset_game_state()

        input_mapping = {
            "UP": [KeyboardKey.KEY_SPACE]
        }

        self.key_mapping = {
            KeyboardKey.KEY_SPACE.name: "UP"
        }

        movement_action_space = KeyboardMouseActionSpace(
            default_keys=[None, "UP"]
        )

        movement_model_file_path = "datasets/cloney_direction_dqn_0_1_.hp5".replace("/", os.sep)

        self.dqn_movement = DDQN(
            model_file_path=movement_model_file_path if os.path.isfile(movement_model_file_path) else None,
            input_shape=(100, 100, 4),
            input_mapping=input_mapping,
            action_space=movement_action_space,
            replay_memory_size=5000,
            max_steps=1000000,
            observe_steps=1000,
            batch_size=32,
            model_learning_rate=1e-4,
            initial_epsilon=1,
            final_epsilon=0.01,
            override_epsilon=False
            )
    def setup_play(self):
        input_mapping = {
            #"UP": [KeyboardKey.KEY_UP],
            "LEFT": [KeyboardKey.KEY_LEFT],
            #"DOWN": [KeyboardKey.KEY_DOWN],
            "RIGHT": [KeyboardKey.KEY_RIGHT]
        }

        self.key_mapping = {
            #KeyboardKey.KEY_UP.name: "UP",
            KeyboardKey.KEY_LEFT.name: "LEFT",
            #KeyboardKey.KEY_DOWN.name: "DOWN",
            KeyboardKey.KEY_RIGHT.name: "RIGHT"
        }

        direction_action_space = KeyboardMouseActionSpace(
            direction_keys=[None, "LEFT", "RIGHT"])

        direction_model_file_path = "datasets/vvvvvv_direction_dqn_0_1_.h5".replace(
            "/", os.sep)

        self.dqn_direction = DDQN(
            model_file_path=direction_model_file_path
            if os.path.isfile(direction_model_file_path) else None,
            input_shape=(480, 640, 4),
            input_mapping=input_mapping,
            action_space=direction_action_space,
            replay_memory_size=5000,
            max_steps=1000000,
            observe_steps=600,
            batch_size=32,
            model_learning_rate=1e-4,
            initial_epsilon=1,
            final_epsilon=0.01,
            override_epsilon=False)
예제 #3
0
    def setup_play(self):
        #print(f"### setup_play")
        self.performed_inputs = collections.deque(list(), maxlen=8)
        self.game_inputs = {
            "JUMP": [KeyboardKey.KEY_SPACE],
            "DUCK": [KeyboardKey.KEY_DOWN]
            # "NOOP": []
        }

        self.key_mapping = {
            KeyboardKey.KEY_SPACE: "JUMP",
            KeyboardKey.KEY_DOWN: "DUCK"
        }

        # Game Specific Inputs
        direction_action_space = KeyboardMouseActionSpace(
            direction_keys=[None, "JUMP", "DUCK"])

        direction_model_file_path = "datasets/trex_direction_dqn_0_1.hf".replace(
            "/", os.sep)

        self.dqn_direction = DDQN(
            model_file_path=direction_model_file_path
            if os.path.isfile(direction_model_file_path) else None,
            input_shape=(400, 400, 4),
            input_mapping=self.game_inputs,
            action_space=direction_action_space,
            replay_memory_size=40000,
            max_steps=3000000,
            observe_steps=5000,
            batch_size=32,
            model_learning_rate=1e-4,
            initial_epsilon=1.0,
            final_epsilon=0.1,
            override_epsilon=False)
예제 #4
0
    def setup_play(self):
        self.detector = ObjectDetection()
        self.detector.setModelTypeAsTinyYOLOv3()
        self.detector.setModelPath("yolo.h5")
        self.detector.loadModel(detection_speed="flash")

        input_mapping = {
            "KEY_W": [KeyboardKey.KEY_W],
            "KEY_A": [KeyboardKey.KEY_A],
            "KEY_S": [KeyboardKey.KEY_S],
            "KEY_D": [KeyboardKey.KEY_D],
            "KEY_SPACE": [KeyboardKey.KEY_SPACE],
            "KEY_C": [KeyboardKey.KEY_C],
            "KEY_1": [KeyboardKey.KEY_1],
            "KEY_2": [KeyboardKey.KEY_2]
        }

        self.key_mapping = {
            KeyboardKey.KEY_W.name: "KEY_W",
            KeyboardKey.KEY_A.name: "KEY_A",
            KeyboardKey.KEY_S.name: "KEY_S",
            KeyboardKey.KEY_D.name: "KEY_D",
            KeyboardKey.KEY_SPACE.name: "KEY_SPACE",
            KeyboardKey.KEY_C.name: "KEY_C",
            KeyboardKey.KEY_1.name: "KEY_1",
            KeyboardKey.KEY_2.name: "KEY_2"
        }

        direction_action_space = KeyboardMouseActionSpace(direction_keys=[
            "KEY_W", "KEY_A", "KEY_S", "KEY_D", "KEY_SPACE", "KEY_C", "KEY_1",
            "KEY_2"
        ])

        direction_model_file_path = "datasets/Fortnite_direction_dqn_0_1_.h5".replace(
            "/", os.sep)

        self.dqn_direction = DDQN(
            model_file_path=direction_model_file_path
            if os.path.isfile(direction_model_file_path) else None,
            input_shape=(480, 640, 4),
            input_mapping=input_mapping,
            action_space=direction_action_space,
            replay_memory_size=5000,
            max_steps=1000000,
            observe_steps=600,
            batch_size=32,
            model_learning_rate=1e-4,
            initial_epsilon=1,
            final_epsilon=0.01,
        )
    def setup_play(self):
        self.plugin_path = offshoot.config["file_paths"]["plugins"]

        # Context Classifier
        context_classifier_path = f"{self.plugin_path}/SerpentSuperHexagonGameAgentPlugin/files/ml_models/context_classifier.model"

        context_classifier = CNNInceptionV3ContextClassifier(input_shape=(240,
                                                                          384,
                                                                          3))
        context_classifier.prepare_generators()
        context_classifier.load_classifier(context_classifier_path)

        self.machine_learning_models["context_classifier"] = context_classifier

        self.current_run = 0
        self.current_run_started_at = datetime.utcnow()
        self.current_run_duration = 0

        self.last_run_duration = 0
        self.last_run = 0

        input_mapping = {
            "L": [
                self.input_controller.tap_key(KeyboardKey.KEY_LEFT,
                                              duration=0.1)
            ],
            "R": [
                self.input_controller.tap_key(KeyboardKey.KEY_RIGHT,
                                              duration=0.1)
            ],
        }

        action_space = KeyboardMouseActionSpace(
            directional_keys=[None, "L", "R"])

        model_file_path = None

        self.dqn_movement = DDQN(
            model_file_path=
            model_file_path,  #if os.path.isfile(model_file_path) else None,
            input_shape=(120, 192, 3),
            input_mapping=input_mapping,
            action_space=action_space,
            replay_memory_size=50000,
            max_steps=500000,
            observe_steps=10000,
            batch_size=64,
            initial_epsilon=0.1,
            final_epsilon=0.0001,
            override_epsilon=False)
    def setup_play(self):
        global input_mapping

        print("------------------------------------")
        print("Loading Image Classifer . . . ")
        print("------------------------------------")

        plugin_path = offshoot.config["file_paths"]["plugins"]

        context_classifier_path = f"{plugin_path}/SerpentSlayTheSpireGameAgentPlugin/files/ml_models/context_classifier.model"

        context_classifier = CNNInceptionV3ContextClassifier(input_shape=(384, 512, 3))  # Replace with the shape (rows, cols, channels) of your captured context frames

        context_classifier.prepare_generators()
        context_classifier.load_classifier(context_classifier_path)

        self.machine_learning_models["context_classifier"] = context_classifier

        input_mapping = {
            1: [KeyboardKey.KEY_1],
            2: [KeyboardKey.KEY_2],
            3: [KeyboardKey.KEY_3],
            4: [KeyboardKey.KEY_4],
            5: [KeyboardKey.KEY_5],      
            "E": [KeyboardKey.KEY_E]                                   
        }

        action_space = KeyboardMouseActionSpace(
            card_inputs=[1, 2, 3, 4, 5, "E"]
        )

        card_selection_model_file_path = "datasets/tdar31_slaythespire_dqn_0.9981189999999986_.h5".replace("/", os.sep)

        # DDQN setup
        self.dqn_card_selection = DDQN(
            model_file_path=card_selection_model_file_path if os.path.isfile(card_selection_model_file_path) else None,
            input_shape=(90, 160, 4),
            input_mapping=input_mapping,
            action_space=action_space,
            replay_memory_size=1000,
            max_steps=1000,
            observe_steps=100,
            batch_size=64,
            model_learning_rate=1e-4,
            initial_epsilon=1,
            final_epsilon=0.01,
            override_epsilon=True
        )
    def setup_play(self):
        input_mapping = {
            "Q": [KeyboardKey.KEY_Q],
            "W": [KeyboardKey.KEY_W],
            "E": [KeyboardKey.KEY_E],
            "R": [KeyboardKey.KEY_R],
            "T": [KeyboardKey.KEY_T],
            "A": [KeyboardKey.KEY_A],
            "S": [KeyboardKey.KEY_S],
            "SPACE": [KeyboardKey.KEY_SPACE]
        }

        self.key_mapping = {
            KeyboardKey.KEY_Q.name: "Q",
            KeyboardKey.KEY_W.name: "W",
            KeyboardKey.KEY_E.name: "E",
            KeyboardKey.KEY_R.name: "R",
            KeyboardKey.KEY_T.name: "T",
            KeyboardKey.KEY_A.name: "A",
            KeyboardKey.KEY_S.name: "S",
            KeyboardKey.KEY_SPACE.name: "SPACE"
        }

        action_space = KeyboardMouseActionSpace(action_keys=[None, "SPACE"])

        action_model_file_path = "datasets/Va11HallA_action_dqn_0_1_.h5".replace(
            "/", os.sep)

        self.dqn_action = DDQN(
            model_file_path=action_model_file_path
            if os.path.isfile(action_model_file_path) else None,
            input_shape=(self.game.frame_height, self.game.frame_width, 4),
            input_mapping=input_mapping,
            action_space=action_space,
            replay_memory_size=5000,
            max_steps=1000000,
            observe_steps=10000,
            batch_size=32,
            model_learning_rate=1e-4,
            initial_epsilon=1,
            final_epsilon=0.01,
            override_epsilon=False)
예제 #8
0
    def setup_play(self):
        #self.cid = 0
        self.trainID = 0
        self.setup_key()
        self.frame_process = False
        self.rewards = list()
        self.started_at = datetime.now()
        self.started_at_str = self.started_at.isoformat()

        latest_epsilon = 1
        model_file_path = 'fighting_movement_dqn_0_1_.h5'
        model_list = os.listdir('model')
        for item in model_list:
            for epsilon in re.findall("\d+\.\d+", item):
                if latest_epsilon > float(epsilon):
                    latest_epsilon = float(epsilon)
                    model_file_path = item

        model_file_path = f'model/{model_file_path}'.replace('/', os.sep)
        print(">> LOAD MODEL: ", model_file_path)
        time.sleep(1)

        self.dqn_action = DDQN(
            model_file_path=model_file_path
            if os.path.isfile(model_file_path) else None,
            input_shape=(114, 162, 4),
            input_mapping=self.input_mapping,
            action_space=self.action_space,
            replay_memory_size=5000,
            max_steps=1000000,
            observe_steps=100 if os.path.isfile(model_file_path) else 1000,
            batch_size=32,
            initial_epsilon=1,
            final_epsilon=0.01,
            override_epsilon=True)
        print('Starting Game')
        self.input_controller.tap_key(KeyboardKey.KEY_RETURN)
예제 #9
0
    def setup_play(self):
        input_mapping = {"SPACE": [KeyboardKey.KEY_SPACE]}

        self.key_mapping = {KeyboardKey.KEY_SPACE.name: "SPACE"}

        action_space = KeyboardMouseActionSpace(action_keys=[None, "SPACE"])

        action_model_file_path = "datasets/GeometryDash_action_dqn_0_1_.h5".replace(
            "/", os.sep)

        self.dqn_action = DDQN(
            model_file_path=action_model_file_path
            if os.path.isfile(action_model_file_path) else None,
            input_shape=(self.game.frame_height, self.game.frame_width, 4),
            input_mapping=input_mapping,
            action_space=action_space,
            replay_memory_size=5000,
            max_steps=1000000,
            observe_steps=10000,
            batch_size=32,
            model_learning_rate=1e-4,
            initial_epsilon=0.25,
            final_epsilon=0.01,
            override_epsilon=False)
예제 #10
0
    def setup_play(self):
        input_mapping = {
            "UP": [KeyboardKey.KEY_W],
            "LEFT": [KeyboardKey.KEY_A],
            "DOWN": [KeyboardKey.KEY_S],
            "RIGHT": [KeyboardKey.KEY_D],
            "LEFT_UP": [KeyboardKey.KEY_W, KeyboardKey.KEY_A],
            "RIGHT_UP": [KeyboardKey.KEY_W, KeyboardKey.KEY_D],
            "LEFT_DOWN": [KeyboardKey.KEY_S, KeyboardKey.KEY_A],
            "RIGHT_DOWN": [KeyboardKey.KEY_S, KeyboardKey.KEY_D],
            "UP_SHOOT": [KeyboardKey.KEY_UP],
            "LEFT_SHOOT": [KeyboardKey.KEY_LEFT],
            "DOWN_SHOOT": [KeyboardKey.KEY_DOWN],
            "RIGHT_SHOOT": [KeyboardKey.KEY_RIGHT],
            "LEFT_UP_SHOOT": [KeyboardKey.KEY_LEFT, KeyboardKey.KEY_UP],
            "RIGHT_UP_SHOOT": [KeyboardKey.KEY_RIGHT, KeyboardKey.KEY_UP],
            "LEFT_DOWN_SHOOT": [KeyboardKey.KEY_LEFT, KeyboardKey.KEY_DOWN],
            "RIGHT_DOWN_SHOOT": [KeyboardKey.KEY_RIGHT, KeyboardKey.KEY_DOWN],
            "BOOM": [KeyboardKey.KEY_SPACE]
        }

        self.key_mapping = {
            KeyboardKey.KEY_W.name: "MOVE UP",
            KeyboardKey.KEY_A.name: "MOVE LEFT",
            KeyboardKey.KEY_S.name: "MOVE DOWN",
            KeyboardKey.KEY_D.name: "MOVE RIGHT",
            KeyboardKey.KEY_UP.name: "SHOOT UP",
            KeyboardKey.KEY_LEFT.name: "SHOOT LEFT",
            KeyboardKey.KEY_DOWN.name: "SHOOT DOWN",
            KeyboardKey.KEY_RIGHT.name: "SHOOT RIGHT",
        }

        movement_action_space = KeyboardMouseActionSpace(
            directional_keys=[None, "UP", "LEFT", "DOWN", "RIGHT", "LEFT_UP", "RIGHT_UP", "LEFT_DOWN", "RIGHT_DOWN"]
        )

        projectile_action_space = KeyboardMouseActionSpace(
            projectile_keys=[None, "UP_SHOOT", "LEFT_SHOOT", "DOWN_SHOOT", "RIGHT_SHOOT", "LEFT_UP_SHOOT", "RIGHT_UP_SHOOT",
                             "LEFT_DOWN_SHOOT", "RIGHT_DOWN_SHOOT", "BOOM"]
        )

        movement_model_file_path = "datasets/hornet_movement_dqn.h5".replace("/", os.sep)

        self.dqn_movement = DDQN(
            model_file_path=movement_model_file_path if os.path.isfile(movement_model_file_path) else None,
            input_shape=(100, 100, 3),
            input_mapping=input_mapping,
            action_space=movement_action_space,
            replay_memory_size=5000,
            max_steps=1000000,
            observe_steps=10,
            batch_size=16,
            initial_epsilon=1,
            final_epsilon=0.01,
            override_epsilon=False
        )

        projectile_model_file_path = "datasets/hornet_projectile_dqn.h5".replace("/", os.sep)

        self.dqn_projectile = DDQN(
            model_file_path=projectile_model_file_path if os.path.isfile(projectile_model_file_path) else None,
            input_shape=(100, 100, 3),
            input_mapping=input_mapping,
            action_space=projectile_action_space,
            replay_memory_size=5000,
            max_steps=1000000,
            observe_steps=10,
            batch_size=16,
            initial_epsilon=1,
            final_epsilon=0.01,
            override_epsilon=False
        )
    def setup_play(self):
        input_mapping = {
            "W": [KeyboardKey.KEY_W],
            "A": [KeyboardKey.KEY_A],
            "S": [KeyboardKey.KEY_S],
            "D": [KeyboardKey.KEY_D],
            "WA": [KeyboardKey.KEY_W, KeyboardKey.KEY_A],
            "WD": [KeyboardKey.KEY_W, KeyboardKey.KEY_D],
            "SA": [KeyboardKey.KEY_S, KeyboardKey.KEY_A],
            "SD": [KeyboardKey.KEY_S, KeyboardKey.KEY_D],
            "J": [KeyboardKey.KEY_J],
            "K": [KeyboardKey.KEY_K],
            "L": [KeyboardKey.KEY_L],
            "U": [KeyboardKey.KEY_U],
            "I": [KeyboardKey.KEY_I],
            "O": [KeyboardKey.KEY_O],
            "JU": [KeyboardKey.KEY_J, KeyboardKey.KEY_U],
            "KI": [KeyboardKey.KEY_K, KeyboardKey.KEY_I],
            "LO": [KeyboardKey.KEY_L, KeyboardKey.KEY_O],
            "N": [KeyboardKey.KEY_N],
            "M": [KeyboardKey.KEY_M],
            "NONE": []
        }

        self.key_mapping = {
            KeyboardKey.KEY_W.name: "MOVE UP",
            KeyboardKey.KEY_A.name: "MOVE LEFT",
            KeyboardKey.KEY_S.name: "MOVE DOWN",
            KeyboardKey.KEY_D.name: "MOVE RIGHT",
            KeyboardKey.KEY_J.name: "LIGHT PUNCH",
            KeyboardKey.KEY_K.name: "MEDIUM PUNCH",
            KeyboardKey.KEY_L.name: "HARD PUNCH",
            KeyboardKey.KEY_U.name: "LIGHT KICK",
            KeyboardKey.KEY_I.name: "MEDIUM KICK",
            KeyboardKey.KEY_O.name: "HARD KICK",
            KeyboardKey.KEY_N.name: "START",
            KeyboardKey.KEY_M.name: "SELECT"
        }

        movement_action_space = KeyboardMouseActionSpace(directional_keys=[
            "W", "A", "S", "D", "WA", "WD", "SA", "SD", "NONE"
        ])

        fightinput_action_space = KeyboardMouseActionSpace(fightinput_keys=[
            "J", "K", "L", "U", "I", "O", "JU", "KI", "LO", "NONE"
        ])

        movement_model_file_path = "datasets/fighting_movement_dqn_0_1_.h5".replace(
            "/", os.sep)
        self.dqn_movement = DDQN(
            model_file_path=movement_model_file_path
            if os.path.isfile(movement_model_file_path) else None,
            input_shape=(100, 100, 4),
            input_mapping=input_mapping,
            action_space=movement_action_space,
            replay_memory_size=5000,
            max_steps=1000000,
            observe_steps=1000,
            batch_size=32,
            initial_epsilon=1,
            final_epsilon=0.01,
            override_epsilon=False)

        fightinput_model_file_path = "datasets/fighting_fightinput_dqn_0_1_.h5".replace(
            "/", os.sep)
        self.dqn_fightinput = DDQN(
            model_file_path=fightinput_model_file_path
            if os.path.isfile(fightinput_model_file_path) else None,
            input_shape=(100, 100, 4),
            input_mapping=input_mapping,
            action_space=fightinput_action_space,
            replay_memory_size=5000,
            max_steps=1000000,
            observe_steps=1000,
            batch_size=32,
            initial_epsilon=1,
            final_epsilon=0.01,
            override_epsilon=False)
        print("Debug: Game Started")
    def setup_play(self):
        # ALL Key/Input Mappings for SNES Emulator
        input_mapping = {
            "UP": [KeyboardKey.KEY_W],
            "LEFT": [KeyboardKey.KEY_A],
            "DOWN": [KeyboardKey.KEY_S],
            "RIGHT": [KeyboardKey.KEY_D],
            "START": [KeyboardKey.KEY_ENTER],
            "SELECT": [KeyboardKey.KEY_BACKSPACE],
            "B": [KeyboardKey.KEY_Z],
            "A": [KeyboardKey.KEY_V],
            "Y": [KeyboardKey.KEY_X],
            "X": [KeyboardKey.KEY_C],
            "L": [KeyboardKey.KEY_B],
            "R": [KeyboardKey.KEY_N]
        }

        self.key_mapping = {
            KeyboardKey.KEY_W.name: "UP",
            KeyboardKey.KEY_A.name: "LEFT",
            KeyboardKey.KEY_S.name: "DOWN",
            KeyboardKey.KEY_D.name: "RIGHT",
            KeyboardKey.KEY_ENTER.name: "START",
            KeyboardKey.KEY_BACKSPACE.name: "SELECT",
            KeyboardKey.KEY_Z.name: "B",
            KeyboardKey.KEY_V.name: "A",
            KeyboardKey.KEY_X.name: "Y",
            KeyboardKey.KEY_C.name: "X",
            KeyboardKey.KEY_B.name: "L",
            KeyboardKey.KEY_N.name: "R"
        }

        # Game Specific Inputs
        direction_action_space = KeyboardMouseActionSpace(
            direction_keys=[None, "LEFT", "RIGHT"])

        action_space = KeyboardMouseActionSpace(
            action_keys=[None, "B", "A", "Y", "X"])

        direction_model_file_path = "datasets/spaceinvaders_direction_dqn_0_1_.h5".replace(
            "/", os.sep)

        self.dqn_direction = DDQN(
            model_file_path=direction_model_file_path
            if os.path.isfile(direction_model_file_path) else None,
            input_shape=(100, 100, 4),
            input_mapping=input_mapping,
            action_space=direction_action_space,
            replay_memory_size=40000,
            max_steps=3000000,
            observe_steps=5000,
            batch_size=32,
            model_learning_rate=1e-4,
            initial_epsilon=1.0,
            final_epsilon=0.1,
            override_epsilon=False)

        action_model_file_path = "datasets/spaceinvaders_action_dqn_0_1_.h5".replace(
            "/", os.sep)

        self.dqn_action = DDQN(
            model_file_path=action_model_file_path
            if os.path.isfile(action_model_file_path) else None,
            input_shape=(100, 100, 4),
            input_mapping=input_mapping,
            action_space=action_space,
            replay_memory_size=40000,
            max_steps=3000000,
            observe_steps=5000,
            batch_size=32,
            model_learning_rate=1e-4,
            initial_epsilon=1.0,
            final_epsilon=0.1,
            override_epsilon=False)
    def setup_play(self):
        input_mapping = {
            "W": [KeyboardKey.KEY_W],
            "A": [KeyboardKey.KEY_A],
            "S": [KeyboardKey.KEY_S],
            "D": [KeyboardKey.KEY_D],
            "WA": [KeyboardKey.KEY_W, KeyboardKey.KEY_A],
            "WD": [KeyboardKey.KEY_W, KeyboardKey.KEY_D],
            "SA": [KeyboardKey.KEY_S, KeyboardKey.KEY_A],
            "SD": [KeyboardKey.KEY_S, KeyboardKey.KEY_D],
            "UP": [KeyboardKey.KEY_UP],
            "LEFT": [KeyboardKey.KEY_LEFT],
            "DOWN": [KeyboardKey.KEY_DOWN],
            "RIGHT": [KeyboardKey.KEY_RIGHT]
        }

        self.key_mapping = {
            KeyboardKey.KEY_W.name: "MOVE UP",
            KeyboardKey.KEY_A.name: "MOVE LEFT",
            KeyboardKey.KEY_S.name: "MOVE DOWN",
            KeyboardKey.KEY_D.name: "MOVE RIGHT",
            KeyboardKey.KEY_UP.name: "SHOOT UP",
            KeyboardKey.KEY_LEFT.name: "SHOOT LEFT",
            KeyboardKey.KEY_DOWN.name: "SHOOT DOWN",
            KeyboardKey.KEY_RIGHT.name: "SHOOT RIGHT",
        }

        movement_action_space = KeyboardMouseActionSpace(directional_keys=[
            None, "W", "A", "S", "D", "WA", "WD", "SA", "SD"
        ])

        projectile_action_space = KeyboardMouseActionSpace(
            projectile_keys=[None, "UP", "LEFT", "DOWN", "RIGHT"])

        movement_model_file_path = "datasets/binding_of_isaac_movement_dqn_0_1_.h5".replace(
            "/", os.sep)

        self.dqn_movement = DDQN(
            model_file_path=movement_model_file_path
            if os.path.isfile(movement_model_file_path) else None,
            input_shape=(100, 100, 4),
            input_mapping=input_mapping,
            action_space=movement_action_space,
            replay_memory_size=5000,
            max_steps=1000000,
            observe_steps=1000,
            batch_size=32,
            initial_epsilon=1,
            final_epsilon=0.01,
            override_epsilon=False)

        projectile_model_file_path = "datasets/binding_of_isaac_projectile_dqn_0_1_.h5".replace(
            "/", os.sep)

        self.dqn_projectile = DDQN(
            model_file_path=projectile_model_file_path
            if os.path.isfile(projectile_model_file_path) else None,
            input_shape=(100, 100, 4),
            input_mapping=input_mapping,
            action_space=projectile_action_space,
            replay_memory_size=5000,
            max_steps=1000000,
            observe_steps=1000,
            batch_size=32,
            initial_epsilon=1,
            final_epsilon=0.01,
            override_epsilon=False)

        if sys.platform in ["linux", "linux2"]:
            pyperclip.set_clipboard("xsel")

        pyperclip.copy(f"goto s.boss.{self.bosses['MONSTRO']}")
    def setup_play(self):
        #self.cid = 0
        self.trainID = 0
        self.setup_key()
        self.frame_process = False
        self.rewards = list()
        self.started_at = datetime.now()
        self.started_at_str = self.started_at.isoformat()

        self.save_point_path = 'score.npy'
        if os.path.isfile(self.save_point_path):
            self.score_record = np.load(self.save_point_path)
        else:
            self.score_record = np.zeros(shape=(0, ))

        self.collision_count_path = 'collision.npy'
        self.reward_sum = 0
        if os.path.isfile(self.collision_count_path):
            self.collision_counter = np.load(self.collision_count_path)
        else:
            self.collision_counter = np.zeros(shape=(0, ))

        latest_epsilon = 1
        action_model_path = 'dqn_action_0_1_.h5'
        model_list = os.listdir('model/action')
        for item in model_list:
            for epsilon in re.findall("\d+\.\d+", item):
                if latest_epsilon > float(epsilon):
                    latest_epsilon = float(epsilon)
                    action_model_path = item

        action_model_path = f'model/action/{action_model_path}'.replace(
            '/', os.sep)

        self.dqn_action = DDQN(
            model_file_path=action_model_path
            if os.path.isfile(action_model_path) else None,
            input_shape=(100, 100, 4),
            input_mapping=self.input_mapping,
            action_space=self.action_space,
            replay_memory_size=5000,
            max_steps=2000000,
            observe_steps=100 if os.path.isfile(action_model_path) else 2000,
            batch_size=32,
            initial_epsilon=1,
            final_epsilon=0.01,
            override_epsilon=True)

        latest_epsilon = 1
        move_model_path = 'dqn_move_0_1_.h5'
        model_list = os.listdir('model/move')
        for item in model_list:
            for epsilon in re.findall("\d+\.\d+", item):
                if latest_epsilon > float(epsilon):
                    latest_epsilon = float(epsilon)
                    move_model_path = item

        move_model_path = f'model/move/{move_model_path}'.replace('/', os.sep)

        self.dqn_move = DDQN(
            model_file_path=move_model_path
            if os.path.isfile(move_model_path) else None,
            input_shape=(100, 100, 4),
            input_mapping=self.input_mapping,
            action_space=self.move_action_space,
            replay_memory_size=5000,
            max_steps=2000000,
            observe_steps=100 if os.path.isfile(move_model_path) else 2000,
            batch_size=32,
            initial_epsilon=1,
            final_epsilon=0.01,
            override_epsilon=True)
        print('Starting Game')
        self.input_controller.tap_key(KeyboardKey.KEY_RETURN)