Skip to content

Instantly share code, notes, and snippets.

@rlan
Last active July 26, 2019 07:14
Show Gist options
  • Select an option

  • Save rlan/ae5d9a0771df0c1ed3c4562477f3f296 to your computer and use it in GitHub Desktop.

Select an option

Save rlan/ae5d9a0771df0c1ed3c4562477f3f296 to your computer and use it in GitHub Desktop.
Docker for MineRL competition

What

Procedure for obtaining a docker environment for MineRL competition. Also included is a dummy agent.

Procedure

  1. Download docker image
docker pull wqael/mldock:minerl-pytorch1.1-py3-cuda10
  1. docker run

  2. In running container, start VNC server

echo "starting VNC server ..."
export USER=root
vncserver :1 -geometry 800x600 -depth 24
  1. Run a dummy agent. Note: first time running will download game assets from the internet.
xvfb-run -a -e /dev/stdout -s '-screen 0 800x600x24' python first.py
# first.py

import minerl
import gym
import logging
logging.basicConfig(level=logging.DEBUG)

env = gym.make('MineRLNavigateDense-v0')

obs, _ = env.reset()
done = False
net_reward = 0

while not done:
    action = env.action_space.noop()

    action['camera'] = [0, 0.03*obs["compassAngle"]]
    action['back'] = 0
    action['forward'] = 1
    action['jump'] = 1
    action['attack'] = 1

    obs, reward, done, info = env.step(
        action)

    net_reward += reward
    print("Total reward: ", net_reward)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment