All Projects → Pyrofoux → Drowsy

Pyrofoux / Drowsy

Licence: GPL-3.0 license
💤🖌️ AI making tiny Bitsy video games. Features an experimental generative structure inspired by GANs and Genetic Algorithms

Programming Languages

HTML
75241 projects
python
139335 projects - #7 most used programming language
javascript
184084 projects - #8 most used programming language

Projects that are alternatives of or similar to Drowsy

geneticalgorithm2
Supported highly optimized and flexible genetic algorithm package for python
Stars: ✭ 36 (+89.47%)
Mutual labels:  genetic-algorithm, genetic-algorithms
ga-openai-gym
Usage of genetic algorithms to train a neural network in multiple OpenAI gym environments.
Stars: ✭ 24 (+26.32%)
Mutual labels:  genetic-algorithm, genetic-algorithms
Machine Learning Flappy Bird
Machine Learning for Flappy Bird using Neural Network and Genetic Algorithm
Stars: ✭ 1,683 (+8757.89%)
Mutual labels:  genetic-algorithm, genetic-algorithms
self-propelled-satellites
The system is formed by self-propelled satellites influenced by the Sun whose objective is not to leave the domain maintaining the maximum possible speed.
Stars: ✭ 18 (-5.26%)
Mutual labels:  genetic-algorithm
balldrop
An experimental musical instrument, made with Godot 3.1.
Stars: ✭ 29 (+52.63%)
Mutual labels:  procedural-generation
DungeonGenerator
Procdural dungeon generator for Unity3D
Stars: ✭ 402 (+2015.79%)
Mutual labels:  procedural-generation
NSGAII.jl
A NSGA-II implementation in Julia
Stars: ✭ 18 (-5.26%)
Mutual labels:  genetic-algorithm
mathcore
Advanced .NET math library (.NET Standard).
Stars: ✭ 24 (+26.32%)
Mutual labels:  genetic-algorithm
QuestWeaver
Procedurally generated quests and stories for computer games.
Stars: ✭ 60 (+215.79%)
Mutual labels:  procedural-generation
Sceelix
A procedural generation software for automating 2D/3D content creation.
Stars: ✭ 98 (+415.79%)
Mutual labels:  procedural-generation
wfc
Wave Function Collapse library in C, plus a command-line tool
Stars: ✭ 317 (+1568.42%)
Mutual labels:  procedural-generation
fly
Flight simulator in OpenGL
Stars: ✭ 76 (+300%)
Mutual labels:  procedural-generation
MultiTileBlueNoise
Storage for blue noise textures, including mixed-tiling textures, in results/
Stars: ✭ 16 (-15.79%)
Mutual labels:  procedural-generation
AI-Programming-using-Python
This repository contains implementation of different AI algorithms, based on the 4th edition of amazing AI Book, Artificial Intelligence A Modern Approach
Stars: ✭ 43 (+126.32%)
Mutual labels:  genetic-algorithm
Infinite-Runner-Ultimate
A cross-platform procedural environment generation and Endless Runner engine. Features real-time object pooling and includes an interactive level editor.
Stars: ✭ 69 (+263.16%)
Mutual labels:  procedural-generation
KnapsackFX
Solving Knapsack 0/1 problem with various Local Search algorithms like Hill Climbing, Genetic Algorithms, Simulated Annealing, Tabu Search
Stars: ✭ 25 (+31.58%)
Mutual labels:  genetic-algorithm
A-quantum-inspired-genetic-algorithm-for-k-means-clustering
Implementation of a Quantum inspired genetic algorithm proposed by A quantum-inspired genetic algorithm for k-means clustering paper.
Stars: ✭ 28 (+47.37%)
Mutual labels:  genetic-algorithm
GAN-XML-Fixer
No description or website provided.
Stars: ✭ 55 (+189.47%)
Mutual labels:  gans
procedural
Procedural generation as a service
Stars: ✭ 81 (+326.32%)
Mutual labels:  procedural-generation
MetalCity
MetalCity - a procedural night city landscape generator
Stars: ✭ 29 (+52.63%)
Mutual labels:  procedural-generation

Drowsy - an AI making tiny Bitsy video games

Drowsy is a school project aiming to build an AI architecture able to autonomously create a video game compatible with the Bitsy game engine.

It features :

  • a GAN to generate Avatars
  • a whole new Discriminator Network / Adversarial Genetic Algorithm coupling to generate Rooms (learn more)

The AI generated game is available to play here.

Here's the full project report (French). Below is an English summary.

For any questions, contact me at [email protected], or on Twitter. I'm currently looking for opportunities to study AI and Computational Creativity, like an internship or a PhD. Please get in touch !

Made in 3 months during 2nd year of engineering school, at the École Nationale Supérieure de Cognitique (Bordeaux, 2019)

Table of Contents

Avatar Generation

Dataset


Bitsy avatar, representing a human shape

Ignoring color palette and animations, a Bitsy avatar is a 8x8 image with black and white pixels. The dataset is composed of 420 avatars, extracted from this compilation tweet.


Examples from the avatars dataset

Generative Adversarial Networks (GAN)


Simplified structure of a GAN

The Adversarial part is composed of the Discriminator network and a Generator network layered together.

Since we process images, the chosen networks are CNNs. You can find more information about GANs here.

Results


