Skip to content
プロジェクト

概要

Minecraft environment for Open AI Gym, based on Microsoft's Malmo.

AI・機械学習

この数値の測り方

計測したスター増加

24時間
0
7日間
0
15日間
0
1か月
履歴を収集中

期間ごとの純増数です。期間は重複しており、日別の値ではありません。未計測の値は空欄です。スター数は注目度の指標であり、品質の保証ではありません。

Gym Minecraft

This project is outdated, please use MalmoEnv instead.

Gym Minecraft is an environment bundle for OpenAI Gym. It is based on Microsoft's Malmö, which is a platform for Artificial Intelligence experimentation and research built on top of Minecraft.

MinecraftDefaultWorld1-v0
MinecraftDefaultFlat1-v0
MinecraftTrickyArena1-v0
MinecraftEating1-v0
MinecraftCliffWalking1-v0
MinecraftMaze1-v0
MinecraftMaze2-v0
MinecraftBasic-v0
MinecraftObstacles-v0
MinecraftSimpleRoomMaze-v0
MinecraftAttic-v0
MinecraftVertical-v0
MinecraftComplexityUsage-v0
MinecraftMedium-v0
MinecraftHard-v0

Basically these are original Malmö missions with only <PrioritiseOffscreenRendering> added to speed up training.

Installation

  1. Install the dependencies for your OS: Windows, Linux, MacOSX. You can skip Torch, Mono and ALE parts.

  2. Install OpenAI Gym and its dependencies.

pip install gym
  1. Download and install minecraft_py.
git clone https://github.com/tambetm/minecraft-py.git
cd minecraft-py
# NB! `minecraft_py` should be installed to writable user directory, either in virtualenv or with `--user` option.
python setup.py install
  1. Download and install gym-minecraft:
git clone https://github.com/tambetm/gym-minecraft.git
cd gym-minecraft
python setup.py install

gym-minecraft needs pygame to render Minecraft screen. It is best to have pygame installed via your system commands, i.e. sudo apt-get install python-pygame or conda install pygame. Otherwise setup will automatically download and compile pygame. This might need some additional dependencies though, see instructions for Ubuntu, OSX or Windows.

  1. Run once following snippet:
import logging
logging.basicConfig(level=logging.DEBUG)

import minecraft_py

proc, port = minecraft_py.start()
minecraft_py.stop(proc)

Basically Minecraft downloads and compiles everything on first start, this snippet just starts minecraft_py in debug mode, so you can see when Minecraft gets stuck.

Running

import gym
import gym_minecraft

env = gym.make('MinecraftBasic-v0')
env.init(start_minecraft=True)
env.reset()

done = False
while not done:
        env.render()
        action = env.action_space.sample()
        obs, reward, done, info = env.step(action)

env.close()

NB! Running Minecraft for the first time might take a while as it downloads and compiles itself. Next time the startup time should be shorter, but still around 30 seconds. In active development phase you might want to start one permanent Minecraft process in background and remove start_minecraft=True, see wiki.

Overriding default settings

The default settings for environments might not be optimal for you. Luckily you can easily override them using init().

For example to use discrete actions instead of continuous actions:

env = gym.make('MinecraftBasic-v0')
env.init(allowDiscreteMovement=["move", "turn"])

To use continuous actions instead of discrete actions:

env = gym.make('MinecraftBasic-v0')
env.init(allowContinuousMovement=["move", "turn"])

To use different video resolution:

env = gym.make('MinecraftBasic-v0')
env.init(videoResolution=[40, 30])

More documentation about configuration options is in wiki.

関連プロジェクトを探す

読み込み中…