• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

tambetm/gym-minecraft: Minecraft environment for Open AI Gym, based on Microsoft ...

原作者: [db:作者] 来自: 网络 收藏 邀请

开源软件名称(OpenSource Name):

tambetm/gym-minecraft

开源软件地址(OpenSource Url):

https://github.com/tambetm/gym-minecraft

开源编程语言(OpenSource Language):

Python 95.2%

开源软件介绍(OpenSource Introduction):

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.




鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap