def get_state(obs, channels=2): state_size = obs.observation.feature_screen.shape state = np.ndarray(shape=(channels, state_size[1], state_size[2])) if channels == 17: state = obs.observation.feature_screen state = np.asanyarray(state) state = preprocess_channels(obs) elif channels == 2: state[0] = obs.observation.feature_screen.player_relative #state[1] = obs.observation.feature_screen.selected # state[1] = obs.observation.feature_minimap.player_relative state[1] = obs.observation.feature_screen.unit_density elif channels == 1: state[0] = obs.observation.feature_screen.unit_density #player_relative #state = state.transpose(1, 2, 0) state = state[np.newaxis, :] return state
def get_state(obs, channels=2): state_size = obs.observation.feature_screen.shape state = np.ndarray(shape=(channels, state_size[1], state_size[2])) if channels == 17: state = obs.observation.feature_screen state = np.asanyarray(state) state = preprocess_channels(obs) elif channels == 2: state[0] = obs.observation.feature_screen.player_relative #state[1] = obs.observation.feature_screen.selected # state[1] = obs.observation.feature_minimap.player_relative state[1] = obs.observation.feature_screen.unit_density elif channels == 1: state[ 0] = obs.observation.feature_screen.unit_density #player_relative # state = np.asanyarray([substate[:_STATE_SIZE] for substate in state[:_STATE_SIZE]]) state = state.transpose(1, 2, 0) state = state[np.newaxis, :] #state = np.reshape(state, [1, channels, state_size[1], state_size[2]]) # state = np.expand_dims(state, axis=0) # state = np.expand_dims(state, axis=0) return state