I dream of pixel art postcompo: generative AI in the browser

I've participated in many LDs, but this time round I made it really hard for myself! My goal was to create an AI and put it in a browser game. I decided on a generative AI that generates pixel art, because I am really interested in image generation. Being a total noob to Python and Pytorch, I had an insane weekend, and barely managed to publish something functional.

But is was a start. After another week of hard work, I actually managed to get a good result! I now have a neural network that reliably creates potion sprites.

I had to fix a lot of things before it worked well. I changed the approach, from GAN to denoising autoencoder, to denoising in latent space; I had to work around bugs and issues in Torch model export and ONNX; I spent a lot of time digging deeper into Pytorch and trying different things.

I started with a messy 16x16 pixel art dataset, created on day 1, which I cleaned and reduced to 8x8 to make it more tractable. When I finally got it to reproduce the sprites reliably, I realised that the sprites are not similar enough for generalization or creative variations. So I needed a dataset with a lot of similar sprites. I ended up using a hand-coded sprite generator to generate a dataset of 1024 12x12 potion sprites. The neural network managed to replicate these potions quite reliably, demonstrating that it can replicate the algorithm from just examples.

Potions generative AI demo

The original generation algorithm

potions-demo-screenshot-1.png