Files
space-game/apps/backend/Simulation/Model/SimulationUnits.cs
Jonathan Bourdon 5df5111463 feat: migrate simulation to physically-based unit system
Replace arbitrary game units with real-world measurements throughout
the simulation and viewer: planet orbits in AU, sizes in km, galaxy
positions in light-years. Add SimulationUnits helpers for conversions,
separate WarpSpeed from FtlSpeed for ships, fix FTL transit progress
to use galaxy-space distances, overhaul Lagrange point placement with
Hill sphere approximation, and update the viewer to scale and format
all distances correctly. Ships in FTL transit now render in galaxy view.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-16 14:21:20 -04:00

16 lines
524 B
C#

namespace SpaceGame.Simulation.Api.Simulation;
public static class SimulationUnits
{
public const float KilometersPerAu = 149_597_870.7f;
public const float MetersPerKilometer = 1000f;
public static float AuToKilometers(float au) => au * KilometersPerAu;
public static float AuPerSecondToKilometersPerSecond(float auPerSecond) =>
auPerSecond * KilometersPerAu;
public static float MetersPerSecondToKilometersPerSecond(float metersPerSecond) =>
metersPerSecond / MetersPerKilometer;
}