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.yml
orevo_env_macos.yml
according to your OS, setting thePrefix
variable 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.yml
orconda 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
examples
folder
- Optional: test if everything works by running their examples in the
- Copy
minecraft_pb2.py
andminecraft_pb2_grpc.py
fromEvocraft-py
in the mainevocraft-life-project
directory. - Copy
pytorch_neat
fromPyTorch-NEAT
in the mainevocraft-life-project
directory.
-
Make sure you are running the EvoCraft server. You may launch it issuing
sh run_server.sh
-
Modify the
experiment.cfg
andneat.cfg
as 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.cfg
configuration. -
Run the experiment. You may do this from scratch:
python3 main.py --seed={YOUR_SEED} --n={HOW_MANY_GENERATIONS} --from_scratch
or you can resume it with
python3 main.py --seed={YOUR_SEED} --n={HOW_MANY_GENERATIONS} --net={NETWORK_TIMESTEP_ID} --resume
You 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.