What Game Engines Know About Data That Databases Forgot
6 hours ago
- #database-design
- #game-servers
- #entity-component-system
- Typhon is an embedded persistent ACID database engine in .NET designed for game servers and real-time simulations, using entities, components, and systems.
- It combines ECS (Entity-Component-System) architecture with database features like MVCC snapshot isolation for sub-microsecond latency, cache-line-aware storage, and zero-copy access.
- Typhon integrates lessons from game engines: cache locality by storing components contiguously, zero-copy reads from pinned memory, and treating entities as pure identity (IDs).
- It also adopts database capabilities: ACID transactions with per-component MVCC, indexed selective access via B+Trees and spatial indexes, durability with WAL-based recovery, and query planning.
- Components in Typhon support different storage modes (Versioned, SingleVersion, Transient) to optimize for data like inventory (persistent) vs. positions (frequently updated).
- Views in Typhon bridge ECS systems and database queries by incrementally refreshing based on changes, avoiding full scans.
- Trade-offs include blittable components only, entity-centric relationships (not SQL JOINs), and schema defined in code (C# structs) rather than SQL.
- Typhon is purpose-built for game servers, allowing per-operation durability choices and specialized storage for varying data needs.