# Pyxel — Retro Game Engine for Python > A Python game engine inspired by classic 8-bit consoles with a 16-color palette, 4-channel sound, and built-in sprite and music editors. ## Install Save as a script file and run: # Pyxel — Retro Game Engine for Python ## Quick Use ```bash pip install pyxel # Run a built-in example pyxel run pyxel.examples.01_hello_pyxel # Or create a minimal game python3 -c " import pyxel pyxel.init(160, 120, title='Hello Pyxel') def update(): pass def draw(): pyxel.cls(0) pyxel.text(55, 55, 'Hello!', 7) pyxel.run(update, draw) " ``` ## Introduction Pyxel is a retro-style game engine for Python that enforces the creative constraints of 8-bit hardware: a fixed 16-color palette, 256x256 sprite sheets, and 4-channel chiptune audio. These deliberate limitations make it approachable for beginners and fun for experienced developers building jam games or prototypes. ## What Pyxel Does - Provides a fixed 16-color palette and pixel-art rendering pipeline - Includes built-in editors for sprites, tilemaps, sounds, and music - Supports keyboard, mouse, and gamepad input out of the box - Exports games as standalone HTML5 apps via WebAssembly - Runs on Windows, macOS, Linux, and the web ## Architecture Overview Pyxel's core is written in Rust for performance, with Python bindings exposed through a clean API. The engine manages a fixed-resolution framebuffer, audio channels, and resource files (.pyxres) that bundle sprites, tilemaps, and sounds. The game loop follows a simple update/draw pattern. ## Self-Hosting & Configuration - Install via pip: pip install pyxel (requires Python 3.8+) - Launch the built-in editors with: pyxel edit my_resources.pyxres - Set display resolution, title, and frame rate in pyxel.init() - Package games for web distribution with: pyxel package . main.py - Resources are stored in .pyxres files editable through the built-in tools ## Key Features - 16-color palette enforces a cohesive retro aesthetic automatically - Built-in sprite, tilemap, sound, and music editors require no external tools - WebAssembly export lets you share games via a URL - Simple update/draw API is beginner-friendly and quick to prototype with - Lightweight enough to run on Raspberry Pi and low-spec hardware ## Comparison with Similar Tools - **Pygame** — General-purpose; Pyxel is opinionated with retro constraints and built-in editors - **PICO-8** — Commercial fantasy console with Lua; Pyxel is free and uses Python - **LÖVE** — Lua-based 2D engine without retro constraints; Pyxel is Python-native - **TIC-80** — Similar fantasy console concept; Pyxel offers Python and has better web export - **Godot** — Full-featured engine; Pyxel is intentionally minimal for quick retro games ## FAQ **Q: Can Pyxel handle games larger than small prototypes?** A: It is designed for retro-scale projects. For larger games with higher resolutions or complex scenes, a full engine like Godot or Pygame is a better fit. **Q: What languages does Pyxel support?** A: Python is the primary language. The engine also has a Rust API for those who want direct access to the core. **Q: How do I distribute my Pyxel game?** A: Use pyxel app2html to create a single HTML file playable in any browser. For desktop, distribute the Python script with Pyxel as a dependency. **Q: Is Pyxel good for teaching programming?** A: Yes. Its simple API and instant visual feedback make it popular in coding workshops and CS education. ## Sources - https://github.com/kitao/pyxel - https://pyxel.wiki/ --- Source: https://tokrepo.com/en/workflows/asset-2814a466 Author: Script Depot