Minecraft Mob Gladiator uses Malmo (not MalmoEnv) to run the RL training. As such, the instructions to install Malmo must be used. The README instructions from the Malmo Github are included below in the section called Malmö with full detailed instructions regarding setting up the environment. Simplified and general instructions to install the environment and run the model are provided below.
Follow the Malmo instructions to install the environment compatible to your Operating System prior to running this code.
Note: For Windows, manual installation will likely be required as automated setup may be outdated.
- Java JDK 8
- Scroll down for Java 8 download - jdk-8u391
- Python 3.7
- 7 Zip
- Download 64-bit x64
- ffmpeg
- Unpack the zip folder into C:\ffmpeg
- Add C:\ffmpeg\bin to your PATH (How To)
- Note: Malmo instructions for downloading ffmpeg are outdated
- ffmpeg can be downloaded from this link and instructions for manual installation can be followed to add it to path
pip can be used to install Malmo locally. The following instructions are simplified but the full instructions can be found here.
pip3 install malmo
- already in requirements.txt for this project
- installs Malmo in python with native code package
- In your directory of choice, run the following command:
python3 -c "import malmo.minecraftbootstrap; malmo.minecraftbootstrap.download()"
- A subdirectory called
MalmoPlatform
will be created that can be run on your platform - In this directory, there will be many folders/files including a
Minecraft
andSchemas
folder
Alternatively, if pip can't be used, instructions to download a pre-built version can be found here under the Malmo as a native Python wheel
section.
- When downloading from the pre-built releases, make sure to download a version with Python 3.7
After the Malmo package is installed locally, the Schemas folder (e.g. C:\Malmo\Schemas
) must be set as an environment variable named MALMO_XSD_PATH
.
Once the Malmo files built for your environment are downloaded along with dependencies, the Minecraft client
can be launched by running launchClient
in Malmo's Minecraft folder.
Alternatively, if pip was used to install malmo and python3 -c "import malmo.minecraftbootstrap; malmo.minecraftbootstrap.download()"
was run to download the required files, then the following command can be run to launch Minecraft:
python3 -c "import malmo.minecraftbootstrap; malmo.minecraftbootstrap.launch_minecraft()"
- Must be run in your working directory to work (the one containing
MalmoPlatform/Minecraft
) - Note: The MALMO_XSD_PATH environment variable is required for this to run
- Must be run in your working directory to work (the one containing
After Minecraft has been fully launched, Minecraft Mob Gladiator can be run.
Take the following steps to run the Minecraft Mob Gladiator
.
- Clone this repository into your Malmo folder:
git clone https://github.com/syd-tan/Mob-Gladiator.git
- Install the dependencies from the requirements.txt file:
pip install -r requirements.txt
- If you have not already, launch Minecraft by going into the Minecraft folder in Malmo and run
launchClient
- With Minecraft launched, run
python3 training-DQN.py
- If
training_model.tar
is in yourMob_Gladiator
directory, training will resume from the latest saved point - To restart training from the beginning, delete
training_model.tar
- If
- The agent can be seen training against mobs. To stop the program, press
Ctrl + C
- To run evaluation/graphing of statistics, use
project.ipynb
to graph up to 4400 episodes of checkpoints. The notebook assumes that you have continuous checkpoint files spaced 100 episodes apart for graphing.
Project Malmö is a platform for Artificial Intelligence experimentation and research built on top of Minecraft. We aim to inspire a new generation of research into challenging new problems presented by this unique environment.
On common Windows, MacOSX and Linux variants it is possible to use pip3 install malmo
to install Malmo as a python with native code package: Pip install for Malmo. Once installed, the malmo Python module can be used to download source and examples and start up Minecraft with the Malmo game mod.
Alternatively, a pre-built version of Malmo can be installed as follows:
-
Download the latest pre-built version, for Windows, Linux or MacOSX.
NOTE: This is not the same as downloading a zip of the source from Github. Doing this will not work unless you are planning to build the source code yourself (which is a lengthier process). If you get errors along the lines of "ImportError: No module named MalmoPython
" it will probably be because you have made this mistake. -
Install the dependencies for your OS: Windows, Linux, MacOSX.
-
Launch Minecraft with our Mod installed. Instructions below.
-
Launch one of our sample agents, as Python, C#, C++ or Java. Instructions below.
-
Follow the Tutorial
-
Explore the Documentation. This is also available in the readme.html in the release zip.
-
Read the Blog for more information.
If you want to build from source then see the build instructions for your OS: Windows, Linux, MacOSX.
We're building up a Troubleshooting page of the wiki for frequently encountered situations. If that doesn't work then please ask a question on our chat page or open a new issue.
Minecraft needs to create windows and render to them with OpenGL, so the machine you do this from must have a desktop environment.
Go to the folder where you unzipped the release, then:
cd Minecraft
launchClient
(On Windows)
./launchClient.sh
(On Linux or MacOSX)
or, e.g. launchClient -port 10001
to launch Minecraft on a specific port.
on Linux or MacOSX: ./launchClient.sh -port 10001
NB: If you run this from a terminal, the bottom line will say something like "Building 95%" - ignore this - don't wait for 100%! As long as a Minecraft game window has opened and is displaying the main menu, you are good to go.
By default the Mod chooses port 10000 if available, and will search upwards for a free port if not, up to 11000. The port chosen is shown in the Mod config page.
To change the port while the Mod is running, use the portOverride
setting in the Mod config page.
The Mod and the agents use other ports internally, and will find free ones in the range 10000-11000 so if administering a machine for network use these TCP ports should be open.
cd Python_Examples
python3 run_mission.py
cd Cpp_Examples
To run the pre-built sample:
run_mission
(on Windows)
./run_mission
(on Linux or MacOSX)
To build the sample yourself:
cmake .
cmake --build .
./run_mission
(on Linux or MacOSX)
Debug\run_mission.exe
(on Windows)
To run the pre-built sample (on Windows):
cd CSharp_Examples
CSharpExamples_RunMission.exe
To build the sample yourself, open CSharp_Examples/RunMission.csproj in Visual Studio.
Or from the command-line:
cd CSharp_Examples
Then, on Windows:
msbuild RunMission.csproj /p:Platform=x64
bin\x64\Debug\CSharpExamples_RunMission.exe
cd Java_Examples
java -cp MalmoJavaJar.jar:JavaExamples_run_mission.jar -Djava.library.path=. JavaExamples_run_mission
(on Linux or MacOSX)
java -cp MalmoJavaJar.jar;JavaExamples_run_mission.jar -Djava.library.path=. JavaExamples_run_mission
(on Windows)
cd Python_Examples
python3 ALE_HAC.py
Please cite Malmo as:
Johnson M., Hofmann K., Hutton T., Bignell D. (2016) The Malmo Platform for Artificial Intelligence Experimentation. Proc. 25th International Joint Conference on Artificial Intelligence, Ed. Kambhampati S., p. 4246. AAAI Press, Palo Alto, California USA. https://github.com/Microsoft/malmo
This project has adopted the Microsoft Open Source Code of Conduct. For more information see the Code of Conduct FAQ or contact [email protected] with any additional questions or comments.