alice-zip 0.1.0

Compression algorithms (LZ77, Deflate-like, dictionary coding)
Documentation

Procedural Generation Compression Engine Store algorithms, not data.

日本語版 README


ALICE-Zip is a next-generation compression tool that stores "how to generate the data" instead of the data itself.

For patterns, waves, and mathematical data, it achieves compression ratios of 10x to 1000x. For everything else, it falls back to LZMA, ensuring it's never worse than standard tools.

Features

  • Procedural Compression: Sine waves, polynomials, and mathematical patterns
  • Adaptive Fallback: Automatically selects LZMA when procedural methods don't help
  • Lossless: Bit-perfect reconstruction
  • Cross-Platform: Python, Rust, C#/Unity, C++/UE5

Installation

pip install alice-zip

Quick Start

Command Line

# Compress
alice-zip compress data.bin -o data.alice

# Decompress
alice-zip decompress data.alice -o restored.bin

# Show file info
alice-zip info data.alice

Python API

from alice_zip import ALICEZip
import numpy as np

zipper = ALICEZip()

# Compress sine wave data
data = np.sin(np.linspace(0, 100*np.pi, 100000)).astype(np.float32)
compressed = zipper.compress(data)

print(f"Original: {data.nbytes:,} bytes")
print(f"Compressed: {len(compressed):,} bytes")
print(f"Ratio: {data.nbytes / len(compressed):.1f}x")

# Decompress
restored = zipper.decompress(compressed)

How It Works

Traditional compression finds patterns in bytes. ALICE finds patterns in mathematics.

Original Data = Generated(parameters) + Residual

Where:
  - Generated()  = Mathematical function (polynomial, sine wave, etc.)
  - parameters   = Tiny description (~100 bytes)
  - Residual     = Compressed difference (often near-zero)

Example

Input:  Sine wave, 100,000 samples (400 KB)
        ↓
Analysis: Detected as "Sine wave, freq=50Hz, amp=1.0"
        ↓
Output: Parameters only (~280 bytes)
        ↓
Result: 400 KB → 280 bytes = 1400x compression

Benchmarks

Data Type Original Compressed Ratio
Sine wave (100K samples) 400 KB ~280 bytes 1400x
Polynomial (degree 3) 400 KB ~285 bytes 1400x
Linear gradient 400 KB ~250 bytes 1600x
Random data 400 KB ~370 KB 1.08x (LZMA fallback)

Ideal Use Cases

  • Scientific Data: Simulation outputs, sensor readings, waveforms
  • Game Assets: Procedural textures, terrain heightmaps
  • IoT/Edge: Sensor logs on bandwidth-constrained devices
  • Time Series: Telemetry, monitoring logs with patterns

When NOT to Use

Data Type Reason
JPEG/PNG/MP3 Already compressed
Random/encrypted data No pattern to exploit
Small files (<1KB) Header overhead

Game Industry Exception

Free for game development! Just add this to your credits:

Powered by ALICE-Zip (https://github.com/ext-sakamoro/ALICE-Zip)

See LICENSE for details.

Building from Source

git clone https://github.com/ext-sakamoro/ALICE-Zip
cd ALICE-Zip

# Install Python package
pip install -e .

# Run tests
pytest tests/ -v

Related Projects

Project Description
ALICE-DB Model-based time-series database
ALICE-Edge Embedded/IoT model generator (no_std)
ALICE-Streaming-Protocol Ultra-low bandwidth video streaming
ALICE-Eco-System Complete Edge-to-Cloud pipeline demo

All projects share the core philosophy: encode the generation process, not the data itself.

License

Open Core License

  • Personal / Educational: Free under MIT License
  • Game Development: Free with attribution only (excluding console firmware, game engines, etc.)
  • Commercial: Core is free under MIT, Pro/Enterprise required for advanced features

See LICENSE for full details.

Author

Created by Moroya Sakamoto


"The best compression is not to store data, but to store the recipe for generating it."