CraftGround - Reinforcement Learning Environment for Minecraft
CraftGround provides a lightweight and customizable environment for reinforcement learning experiments using Minecraft.
- CraftGround - Reinforcement Learning Environment for Minecraft
Installation
Quick start (conda / mamba)
conda create -n my_experiment_env python=3.11
conda activate my_experiment_env
conda install conda-forge::openjdk=21 conda-forge::cmake conda-forge::glew-dev conda-forge::libpng conda-forge::libzlib conda-forge::libopengl conda-forge::libflite
pip install craftground
Quick start (Ubuntu based systems)
Refer to the provided Dockerfile for a complete setup.
sudo apt-get update
sudo apt-get install -y openjdk-21-jdk python3-pip git \
libgl1-mesa-dev libegl1-mesa-dev libglew-dev \
libglu1-mesa-dev xorg-dev libglfw3-dev xvfb
apt-get clean
pip3 install --upgrade pip
pip3 install cmake # You need latest cmake, not the one provided by apt-get
pip3 install craftground
Windows Setup
Resolve Windows Path Length Limitation
Note: you may need to enable long file path due to windows limitation. You can enable it by editing registry as mentioned here
In the latest versions of Windows, this limitation can be expanded to approximately 32,000 characters. Your administrator will need to activate the “Enable Win32 long paths” group policy, or set LongPathsEnabled to 1 in the registry key HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\FileSystem.
The following command does the same as the above instruction:
reg add "HKLM\SYSTEM\CurrentControlSet\Control\FileSystem" /v LongPathsEnabled /t REG_DWORD /d 1 /f
Resolve Conda Installation Issues
Using conda is recommended for Windows users. You can install conda from here. Make sure to execute
powershell -ExecutionPolicy Bypass
conda init powershell
if you are using PowerShell, in the anaconda powershell prompt.
Setup Headless Environment (Linux)
Refer to Headless Environment Setup for setting up a headless environment.
Install development version
pip install git+https://github.com/yhs0602/CraftGround.git@dev
Run your first experiment
Example repositories
- Check the example repository for benchmarking experiments.
Example code
from craftground import craftground
from stable_baselines3 import A2C
# Initialize environment
env = craftground.make(port=8023, isWorldFlat=True, ...)
# Train model
model = A2C("MlpPolicy", env, verbose=1)
model.learn(total_timesteps=10000)
model.save("a2c_craftground")
Environment Specifications
For detailed specifications, refer to the following documents:
Technical Details
See Technical Details for detailed technical information.
License and Acknowledgements
This project is licensed under the LGPL v3.0 license. The project includes code from the following sources:
Devaju fonts
- Source: Dejavu Fonts
Gamma Utils
This project includes code licensed under the GNU Lesser General Public License v3.0:
- Source: Gamma Utils project
Fabric-Carpet
This project includes code from the Fabric Carpet project, licensed under the MIT License:
- Source: Fabric-Carpet Project
Development / Customization
For detailed development and customization instructions, see Develop.