Back to Blog

Stellar Throne Devlog #5 — All 21 Zig Simulation Phases Implemented + Parity Tester Online (52.7x Faster)

by MrPhil
stellar-thronedevloggame-developmentziggodotperformance

All 21 simulation phases in Zig are complete, and the parity testing system is now active to compare performance between Zig and Godot engines. The Zig implementation is feature-complete but requires behavioral alignment before becoming the default runtime.

Architecture

The dual-engine approach uses Godot for UI/visualization and Zig for high-performance simulation across empires, colonies, economies, and galactic systems.

Implementation Highlights

All 21 phases now function: population growth, resource production, fleet logistics, natural disasters, diplomacy, military combat, and quest systems.

Configuration System

The TOML data loader replaced hardcoded values with ~800 lines of Zig code, enabling dynamic loading of gameplay parameters, resource definitions, and narrative content.

Testing Infrastructure

The bit-rotted test suite was rehabilitated (11 failing tests fixed), tests reorganized under src/tests, and a health monitor script created. All Zig tests now pass.

Parity Framework

A Turn Simulation Service serializes state to JSON, runs turns in Zig, then deserializes results. Current findings show floating-point drift and minor logic differences between engines.

Performance

Zig achieved approximately 52.7x speed improvement in large galaxy simulations.

Next Steps

Feature parity achieved; behavioral parity requires resolving population, stability, and diplomacy formula mismatches before Zig becomes the default runtime.