Architecture
The rewrite follows a clean two-package split:src/crimson/— Game logic layer (modes, simulation, UI, persistence, data tables)src/grim/— Engine/platform layer (raylib wrapper, assets, rendering, audio)
grim.dll vs crimsonland.exe boundary while staying idiomatic for Python.
Current State
The rewrite is a playable full game with:- Complete boot flow (splash, company logos, main menu)
- All game modes: Survival, Rush, Quests (tiers 1-5), Tutorial, Typ-o-Shooter
- Full weapon/creature/perk content
- Terrain/sprite/decal rendering
- Music and gameplay SFX
- Local multiplayer (2-4 players)
- Online multiplayer with rollback netcode
- Deterministic simulation supporting seeded runs and verifiable replays
- Original game secrets and Easter eggs
Key Features
Deterministic Simulation
The rewrite implements a fully deterministic gameplay pipeline that supports:- Seeded runs — Use
--seed Nfor reproducible gameplay - Replay recording — All gameplay can be recorded to
.crdfiles - Headless verification — Replays can be verified without rendering
- Differential testing — Compare rewrite behavior against original exe captures
Float32 Parity
The original game uses x87 FPU with 53-bit precision mode and float32 storage. The rewrite preserves:- Native float32 constants from decompilation
- Operation ordering that affects rounding boundaries
- Explicit float32 store/truncation points
Replay System
The rewrite includes a comprehensive replay system:Module Organization
The codebase is organized into logical subsystems:Crimson Module
Game logic, modes, and simulation
Grim Module
Engine layer and platform services
Replay Module
Deterministic replay system
Perks Module
Perk runtime architecture
Systems
The rewrite implements four major systems:Gameplay System
Player movement, weapons, creatures, and combat
Rendering System
Terrain, sprites, effects, and UI
Audio System
Music, SFX, and audio routing
Input System
Keyboard, mouse, gamepad, and multiplayer input
Parity Verification
The project uses multiple strategies to verify parity:- Static analysis — Ghidra decompilation as source of truth
- Runtime evidence — Frida/WinDbg captures of original behavior
- Differential testing — Headless comparison of state checkpoints
- Fixture tests — Known-good outputs from original exe
Bug Fixes
The rewrite fixes several bugs in the original game by default. These can be re-enabled with--preserve-bugs for parity testing:
- Bonus drop suppression comparing
amountto weapon ID - Greater Regeneration having no effect
- Bandage applying a health multiplier instead of heal
- Multiple co-op asymmetry bugs
- Mini-Rocket Swarmers spread collapse
Tech Stack
- Python 3.13+ — Modern Python with type hints
- raylib (pyray) — Cross-platform graphics and audio
- msgspec — Fast serialization for replays and state
- Construct — Binary format parsing (PAQ, JAZ)
- pytest — 200+ tests covering gameplay and parity
- uv — Fast Python package management
Quick Start
Next Steps
Architecture
Explore the module structure
Game Loop
Understand the frame pipeline
Deterministic Pipeline
Learn about deterministic simulation
Parity Status
Check current parity state