DIAMBRA Arena comes with a large number of ready-to-use wrappers and examples showing how to apply them. They cover a wide spectrum of use cases, and also provide reference templates to develop custom ones. In order to activate wrappers, one has just to add an additional kwargs dictionary, here named wrappers_settings
, to the environment creation method, as shown in the next code block. The dictionary has to be populated as described in the next sections.
env = diambra.arena.make("doapp", settings, wrappers_settings)
Implementation examples and templates can be found in the code repository, here.
Key | Type | Default Value(s) | Value Range | Description |
---|---|---|---|---|
no_op_max | int | 0 | [0, 12] | Performs a maximum of value No-Action steps after episode reset |
wrappers_settings["no_op_max"] = 0
DEPRECATED: For speed, consider using the environment setting frame_shape
that performs the same operation on the engine side, as described in this section.
Key | Type | Default Value(s) | Value Range | Target Observation Element | Description |
---|---|---|---|---|---|
hwc_obs_resize | tuple of three int (H, W, C) | (84, 84, 0) | H, W: [1, 512] C: 0, 1 or 3 | Frame | Warps the frame from original Game resolution to H X W size. C values: 0 - Deactivated; 1 - Grayscale; 3 - RGB; Keeps observation element of type Box, changes its shape |
wrappers_settings["hwc_obs_resize"] = (128, 128, 1)
Key | Type | Default Value(s) | Value Range | Target Observation Element | Description |
---|---|---|---|---|---|
frame_stack | int | 1 | [1, 48] | Frame | Stacks latest value frames together along the third dimension. Keeps observation element of type Box, changes its shape |
dilation | int | 1 | [1, 48] | Frame | Builds frame stacks adding one every value frames. Keeps observation element of type Box |
wrappers_settings["frame_stack"] = 4
wrappers_settings["dilation"] = 1
Key | Type | Default Value(s) | Value Range | Target Observation Element | Description |
---|---|---|---|---|---|
actions_stack | int | 1 | [1, 48] | Actions-Move, Actions-Attack | Stacks latest value actions together for both moves and attacks. Changes observation element type from Discrete to MultiDiscrete, having value elements, each with cardinality equal to the original Discrete one |
wrappers_settings["actions_stack"] = 12
Key | Type | Default Value(s) | Value Range | Target Observation Element | Description |
---|---|---|---|---|---|
scale | bool | False | True / False | All | Activates observation scaling. Affects observation elements as follows: - Box: type kept, changes bounds according to scale_mod setting.- Discrete (Binary): depends on process_discrete_binary (see below).- Discrete: changed to MultiBinary through one-hot encoding, size equal to original Discrete cardinality. - MultiDiscrete: changed to N-MultiBinary through N-times one-hot encoding, N equal to original MultiDiscrete size, encoding size equal to original MultiDiscrete element cardinality |
exclude_image_scaling | bool | False | True / False | Frame | If True, prevents scaling to be applied on the game frame |
process_discrete_binary | bool | False | True / False | Discrete Binary | Controls how Discrete (Binary) observations are treated: - False: not affected; - True: changed to MultiBinary through one-hot encoding, size equal to 2 |
scale_mod | int | 0 | [0, 1] | All | Defines the scaling bounds: 0 - [0, 1]; 1 - [-1, 1]. Keeps observation elements of the same type |
wrappers_settings["scale"] = True
wrappers_settings["exclude_image_scaling"] = True
wrappers_settings["process_discrete_binary"] = True
wrappers_settings["scale_mod"] = 0
Key | Type | Default Value(s) | Value Range | Target Observation Element | Description |
---|---|---|---|---|---|
flatten | bool | False | True / False | RAM States | Activates RAM States dictionary flattening, removing nested dictionaries and creating new keys joining original ones using “_ ” across nesting levels. For example: obs["P1"]["key1"] becomes obs["P1_key1"] |
filter_keys | list of str | None | - | RAM States | Defines the list of RAM states to keep in the observation space |
wrappers_settings["flatten"] = True
wrappers_settings["filter_keys"] = ["stage", "P1_ownHealth", "P1_oppChar"]
Key | Type | Default Value(s) | Value Range | Description |
---|---|---|---|---|
sticky_actions | int | 1 | [1, 12] | Keeps repeating the same action for value environment steps |
In order to use this wrapper, the step_ratio
generic setting must be set to equal to 1.
wrappers_settings["sticky_actions"] = 1
Key | Type | Default Value(s) | Value Range | Description |
---|---|---|---|---|
reward_normalization | bool | False | True / False | Activates reward normalization. Divides reward value by the product between the reward_normalization_factor (see next row) value and the delta between maximum and minium health bar value for the given game |
reward_normalization_factor | float | 0.5 | [-inf, +inf] | Defines the normalization factor multiplying the delta between maximum and minium health bar value for the given game |
wrappers_settings["reward_normalization"] = True
wrappers_settings["reward_normalization_factor"] = 0.5
Key | Type | Default Value(s) | Value Range | Description |
---|---|---|---|---|
clip_rewards | bool | False | True / False | Activates reward clipping. Applies the sign function to the reward value |
wrappers_settings["clip_rewards"] = False