Home
Softono

Sprite Generator

Open source Jupyter Notebook
55
Stars
8
Forks
1
Issues
2
Watchers
2 years
Last Commit

 About Sprite Generator

Python procedural sprite generator

Platforms

Web Self-hosted

Languages

Jupyter Notebook

Links

Need Help Installing Sprite Generator?

We provide expert installation service for this software. Our team will install, configure, and secure Sprite Generator on your server. plans start at just $30.

Sprite Generator

View on GitHub

Sprite Generator

A python port of https://github.com/zfedoran/pixel-sprite-generator. It essentially takes in any template and randomly generates sprites based on the template.

Algorithm

The sprites are generated by using a two dimensional mask. The values in the mask are then randomized and mirrored. The resulting template is rendered to a canvas element.

The algorithm is explained in more detail on Dave Bollinger's website.

Examples

Spaceships

Robots

Dragons

Dragons Top-Down

Code

from SpriteGenerator import generate_canvas

robot = [[0, 0, 0, 0],
         [0, 1, 1, 1],
         [0, 1, 2, 2],
         [0, 0, 1, 2],
         [0, 0, 0, 2],
         [1, 1, 1, 2],
         [0, 1, 1, 2],
         [0, 0, 0, 2],
         [0, 0, 0, 2],
         [0, 1, 2, 2],
         [1, 1, 0, 0]]

im = generate_canvas(robot, 
                     color_variations=0.2, 
                     brightness_noise=0.3,
                     edge_brightness=0.3, 
                     saturation=0.2, 
                     colored=False, 
                     mirror=True, 
                     n=80,
                     nr_columns=20)
im.resize((im.size[0]*2, im.size[1]*2))