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>
This commit is contained in:
15
apps/backend/Simulation/Model/SimulationUnits.cs
Normal file
15
apps/backend/Simulation/Model/SimulationUnits.cs
Normal file
@@ -0,0 +1,15 @@
|
||||
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;
|
||||
}
|
||||
Reference in New Issue
Block a user