dedbox / TOAD-GAN

Eric's fork of "TOAD-GAN: Coherent Style Level Generation from a Single Example" by Maren Awiszus, Frederik Schubert and Bodo Rosenhahn.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

If you are using this code in your own project, please cite our paper:

@inproceedings{awiszus2020toadgan,
  title={TOAD-GAN: Coherent Style Level Generation from a Single Example},
  author={Awiszus, Maren and Schubert, Frederik and Rosenhahn, Bodo},
  booktitle={Proceedings of the AAAI Conference on Artificial Intelligence and Interactive Digital Entertainment},
  year={2020}
}

EECS545 Project Addendum

Our Modifications

Our VAE implementation is in the file VAE_bootstrap.py, which is a self-contained script. To run it, run python VAE_bootstrap.py from the command line or hit the "play" button in Spyder.

Our conditional GAN extensions are implemented in train_single_scale.py and PCA_Detector.py. The former file belongs to the existing TOAD-GAN code base. For a complete list of our modifications to it, please refer to the section for train_single_scale.py under the "Files Changed" tab at the following GitHub diff page:

https://github.com/dedbox/TOAD-GAN/compare/dedbox:baseline...submitted#diff-ed183d67207df065a11e1289f19d34cc2abbc5448dea952683cfe9728c342b95

WARNING: Does not work with Python 3.9

Due to bugs in the upstream code base, TOAD-GAN refuses to run without GPU-accelerated PyTorch and an outdated version of the WandB.ai service API. We have updated the requirements.txt file to make installation easier with currently available packages.

Due to bugs in the PyTorch code base, there is no compatible pypi package for GPU-accelerated PyTorch on python 3.9. If you get package conflicts during package installation (see instructions below), make sure your python is version 3.8 or older.

WARNING: Pipenv limitation

The pipenv virtual environment manager does not support the -f command line option needed to install GPU-accelerated PyTorch. To install PyTorch with GPU acceleration, first run the "official" command recommended by pytorch.org, then the remaining dependencies can be installed with pipenv install.

If all else fails, there are two options:

  1. Remove the requirements.txt file, install pytorch manually, then run python main.py and install missing packages as they are reported.
  2. Manually install the .whl files for the desired version of pytorch from https://download.pytorch.org/whl/torch_stable.html, then install the remaining dependencies as described below.

TOAD-GAN

Unofficial pytorch implementation of the paper: "TOAD-GAN: Coherent Style Level Generation from a Single Example" For more information on TOAD-GAN, please refer to the paper (arxiv).

Teaser

This Project includes graphics from the game Super Mario Bros. It is not affiliated with or endorsed by Nintendo. The project was built for research purposes only.

AIIDE 2020

Our paper "TOAD-GAN: Coherent Style Level Generation from a Single Example" was accepted for oral presentation at AIIDE 2020! You can find our video presentation on YouTube.

Our code for TOAD-GUI and TOAD-GAN has been accepted for the AIIDE 2020 Artifact Evaluation Track! It will be recognized in the AIIDE 2020 Program.

TOAD-GUI

If you're interested in a demonstration of pre-trained generators, check out TOAD-GUI. The GUI allows you to generate, edit and play Super Mario Bros. levels generated by TOAD-GANs.

TOAD-GUI_example_link

Getting Started

This section includes the necessary steps to train TOAD-GAN on your system.

Python

You will need Python 3 and the packages specified in requirements.txt. We recommend setting up a virtual environment with pip and installing the packages there.

NOTE: If you have a GPU, check if it is usable with Pytorch and change the requirement in the file to use +gpu instead of +cpu. Training on a GPU is significantly faster.

Install packages with:

$ pip3 install -r requirements.txt -f "https://download.pytorch.org/whl/torch_stable.html"

Make sure you use the pip3 that belongs to your previously defined virtual environment.

TOAD-GAN

Training

Once all prerequisites are installed, TOAD-GAN can be trained by running main.py. Make sure you are using the python installation you installed the prerequisites into.

There are several command line options available for training. These are defined in config.py. An example call which will train a 3-layer TOAD-GAN on level 1-1 of Super Mario Bros. with 4000 iterations each scale would be:

$ python main.py --input-dir input --input-name lvl_1-1.txt --num_layer 3 --alpha 100 --niter 4000 --nfc 64

Generating samples

If you want to use your trained TOAD-GAN to generate more samples, use generate_samples.py. Make sure you define the path to a pretrained TOAD-GAN and the correct input parameters it was trained with.

$ python generate_samples.py  --out_ path/to/pretrained/TOAD-GAN --input-dir input --input-name lvl_1-1.txt --num_layer 3 --alpha 100 --niter 4000 --nfc 64

Experiments

We supply the code for experiments made for our paper. These files come with their own command line parameters each to control the experiment. Check the files for more info.

TPKL-Divergence

$ python main_tile_pattern.py

Level Latent Space

$ python main_level_classification.py

Level Authoring

$ python generate_samples.py --seed_mariokart_road 

Built With

  • Pillow - Python Image Library for displaying images
  • Pytorch - Deep Learning Framework

Authors

  • Maren Awiszus - Institut für Informationsverarbeitung, Leibniz University Hanover
  • Frederik Schubert - Institut für Informationsverarbeitung, Leibniz University Hanover

Copyright

This code is not endorsed by Nintendo and is only intended for research purposes. Mario is a Nintendo character which the authors don’t own any rights to. Nintendo is also the sole owner of all the graphical assets in the game.

About

Eric's fork of "TOAD-GAN: Coherent Style Level Generation from a Single Example" by Maren Awiszus, Frederik Schubert and Bodo Rosenhahn.

License:MIT License


Languages

Language:Jupyter Notebook 83.7%Language:Python 16.2%Language:Shell 0.1%