Python wrapper for Malmö, a platform for Artificial Intelligence experimentation and research built on top of Minecraft.
-
Install the dependencies for your OS: Windows, Linux, MacOSX. You can skip Torch, Mono and ALE parts.
-
Install the package itself:
git clone https://github.com/tambetm/minecraft-py.git
cd minecraft-py
pip install -e .
Installation automatically downloads the appropriate Malmo version and unzips it to package directory.
- To precompile Minecraft classes so that subsequent starts will be faster run 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 it in debug mode, so you can see if it gets stuck. You can use similar snippet later to start and stop the Minecraft process.
minecraft_py
module exposes following functions:
proc, port = start(port=None)
- start a new Minecraft process. If port argument is given, it determines the port that Malmo is going to listen, otherwise the first free port starting from 10000 is used. Returns process object and port.stop(proc)
- stops Minecraft started previously withstart()
. SendsSIGTERM
to entire process group.
In addition it adds MalmoPython
module to PYTHONPATH
that can be used to communicate with Minecraft process. MalmoPython
API follows the Malmo C++ API. You can also check the tutorial and examples.
- Python 3 is not supported as Microsoft doesn't provide precompiled binaries for Python 3.