GithubHelp home page GithubHelp logo

bittorf / c64_gen_ai Goto Github PK

View Code? Open in Web Editor NEW

This project forked from nickbild/c64_gen_ai

0.0 0.0 0.0 24.24 MB

Make creative retro game sprites on the Commodore 64 with generative AI.

License: GNU General Public License v3.0

Python 100.00%

c64_gen_ai's Introduction

Commodore 64 AI Image Generator

Make creative retro game sprites on the Commodore 64 with generative AI.

How It Works

AI image generators are very popular these days, and the results are used in all sorts of creative projects. This made me wonder what it would have been like if image generators had existed during the early personal computer revolution in the 1980s. What would they have been like, and what would the images have been used for?

Today's algorithms, like Stable Diffusion, require a huge amount of computational resources that simply cannot be made to work (in any reasonable way) on machines of the era. But with some work, a simpler generative algorithm could be used to produce images. So I decided to adapt a probabilistic PCA algorithm to run on a Commodore 64, with the goal of producing 8x8 retro game sprites that could have been used to inspire a game design.

I started by building a model using a modified version of the Python code found in this tutorial. I made about 100 retro-inspired sprites (represented as binary strings) with the help of a spreadsheet I made. This data was used to train the model on a modern computer with modified scripts from the tutorial.

This produces a number of parameter values (a mean matrix, covariance matrix, etc.) that only need to be calculated once for a given dataset. These were then plugged into a script I created with simplified logic โ€” no NumPy or other libraries โ€” to run the randomization and generative parts of the algorithm. This simplification made it easy to convert the logic into BASIC code that is compatible with the Commodore 64. That code is then loaded onto a C64 to generate unique images that fit in the distribution of the training data. Finally, the 8x8 images are expanded to 64x64 and displayed on the screen.

The number of iterations the algorithm goes through can be varied. More iterations produces better results generally, but takes longer. At 94 iterations, it takes about 20 minutes to run on a C64. Not really too bad considering how long a modern image generator would take on a modern computer without a GPU.

Media

Check out the demo video on YouTube.

Running on a C64:

Samples of generated images:

Bill of Materials

  • 1 x Commodore 64

About the Author

Nick A. Bild, MS

c64_gen_ai's People

Contributors

nickbild avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.