Outputs of the avatar GAN after 2 hours of training

  • Data shape

    The Generator cannot produce binary data, but only real numbers in the range [0.0 - 1.0]. Produced avatars need a post-processing to convert non-binary gray pixels to a black and white palette.

  • Aesthetic

    The shapes do look like Bitsy avatars. They are evocative, allowing the player to give them a meaning.

  • Diversity

    Slight Mode Collapse around 2 or 3 classes at each training. Retraining just a few times switch the classes.

  • Performance

    These performances where obtained after 2 hours of training on a laptop, with a GTX 1050 and 2 Go of RAM.

Rooms Generation

Dataset


typical Bitsy room, representing a forest (Source)

Ignoring color palette, a Bitsy room is a 128x128 image with black and white pixels. The dataset is composed of 591 rooms, extracted with a custom scrapper used on this list of 21 Bitsy games.

Preliminary Results

The initial approach was to use the same GAN structure than the Avatar generation, only scaled to process 128x128 images.


Outputs of the Room GAN after 4 hours of training

  • Data shape

    Similarly, produced images need to be post-processed to only keep binary pixels.

  • Diversity

    Huge Mode Collapse.

  • Performance

    These performances where obtained after 4 hours of training on a Google Colaboratory dedicated machine, with GPU acceleration.

  • Aesthetic

    The shapes are structureless gradients, where Bitsy maps show these characteristics :

    • local symmetry
    • pattern repetition
    • complex structures made of unitary pieces

Building a new architecture : DN/AGA coupling

The unsatisfactory previous results led us to rethink the architecture behind Room generation. Let's take another angle. We're looking for these characteristics :

  • local symmetry
  • pattern repetition
  • complex structures made of unitary pieces

They are commonly found in the realms of Cellular Automata.

Example of cave-like level generation using cellular automata (Source)

Cellular Automata are frequently used to procedurally generate video game levels. They iteratively apply local transformation rules to an initial grid until it has specific characteristics. Instead of directly handling all the pixels to create a room, we could manipulate the rules of a Cellular Automaton that generates room-like images.

The main issue is that the algorithm running a CA is exact, well-known and simple whereas our current architecture is based on neural networks running complex and evolving algorithms, relevant for unpredictable cases.

There's a huge mismatch between the features we expect of the Adversarial half, and it's nature. We need a structure both able to :

  • generate images following a specific algorithm (Cellular Automata)
  • iteratively approach a specific criterion (fooling the Discriminator)

Our approach is to change the Adversarial half from being a neural network to a genetic algorithm. The requirements to use such a structure are :

  • being able to represent data as a set of genes
  • having a way to evaluate their quality with a fitness function

In our case, the genes are the rules used to generate a room. They consist of the rules of a CA and the rules to generate the initial population of the grid (eg : the two parameters of a normal distribution). The key point is using the evaluation function of the Discriminator as the fitness function of our new Adversarial component.


Structure of the DN/AGA coupling

If we see GANs as a coupling between a Discriminator Network and an Antagonist Network (DN/AN), we can describe our new architecture as an asymmetric coupling between a Discriminator Network and an Adversarial Genetic Algorithm (DN/AGA).

Final Results

Rooms generated by CA rules selected by the DN/AGA coupling

  • Data shape

    The generated rooms can directly be used a Bitsy rooms, without post-processing.

  • Diversity

    The selected room rules by the AGA are diverse, there's no observed phenomenon equivalent to Mode Collapse. One selected set of rules can be reused multiple times to produce rooms with similar features, while being a different room. Simply changing the rules behind the generation of the CA initial population can heavily impact the style of the room . Eg: from Normal Distribution (down right room) to Uniform Distribution (top left room).

  • Performance

    These performances where obtained after 2 hours of training on a PC, with a GTX 1050 and 2 Go of RAM. (Same machine as in the Avatar generation)

  • Aesthetic

    We observe the desired characteristics :

    • local symmetry
    • pattern repetition
    • complex structures made of unitary pieces

    Furthermore, the generated rooms reproduce structures often found in Bitsy games.

    • top right : maze-like room, made of several corridors
    • top left : museum-like room, with distinct items scattered in the space
    • bottom left : road leading to another room
    • bottom right : huge central structure

    More examples can be found in the archives.

Conclusion

Putting together the final game

The final game was assembled by compiling together a selection of rooms generated by several cellular automata, whose rules were designed after 1 hour of training by the DN/AGA coupling. The player's avatar was generated by a GAN, after 2 hours of training. We then manually added doors to go from one room to another, as well as an introduction and conclusion text.

Studying the DN/AGA coupling

The DN/AGA coupling was experimentally developed to go beyond the constraint of having a Generator in the form of a neural network. This structure generalizes the theory behind classical GANs and extends its scope of application to fields where the use of explicit algorithms is relevant. To our knowledge, this kind of coupling between a Discriminator Network and an Adversarial Genetic Algorithm is yet to be studied academically.

Here are some observations we made empirically :

  • Costs

    The DN/AGA structure appears to be way less costly in computation time than its GAN counterpart, and can be done with cheaper hardware

  • Training

    Classical GAN training is made by alternating turns : training the DN on a batch, then the AN, and repeat. Better results were obtained for the DN/AGA by letting each part train enough times before handing over to the other. Criteria for determining if more training was needed were :

    • for the Discriminator Network : an accuracy below a specific threshold
    • for the Adversarial Genetic Algorithm : the median fitness of the population below a specific threshold

For any questions, contact me at [email protected], or on Twitter. I'm currently looking for opportunities to study AI and Computational Creativity, like an internship or a PhD. Please get in touch !

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].