/relay-generator

The architecture used to train the level generator in the game Relay.

Primary LanguagePythonGNU Lesser General Public License v3.0LGPL-3.0

Relay Level Generator

Relay is an action game that tests your reflex skills! In every level, your mission is to relay the circle to the goal. Relay uses deep learning to create levels that match your skill level, with unique levels every single game adapted to you.

This repository contains the architecture used to train the level generator in Relay. Automatic level generation is trained using reinforcement learning. For more details, see blog posts https://medium.com/@henrymao/reinforcement-learning-using-asynchronous-advantage-actor-critic-704147f91686#.n1mvh7mpg and https://medium.com/@henrymao/applying-deep-learning-to-puzzle-level-design-15e9372b562#.z1tln9rzr.

Training Graph

Training Graph

Generated Level

Generated Level

Download Relay on the app store!

Dependencies

Runs with Python 3.5.

We used A3C algorithm with OpenAI Gym, Keras and Tensorflow as our primary tools.

See requirements.txt for all dependencies.

To setup Python, run:

pip install -r requirements.txt

Train Model

To train your own model, run:

python main.py

We have a sample model in the archives folder that is used in our production game.

Run Model

To run the model and generate a level, run:

python main.py -r True

This will output the level as an array to the console.

For the game Relay, we used Keras.js to run the model in production environment (https://github.com/transcranial/keras-js).

References