Overview
While Shed Skin is excellent for compute-intensive algorithms, some of the most impressive examples are full-featured applications that demonstrate its ability to handle complex, real-world software. This page highlights the most notable examples that showcase Shed Skin’s practical capabilities.DOOM Renderer
Lines of code: 666Category: Game engine
Speed: ~10-20x faster than CPython
A complete WAD (game data file) rendering engine that can play DOOM levels with impressive performance.
What it does
- Loads and parses DOOM1.WAD files
- Renders 3D environments using classic DOOM algorithms
- Handles player movement and game state
- Plays background music (FLAC support)
Performance Impact
Watch this video demonstrating the dramatic difference in performance before and after Shed Skin compilation. The compiled version runs smoothly at playable frame rates, while the Python version is extremely sluggish.Running the Example
Code Snippet
The DOOM example showcases complex data structure handling and real-time rendering algorithms that benefit greatly from compilation.Commodore 64 Emulator
Lines of code: 3,332Category: Emulator
Speed: Fast enough for real-time emulation
A full Commodore 64 emulator that runs classic C64 programs and games.
Features
- Complete 6502 CPU emulation
- VIC-II graphics chip emulation
- SID sound chip emulation
- CIA timer/IO emulation
- Loads T64, D64, and PRG files
- Sprite handling
- Joystick support
Project Structure
Running the Example
Why It’s Impressive
Emulating a complete computer system requires:- Cycle-accurate CPU emulation
- Real-time graphics rendering
- Complex state management
- Proper timing and synchronization
Pylot Ray Tracer
Lines of code: 943Category: Graphics rendering
Features: Multiprocessing support
A sophisticated ray tracer that produces photorealistic images with advanced lighting effects.
Features
- Realistic lighting and shadows
- Reflection and refraction
- Multiple primitive types (spheres, planes, etc.)
- Multiprocessing for parallel rendering
- High-quality output
Running the Example
Performance
Ray tracing is extremely compute-intensive, making it an ideal use case for Shed Skin. The compiled version achieves 20-40x speedup over pure Python, turning impractical render times into reasonable ones.PyCSG - Constructive Solid Geometry
Lines of code: 212Category: 3D modeling
Constructive Solid Geometry (CSG) allows complex 3D shapes to be created by combining simple primitives using boolean operations (union, intersection, subtraction).
Capabilities
- Boolean operations on 3D solids
- STL file export
- Complex geometric calculations
- Mesh generation
Code Example
Use Cases
- 3D modeling and CAD
- Procedural geometry generation
- Game level design
- 3D printing preparation
Othello Engine
Lines of code: 341 (othello2)Category: Game AI
A strong Othello (Reversi) game engine with sophisticated AI.
Features
- Alpha-beta pruning search
- Position evaluation
- Move generation and validation
- Human vs Computer play
- Strong playing strength
Code Example
Performance Impact
Board game AI requires evaluating millions of positions. Shed Skin’s speedup allows:- Deeper search (more moves ahead)
- Stronger play within time limits
- Real-time interactive response
Chess Engine
Lines of code: 316 (chess), 285 (sunfish)Category: Game AI Two different chess engines demonstrating different design approaches.
Chess.py Features
- Alpha-beta search with quiescence
- Move generation using the 0x88 board representation
- Position evaluation
- Legal move validation
Code Example
0x88 Board Representation
NES Emulator (Pygasus)
Lines of code: 1,510Category: Emulator A Nintendo Entertainment System emulator capable of running classic NES games.
Features
- 6502 CPU emulation
- PPU (Picture Processing Unit) graphics
- APU (Audio Processing Unit) sound
- Mapper support for different cartridge types
- Controller input
Performance Requirements
NES emulation requires:- Processing ~1.79 MHz CPU cycles
- Rendering 60 frames per second
- Audio generation at 44.1 kHz
- Real-time synchronization
Advanced Ray Tracers
MiniLight
Lines of code: 442Category: Global illumination An advanced ray tracer implementing physically-based rendering:
- Monte Carlo path tracing
- Global illumination
- Realistic light transport
- HDR output
Path Tracing
Lines of code: 219Category: Ray tracing Modern path tracing algorithm:
- Unbiased rendering
- Physically accurate materials
- Indirect lighting
- Soft shadows and ambient occlusion
Performance Comparison
Compression Algorithms
Tarsalzp
Lines of code: 868Category: Data compression A sophisticated data compression algorithm implementing:
- LZMA-style compression
- Range encoding
- Dictionary compression
- High compression ratios
Performance Critical Code
Compression algorithms involve:- Heavy bit manipulation
- Hash table operations
- Sequential data processing
- Buffer management
Scientific Computing
Quantum Monte Carlo (Quameon)
Lines of code: 1,194Category: Quantum physics simulation Quantum Monte Carlo algorithms for simulating quantum systems:
- Variational Monte Carlo
- Diffusion Monte Carlo
- Random walk simulations
- Statistical analysis
Barnes-Hut Simulation
Lines of code: 404Category: N-body physics Efficient gravitational force calculation:
Why These Examples Matter
These real-world examples demonstrate that Shed Skin can handle:- Large codebases: Thousands of lines of complex code
- Complex algorithms: Emulators, game engines, ray tracers
- Real-time performance: Interactive applications and simulations
- Multiple modules: Projects spanning many files
- Extension modules: Integration with existing Python code
Running Examples with GUI
Many examples require pygame or other graphics libraries:Performance Summary
Learning from Real-World Code
These examples are excellent for learning:- Code organization: How to structure larger projects
- Type discipline: Maintaining consistent types throughout
- Performance patterns: What code patterns work well
- Module interaction: How to split code across files
- Extension design: Creating Python-importable modules