Back to Blog

Stellar Throne Devlog #8: Validation, Parity, and Precision

by MrPhil
stellar-thronedevloggame-developmentziggodotparity-testing

Today focused on validating that our dual-engine architecture — Godot for the UI client and Zig for the high-performance simulation engine — remained synchronized after deploying the Zig backend to production.

Fleet Position Serialization

A fleet position serialization bug caused coordinate mismatches between engines. The data structure was standardized and the movement interpolation code updated to resolve smooth rendering problems.

Parity Test Framework

To prevent future divergence, a comprehensive serialization parity test framework was built to catch any mismatch before it caused a production bug. This infrastructure compares game state across both engines after every operation — serializes game state from Godot to JSON, deserializes it in Zig, runs a simulation step, then serializes Zig's results back.

Population Growth Precision

Population growth calculations revealed floating-point precision differences. Switching from integer to floating-point math in Zig produced identical results down to the last decimal place.

Async Test Fixes

Asynchronous test race conditions required proper sequencing fixes to prevent false test failures.

Technical Metrics

  • Ten commits completed
  • 327 lines added for parity framework
  • 81 lines changed for population fixes
  • 6 functions updated for precision standardization
  • 15 validation scenarios covering empires, fleets, planets, and star systems

Current Status

The Zig backend runs in production with comprehensive validation. Population growth matches exactly, serialization round-trips verified, and fleet movement is smooth — though star rendering issues remain under investigation.

Next Steps

Debug star rendering, expand parity tests for edge cases, profile remaining bottlenecks, and explore new features leveraging the speed advantage.