This repository contains the implementation of a Procedural Content Generation (PCG) system for creating sprite sheets and animations for 2D humanoid game characters, as detailed in the paper:
Art and Animation: Procedural Content Generation for Sprite Sheet Creation
Authors: Pedro M. Fernandes, Carlos Martinho, Rui Prada
Published in Videogame Sciences and Arts (2025)
The project leverages cellular automata to procedurally generate sprite sheets, offering diverse character designs and animations in a scalable, automated manner. This system is ideal for developers aiming to enhance variation and efficiency in 2D game development.
-
Procedural Generation of Sprite Sheets:
- Supports front, back, left, and right views of characters.
- Generates animations for basic movements in four directions.
-
Cellular Automata Algorithm:
- Creates body parts with natural, organic shapes.
- Ensures visual symmetry for humanoid appearance.
-
Scalable Outputs:
- Supports different sprite sizes: 16x16, 32x32, and 64x64 pixels.
- Optimized for small to medium-sized characters.
-
Customizable GUI:
- A user-friendly interface to tweak parameters for art and animation generation.
- Real-time sprite preview with adjustable animation speed.
- Easy saving of generated sprites as PNGs and GIFs.
-
High Diversity:
- Randomized parameters ensure diverse and unique character designs.
- Custom color palette generation for consistent and harmonious sprite aesthetics.
- 2D Games: Automate sprite sheet creation for NPCs, enemies, and characters.
- Game Prototyping: Rapidly generate diverse assets for testing.
- Artistic Exploration: Experiment with unique designs and animations.
- Python 3.8+
- Required Libraries:
tkinter
Pillow
numpy
tkinter
is a built-in library in Python for most distributions, but it may require additional installation depending on your system:
-
On Debian/Ubuntu-based systems:
sudo apt-get install python3-tk
-
On Fedora-based systems:
sudo dnf install python3-tkinter
-
On macOS:
tkinter
is included with Python installations from python.org. -
On Windows:
tkinter
is included by default in Python installations.
For other libraries (Pillow
, numpy
), install them using the requirements.txt
file:
pip install -r requirements.txt
git clone https://github.com/soulfir/sprite-generator.git
cd procedural-sprite-generator
-
Run the Sprite Generator GUI:
python sprite_generator_gui.py
-
Features in GUI:
- Adjust sprite size and animation parameters using sliders.
- Click
Generate!
to create a new sprite. - Preview animations in real time and save them as GIFs or sprite sheets.
-
Direct Algorithm Execution (Optional): For advanced users, run the core generator script:
python npc_sprite_generator.py
npc_sprite_generator.py
: Core logic for procedural sprite generation using cellular automata.sprite_generator_gui.py
: Graphical User Interface for customizing and generating sprites.assets/
: Example generated sprites and animations.README.md
: This documentation.requirements.txt
: Python dependencies.
-
Cellular Automata for Sprite Generation:
- Generates random matrices for organic shapes.
- Applies symmetry for humanoid aesthetics.
- Assigns colors using a custom color harmony algorithm.
-
Animation Framework:
- Combines body components for sequential animations.
- Ensures geometrical consistency across frames.
-
GUI Features:
- Intuitive controls for size, layering, and animation speed.
- Randomized sprite names for added character.
Generated sprites and animations are located in the assets/
directory. Examples include:
- 16x16: Pixel-perfect miniatures ideal for retro-styled games.
- 32x32: Balanced detail for modern 2D games.
- 64x64: High-detail sprites suitable for larger characters or enemies.
- Enhanced artistic control through palette and layer customization.
- Automated filtering for low-quality or inappropriate sprites.
- Group and species creation for themed sprite families.
- Expanded animation capabilities for complex movements.
-
Pedro M. Fernandes
INESC-ID and Instituto Superior Técnico, Lisbon, Portugal
Email: [email protected] -
Carlos Martinho
INESC-ID and Instituto Superior Técnico, Lisbon, Portugal
Email: [email protected] -
Rui Prada
INESC-ID and Instituto Superior Técnico, Lisbon, Portugal
Email: [email protected]
If you use this work, please cite:
@inproceedings{procedural_sprite_generation_2025,
title={Art and Animation: Procedural Content Generation for Sprite Sheet Creation},
author={Fernandes, Pedro M. and Martinho, Carlos and Prada, Rui},
booktitle={Videogame Sciences and Arts},
year={2025},
publisher={Springer}
}
This project is licensed under the MIT License. See LICENSE
for more details.