Action Space¶
We design a compound action space. At each step the agent chooses one movement action (forward, backward, camera actions, etc.) and one optional functional action (attack, use, craft, etc.). Some functional actions such as craft take one argument, while others like attack does not take any argument. This compound action space can be modelled in an autoregressive manner.
Technically, our action space is a multi-discrete space containing eight dimensions:
>>> env.action_space
MultiDiscrete([3, 3, 4, 25, 25, 8, 244, 36])
The table below summarizes the entire action space.
Index |
Descriptions |
Details |
Num Actions |
---|---|---|---|
0 |
Forward and backward |
0: noop, 1: forward, 2: back |
3 |
1 |
Move left and right |
0: noop, 1: move left, 2: move right |
3 |
2 |
Jump, sneak, and sprint |
0: noop, 1: jump, 2: sneak, 3:sprint |
4 |
3 |
Camera delta pitch |
0: -180 degree, 24: 180 degree |
25 |
4 |
Camera delta yaw |
0: -180 degree, 24: 180 degree |
25 |
5 |
Functional actions |
0: noop, 1: use, 2: drop, 3: attack, 4: craft, 5: equip, 6: place, 7: destroy |
8 |
6 |
Argument for “craft” |
All possible items to be crafted |
244 |
7 |
Argument for “equip”, “place”, and “destroy” |
Inventory slot indices |
36 |
Note
We merge the action of using a furnace to craft items (a.k.a., smelt) into “craft” action for simplicity. In other words, our “craft” action can produce items resulted from a crafting table and a furnace.
Action Masks¶
We provide action masks that are supposed to be used with the compound action space. They include masks for functional actions and action arguments. All masks can be accessed in obs
to reflect the fact that action masks are a part of agent’s input.
Functional Action Mask¶
Functional action mask tells if a certain functional action is valid. For example, “no op”, “use”, and “attack” are always valid. The validity of other functional actions mainly depends on inventory.
Data type:
bool
Shape:
(8,)
Access:
obs["masks"]["action_type"]
Note
It is flattened in the same order as in the multi-discrete action space.
Action Argument Mask¶
Action argument mask tells if a functional action requires an argument. For example, only functional actions “craft”, “equip”, “place”, and “destroy” require arguments. Other functional actions do not require any argument.
Data type:
bool
Shape:
(8, 1)
Access:
obs["masks"]["action_arg"]
Equip Mask¶
Equip mask tells if an inventory item can be equipped. For example, all tools, the shield, and all armors are considered as equippable. Items with other types cannot be equipped. This mask includes a vector with the length being the number of inventory slots (36 in our case).
Data type:
bool
Shape:
(36)
Access:
obs["masks"]["equip"]
Place Mask¶
Similar to equip mask, place mask tells if an inventory item can be placed on the ground. For example, only block-type items such as dirt block and diamond block can be placed. Other items such as armors cannot be placed.
Data type:
bool
Shape:
(36)
Access:
obs["masks"]["equip"]
Destroy Mask¶
Destroy mask is another mask operated on inventory. It tells if a slot can be cleaned to empty. This mask is generally valid for non-empty slots.
Data type:
bool
Shape:
(36)
Access:
obs["masks"]["destroy"]
Craft/Smelt Mask¶
This mask tells if a certain item can be produced. If the inventory contains sufficient ingredients to craft an item then it is valid, and invalid vice versa. This mask applies to items that can be obtained from both a crafting table and a furnace.
Data type:
bool
Shape:
(244)
Access:
obs["masks"]["craft_smelt"]