babylon.config.defines.tunables

Precision and timescale tunables.

Spec 058: extracted from the historical babylon.config.defines monolith. Re-exported via babylon.config.defines.__init__; composed into GameDefines in babylon.config.defines._assembler.

Classes

PrecisionDefines(**data)

Numerical precision configuration for deterministic simulation.

TimescaleDefines(**data)

Simulation timescale configuration for weekly ticks.

class babylon.config.defines.tunables.PrecisionDefines(**data)[source]

Bases: BaseModel

Numerical precision configuration for deterministic simulation.

Epoch 0 Physics Hardening: - All floating-point values snap to a 10^-n grid (default n=6) - This prevents drift accumulation over long simulations (100+ years) - ROUND_HALF_UP ensures deterministic cross-platform behavior

The Gatekeeper Pattern: Quantization is applied at TYPE level (Pydantic AfterValidator), NOT inside formulas.

Note: Increased from 5 to 6 decimal places for 100-year (5200 tick) Carceral Equilibrium simulations to reduce cumulative rounding errors.

Parameters:
  • decimal_places (int)

  • rounding_mode (str)

  • epsilon (float)

  • comparison_epsilon (float)

model_config: ClassVar[ConfigDict] = {'frozen': True}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

decimal_places: int
rounding_mode: str
epsilon: float
comparison_epsilon: float
class babylon.config.defines.tunables.TimescaleDefines(**data)[source]

Bases: BaseModel

Simulation timescale configuration for weekly ticks.

Epoch 0 Physics Hardening: - 1 tick = 7 days (weekly resolution) - 52 weeks = 1 year (for annual rate conversions)

This is critical for: - Economic flow rates (annual -> per-tick conversion) - Historical pacing (events per game year) - UI display (showing dates/weeks)

All annual rates (wage_rate, extraction_efficiency) are divided by weeks_per_year to get per-tick rates.

Parameters:
  • tick_duration_days (int)

  • weeks_per_year (int)

  • hours_per_year (int)

model_config: ClassVar[ConfigDict] = {'frozen': True}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

tick_duration_days: int
weeks_per_year: int
hours_per_year: int
property ticks_per_year: int

Number of ticks per simulation year.

Since 1 tick = 1 week, this equals weeks_per_year.

property days_per_year: int

Days per simulation year (ticks * days_per_tick).

With defaults: 7 * 52 = 364 days (close to actual 365-366).