This repository contains the code for the Seminars in Artificial Intelligence project, submitted also to the Minecraft Open-Endedness Challenge.
The algorithm presented is FEFFuL: Few Examples Fitness Function Learner, a custom way aimed at reducing user fatigue to a minimum in IEC OEE systems.
We suggest using Conda to create a virtual environment.
- Install Conda on your machine
- Download this repository:
git clone https://github.com/gallorob/evocraft-life-project.git - Modify
evo_env_win.ymlorevo_env_macos.ymlaccording to your OS, setting thePrefixvariable to your local conda installation path- You can also change the environment name if it clashes with a preexisting one
- From within the repository folder, create the Conda environment:
conda env create -f evo_env_win.ymlorconda env create -f evo_env_macos.yml - You can then activate the environment using
conda activate evo - Download the EvoCraft API repository (you shouldn't need to install any additional dependency) and follow their installation instructions.
- Optional: test if everything works by running their
example.py
- Optional: test if everything works by running their
- Download the PyTorch Neat repository (you shouldn't need to install any additional dependency) and follow their installation instructions.
- Optional: test if everything works by running their examples in the
examplesfolder
- Optional: test if everything works by running their examples in the
- Copy
minecraft_pb2.pyandminecraft_pb2_grpc.pyfromEvocraft-pyin the mainevocraft-life-projectdirectory. - Copy
pytorch_neatfromPyTorch-NEATin the mainevocraft-life-projectdirectory.
-
Make sure you are running the EvoCraft server. You may launch it issuing
sh run_server.sh
-
Modify the
experiment.cfgandneat.cfgas you wish. The configuration presented here are used to evolve interesting artifacts (such as: statues), but your imagination (and resources) is the limit! Make sure to consult the NEAT-Python docs when changingneat.cfgconfiguration. -
Run the experiment. You may do this from scratch:
python3 main.py --seed={YOUR_SEED} --n={HOW_MANY_GENERATIONS} --from_scratchor you can resume it with
python3 main.py --seed={YOUR_SEED} --n={HOW_MANY_GENERATIONS} --net={NETWORK_TIMESTEP_ID} --resumeYou can also pass a .history file with the --history flag to quickly reapply choices and the --inspect_interval flag to pause the execution to give yourself time to take screenshots of the generated artifacts.
- While the experiment is running, you will have to rate the structures you see appear in the Minecraft world. To do this, simply enter the number of the artifact in the command line when prompted. (remember: the numbers go from 1 to N, starting from the structure with the arrow next to it).
After the experiment is terminated, you can see the Fitness Estimator training curves using Tensorboard by running
tensorboard --logdir=RUNS_DIR
By default the RUNS_DIR directory is runs.
History is automatically saved in the histories folder and so are the model's .checkpoint and final .pth files in the nets folder.