Visualizing The Data minerl.viewer
To help you get familiar with the MineRL dataset,
the minerl
python package also provides a data trajectory viewer called
minerl.viewer
:
Warning
BASALT: minerl.viewer
can load BASALT competition data, but is not yet updated to
display the use
or equip
actions yet.
The minerl.viewer
program lets you step through individual
trajectories,
showing the observation seen by the player, the action
they took (including camera, movement, and any action described by an MineRL
environment’s action space), and the reward they received.
usage: python3 -m minerl.viewer [-h] environment [stream_name]
positional arguments:
environment The MineRL environment to visualize. e.g.
MineRLObtainDiamondDense-v0
stream_name (optional) The name of the trajectory to visualize. e.g.
v4_absolute_zucchini_basilisk-13_36805-50154.
optional arguments:
-h, --help show this help message and exit
Try it out on a random trajectory by running:
# Make sure your MINERL_DATA_ROOT is set!
export MINERL_DATA_ROOT='/your/local/path'
# Visualizes a random trajectory of MineRLObtainDiamondDense-v0
python3 -m minerl.viewer MineRLObtainDiamondDense-v0
Try it out on a specific trajectory by running:
# Make sure your MINERL_DATA_ROOT is set!
export MINERL_DATA_ROOT='/your/local/path'
# Visualizes a specific trajectory. v4_absolute_zucch...
python3 -m minerl.viewer MineRLTreechop-v0 \
v4_absolute_zucchini_basilisk-13_36805-50154
Interactive Mode minerl.interactor
Warning
Interactor works in MineRL versions 0.3.7 and 0.4.4 (or above).
Install 0.3.7 with pip install minerl==0.3.7
, or the newest MineRL
with pip install git+https://github.com/minerllabs/minerl.git@dev
.
Once you have started training agents, the next step is getting them to interact with human players.
To help achieve this, the minerl
python package provides a interactive Minecraft client called
minerl.interactor
:
The minerl.interactor
allows you to connect a human-controlled Minecraft client
to the Minecraft world that your agent(s) is using and interact with the agent in real time.
Note
For observation-only mode hit the t
key and type /gamemode sp
to enter
spectator mode and become invisible to your agent(s).
Enables human interaction with the environment.
To interact with the environment add make_interactive to your agent’s evaluation code and then run the minerl.interactor.
For example:
env = gym.make('MineRL...')
# set the environment to allow interactive connections on port 6666
# and slow the tick speed to 6666.
env.make_interactive(port=6666, realtime=True)
# reset the env
env.reset()
# interact as normal.
...
Then while the agent is running, you can start the interactor with the following command.
python3 -m minerl.interactor 6666 # replace with the port above.
The interactor will disconnect when the mission resets, but you can connect again with the same command. If an interactor is already started, it won’t need to be relaunched when running the commnad a second time.