Adaptive Tick Rate (#940)

Dynamically adjust the simulation tick rate to maximize fidelity while staying within server capacity.

Design

The server runs as fast as it can. Tick processing time governs the rate:

  • Target utilization: 70% of tick interval (30% headroom for spikes)
  • Scale up: if processing < 50% of interval, increase rate by 10%
  • Scale down: if processing > 80% of interval, decrease rate by 10%
  • Evaluation interval: every 10 ticks (not every tick, to avoid oscillation)
  • Rate range: 0.5 Hz (floor) to 200 Hz (ceiling)
  • Situation floor: never below 1 Hz when time-sensitive maneuvers are active

Time-Sensitive Maneuvers (1 Hz minimum floor)

  • land or ascend maneuver with AGL < 50 km
  • surface_contact_state is contact or tipped
  • Docking approach (distance to target < 1 km)
  • Brachistochrone final approach (tgo < 60s)

The high-fidelity check reads ship state from the simulation’s in-memory cache (not Redis) to avoid per-evaluation I/O overhead.

Game Time Consistency

dt_game = time_scale / tick_rate. When tick rate changes, dt_game changes proportionally. Game time advances at the same wall-clock rate regardless of tick rate — higher tick rate means smaller steps, not faster game time.

Redis State

Key Type Description
game:adaptive_tick_rate string "true" or "false" (default "false")
game:tick_rate string Current tick rate in Hz (default "1.0")

Admin API

Endpoint Method Body Description
/api/admin/game/adaptive_tick_rate POST {"enabled": true/false} Toggle adaptive mode

The existing /api/admin/game/status response includes adaptive_tick_rate (bool) and current_tick_rate (float).

Admin UI

Toggle in the game control panel alongside pause/resume. Displays current tick rate when adaptive mode is on.


Back to top

Galaxy — Kubernetes-based multiplayer space game

This site uses Just the Docs, a documentation theme for Jekyll.